-
Notifications
You must be signed in to change notification settings - Fork 119
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 different deployer folders per each test #1919
Conversation
5ef26eb
to
56b3220
Compare
@@ -94,7 +94,7 @@ func (d *CustomAgentDeployer) SetUp(ctx context.Context, svcInfo ServiceInfo) (D | |||
fmt.Sprintf("%s=%s", fleetPolicyEnv, d.policyName), | |||
) | |||
|
|||
configDir, err := d.installDockerfile() | |||
configDir, err := d.installDockerfile(deployerFolderName(svcInfo)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we could use go-resource to manage these files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, updated custom_agent
to create the required files using go-resource.
Terraform (servicedeployer) was already using go-resource
to create the required configuration files or scripts.
locationManager, err := locations.NewLocationManager() | ||
if err != nil { | ||
return "", fmt.Errorf("failed to find the configuration directory: %w", err) | ||
} | ||
|
||
customAgentDir := filepath.Join(locationManager.DeployerDir(), dockerCustomAgentDir) | ||
customAgentDir := filepath.Join(locationManager.DeployerDir(), dockerCustomAgentDir, folder) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to use tmp dirs for these files? Though probably we want them in more persistent places for test system --setup
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I would prefer to keep them in these known/persistent locations.
Defined configDir into the agent or service struct instead of the service info or gent info, since it is not needed to use outside these structs/instances.
func ProcessResourceApplyResults(results resource.ApplyResults) string { | ||
var errors []string | ||
for _, result := range results { | ||
if err := result.Err(); err != nil { | ||
errors = append(errors, err.Error()) | ||
} | ||
} | ||
return strings.Join(errors, ", ") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to the helpers since it is going to be used in both agentdeployer and servicedeployer packages.
ymlPaths []string | ||
project string | ||
env []string | ||
configDir string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved from agentInfo struct to be just defined here in the deployed agent.
Currently, this variable is not used outside this struct dockerComposeDeployedAgent
, so it is not needed to keep it afterwards in the info struct.
💚 Build Succeeded
History
cc @mrodm |
Follows #1909
Part of #787
This PR creates a different deployer folder for each test. This will ensure that if at some point those kind of tests could be parallelized, they would not have issues creating all the resources in the same folder.
Currently, all resources are created in the same folder and they are not cleaned up after finishing the tests:
~/.elastic-package/deployer/terraform
~/.elastic-package/deployer/docker_custom_agent
For instance:
This PR creates a new subfolder under those folders to create the resources needed for each test in different directories. For instance: