-
Notifications
You must be signed in to change notification settings - Fork 113
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
Add new flags to just setup, teardown or run tests only #1250
Conversation
Hi everyone, |
0050990
to
684ee9b
Compare
Refactor runTest to extract a method with all the information about the scenario (policies, service, component templates, etc.)
if options.RunSetup || options.RunTearDown || options.RunTestsOnly { | ||
return nil, errors.New("terraform service deployer not supported to run by steps") | ||
} |
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.
For now, this service deployer is not supported. I'd prefer to just leave this option (test flags) for stacks/services started locally for now.
This the error that is going to be shown to the user:
2024/02/15 09:44:36 DEBUG setting up service...
Error: error running package system tests: could not complete test run: could not create service runner: terraform service deployer not supported to run by steps
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.
👍 we can add this later
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 think we can ship it ⛵
Thanks!
if options.RunSetup || options.RunTearDown || options.RunTestsOnly { | ||
return nil, errors.New("terraform service deployer not supported to run by steps") | ||
} |
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.
👍 we can add this later
dirPath := filepath.Dir(r.serviceStateFilePath) | ||
err := os.RemoveAll(dirPath) |
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.
Maybe we should remove the file only, in case we use the directory later for other states. Leaving the directory there should not be a problem.
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.
That makes totally sense.
Update this function to just delete the file, and update the tests accordingly.
cmd/testrunner.go
Outdated
// variant flag should not be used with tear-down or no-provision flags | ||
// cannot be defined here using MarkFlagsMutuallyExclusive as in --config-file |
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 comment seems a bit lonely around here, not clear to what it refers to. Or is another mutual exclusion missing here?
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 wanted to add a note that I could not set the mutually exclusive using testTypeCmd.MarkFlagsMutuallyExclusive
. Variant flag is defined in the cmd
variable and not in the testTypeCmd
.
This is managed afterwards in the code:
https://github.com/elastic/elastic-package/pull/1250/files#diff-33701d098205d3537f071235876d903ddbfa851c492917e49852c9212bc1d4fdR316-R320
I'll update this comment with that reference
💚 Build Succeeded
History
cc @mrodm |
Closes #582
This PR is intended to add the required subcommands and/or parameters to allow just run the setup, no-provision or teardown of tests. Focused on system tests.
Added flags:
--setup
ServiceSetupDir
folder the original policy assigned to the agent as well as the policy created by elastic-package--no-provision
ServiceSetupDir
--tear-down
ServiceSetupDir
Pending:
$ ls -l ~/.elastic-package/profiles/default/stack/state/ total 4 -rw-r--r-- 1 user user 773 feb 14 17:15 service.json
CanRunSetupTeardownIndependent()
orCanRunSeparateTests
returns truesql_input
Checklist
How to test locally