-
Notifications
You must be signed in to change notification settings - Fork 507
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
[JUJU-1821] Fixed test-controller-test-unregister-test #14623
[JUJU-1821] Fixed test-controller-test-unregister-test #14623
Conversation
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 there's something wrong with the test which needs fixing. The changes in this PR appear to just be hiding a real problem (unless I'm misunderstanding something).
@@ -12,8 +12,12 @@ run_unregister() { | |||
juju controllers --format=json | jq -r ".\"controllers\" | has(\"${controller_name}\")" | check true | |||
|
|||
echo "Backup controller info before unregister" | |||
cp ~/.local/share/juju/controllers.yaml ~/.local/share/juju/controllers.yaml.bak | |||
cp ~/.local/share/juju/accounts.yaml ~/.local/share/juju/accounts.yaml.bak | |||
if [[ -f "${HOME}/.local/share/juju/controllers.yaml" ]]; then |
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 appears wrong - if there's no controllers.yaml file, then there's no controller to unregister in the first place. Adding the file check seems to be hiding a genuine problem with the test. This is supported by the line abobe this
juju controllers --format=json | jq -r ".\"controllers\" | has(\"${controller_name}\")" | check true
Why are we using | true
which can hide the fact that the expected controller doesn't exist. We should fail the test at that point if the juju controllers command fails.
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.
Looks good once check is added for juju swith error message
Then, it needs to be added to CI in the same was as for the display clouds test
/merge |
This PR fixes the test-controller-test-unregister-test tests, the original test does not consider that
controllers.yaml
file may not exist.The test is now rewritten using the fake
controllers.yaml
file created in the test folder.The test is moved from the controller suite to the cli suite.
Checklist
QA steps
Commands to run to verify that the change works.
cd tests ./main.sh -v cli run_unregister