Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Agent policies per each test execution #1866

Merged
merged 32 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
da98733
Create policy for no-provision - missing to re-assign policy
mrodm May 23, 2024
dd9bf60
Ensure test policy is re-assigned
mrodm May 23, 2024
df6268a
Delete agent policies created for each test
mrodm May 23, 2024
ed1411e
delete datastream created for testing
mrodm May 23, 2024
1c55b1c
Apply changes to all scenarios
mrodm May 24, 2024
2bca8d8
Skip tests with terraform
mrodm May 24, 2024
60c34da
Fix env. variable name
mrodm May 24, 2024
402b631
Change order tear down handlers
mrodm May 28, 2024
e7ea9ff
Exit loop if getDocs returns zero documents
mrodm May 28, 2024
8e95b4d
Reorder handlers and change condition
mrodm May 28, 2024
a421e83
Add new tear down handler
mrodm May 28, 2024
8c9c5d8
Update comment
mrodm May 28, 2024
c11361f
Add one more test package
mrodm May 28, 2024
7d71562
Remove exceptions in wait loop to delete docs
mrodm May 28, 2024
e4e8751
Update some logger calls to use the right formats
mrodm May 28, 2024
f43dc77
Restore packages skipped
mrodm May 28, 2024
df1835c
Remove empty line
mrodm May 28, 2024
d9e8000
Remove mustBeZero parameter from delete docs function
mrodm May 28, 2024
7769e3c
Add handler to clean test scenario - test only stage
mrodm May 28, 2024
91676d7
Skip handlers that should not be executed with --no-provision
mrodm May 28, 2024
46b3ff8
Change condition in handler
mrodm Jun 5, 2024
2570fee
Merge remote-tracking branch 'upstream/main' into create-policy-per-test
mrodm Jun 5, 2024
2379f81
Use helper from common
mrodm Jun 5, 2024
8372d73
Add comment
mrodm Jun 5, 2024
8488344
Reassign policy back to agent for both independent and stack agents
mrodm Jun 5, 2024
b3b7a1d
Update namespace in policyEnroll
mrodm Jun 6, 2024
f39c935
Avoid creating a new policy if no stages are used
mrodm Jun 6, 2024
7cfa6db
Merge upstream/main onto create-policy-per-test
mrodm Jun 6, 2024
3e94058
Remove code to wait until docs are removed from datastream (and wipe …
mrodm Jun 6, 2024
7dd578f
Randomized namespace in enroll Agent Policy
mrodm Jun 6, 2024
f6ee2bd
Create enroll policy if not stages are used
mrodm Jun 6, 2024
0837447
Rename variable
mrodm Jun 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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