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

[JUJU-1821] Fixed test-controller-test-unregister-test #14623

Merged

Conversation

anvial
Copy link
Member

@anvial anvial commented Sep 17, 2022

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

  • Code style: imports ordered, good names, simple structure, etc
  • Comments saying why design decisions were made

QA steps

Commands to run to verify that the change works.

cd tests
./main.sh -v cli run_unregister

Copy link
Member

@wallyworld wallyworld left a 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
Copy link
Member

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.

Copy link
Member

@wallyworld wallyworld left a 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

@anvial
Copy link
Member Author

anvial commented Sep 19, 2022

/merge

@jujubot jujubot merged commit edcd328 into juju:2.9 Sep 19, 2022
@anvial anvial deleted the JUJU-1821-fix-test-controller-test-unregister-test branch November 2, 2022 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants