Skip to content

Commit

Permalink
Create Agent policies per each test execution (#1866)
Browse files Browse the repository at this point in the history
This PR adds a new Agent Policy that will be created and configured
per each system test execution independently. Adding this new
Agent Policy ensures that data streams are always empty at the
beginning of the test and it avoids that two tests write into the
same Data Stream.
  • Loading branch information
mrodm authored Jun 6, 2024
1 parent 2bb0880 commit 3cc9d99
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 125 deletions.
1 change: 0 additions & 1 deletion .buildkite/pipeline.trigger.integration.tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ for package in $(find . -maxdepth 1 -mindepth 1 -type d) ; do
label_suffix=" (independent agent)"
fi
package_name=$(basename "${package}")

if [[ "$independent_agent" == "false" && "$package_name" == "oracle" ]]; then
echoerr "Package \"${package_name}\" skipped: not supported with Elastic Agent running in the stack (missing required software)."
continue
Expand Down
4 changes: 2 additions & 2 deletions internal/agentdeployer/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,12 @@ func (s *dockerComposeDeployedAgent) TearDown(ctx context.Context) error {
defer func() {
// Remove the service logs dir for this agent
if err := os.RemoveAll(s.agentInfo.Logs.Folder.Local); err != nil {
logger.Errorf("could not remove the agent logs (path: %s): %w", s.agentInfo.Logs.Folder.Local, err)
logger.Errorf("could not remove the agent logs (path: %s): %v", s.agentInfo.Logs.Folder.Local, err)
}

// Remove the configuration dir for this agent (e.g. compose scenario files)
if err := os.RemoveAll(s.agentInfo.ConfigDir); err != nil {
logger.Errorf("could not remove the agent configuration directory (path: %s) %w", s.agentInfo.ConfigDir, err)
logger.Errorf("could not remove the agent configuration directory (path: %s) %v", s.agentInfo.ConfigDir, err)
}
}()

Expand Down
4 changes: 2 additions & 2 deletions internal/servicedeployer/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (d *DockerComposeServiceDeployer) SetUp(ctx context.Context, svcInfo Servic
// service logs folder must no be deleted to avoid breaking log files written
// by the service. If this is required, those files should be rotated or truncated
// so the service can still write to them.
logger.Debug("Skipping removing service logs folder folder %s", svcInfo.Logs.Folder.Local)
logger.Debugf("Skipping removing service logs folder folder %s", svcInfo.Logs.Folder.Local)
} else {
err = files.RemoveContent(svcInfo.Logs.Folder.Local)
if err != nil {
Expand Down Expand Up @@ -242,7 +242,7 @@ func (s *dockerComposeDeployedService) TearDown(ctx context.Context) error {
}
// Remove the outputs generated by the service container
if err = os.RemoveAll(s.svcInfo.OutputDir); err != nil {
logger.Errorf("could not remove the temporary output files %w", err)
logger.Errorf("could not remove the temporary output files %s", err)
}
}()

Expand Down
2 changes: 1 addition & 1 deletion internal/servicedeployer/custom_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (d *CustomAgentDeployer) SetUp(ctx context.Context, svcInfo ServiceInfo) (D
// service logs folder must no be deleted to avoid breaking log files written
// by the service. If this is required, those files should be rotated or truncated
// so the service can still write to them.
logger.Debug("Skipping removing service logs folder folder %s", svcInfo.Logs.Folder.Local)
logger.Debugf("Skipping removing service logs folder folder %s", svcInfo.Logs.Folder.Local)
} else {
err = files.RemoveContent(svcInfo.Logs.Folder.Local)
if err != nil {
Expand Down
Loading

0 comments on commit 3cc9d99

Please sign in to comment.