-
Notifications
You must be signed in to change notification settings - Fork 129
[system tests] Allow setting an optional prefix for the service TestRunID #2744
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
Conversation
|
|
||
| prefix := "" | ||
| if v, found := os.LookupEnv("ELASTIC_PACKAGE_PREFIX_SERVICE_TEST_RUN_ID"); found && v != "" { | ||
| prefix = v | ||
| } | ||
| svcInfo.Test.RunID = common.CreateTestRunIDWithPrefix(prefix) |
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.
In case of using the terraform service deployer, a part of updating the RunID used in as terraform variable, the alias used to render the policy templates in tests needs to be set to the same value as the terraform variable. This is needed for instance for aws.ec2_metrics that filters by the some resource name.
| func CreateTestRunID() string { | ||
| return fmt.Sprintf("%d", rand.Intn(testRunMaxID-testRunMinID)+testRunMinID) | ||
| return CreateTestRunIDWithPrefix("") | ||
| } |
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.
This function is used also in other places (e.g. adding a random suffix to policies), those can be kept as they are now.
For instance:
| Namespace: common.CreateTestRunID(), |
💚 Build Succeeded
cc @mrodm |
This PR allows to customize the Service TestRunID used in system tests to include a prefix string. This prefix is defined via environment variable:
export ELASTIC_PACKAGE_PREFIX_SERVICE_TEST_RUN_ID=1a2bHow to test this PR locally
While the system tests are running you can check the files created by terraform at:
it should countain a prefix of 9 digits (e.g.
file-1a2b21464.log).or via the Discover view in Kibana filtering by
data_stream.dataset : "terraform_local.local", and it should contain alogfield similar to:Author's Checklist