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-1209] Added a bash-based version of the unregister-controller test. #14538

Conversation

anvial
Copy link
Member

@anvial anvial commented Aug 30, 2022

This PR adds a bash-based version of the unregister-controller test.

Checklist

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

QA steps

cd tests
./main.sh -v -p aws -c aws controller test_unregister

Copy link
Member

@jameinel jameinel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the comments in our hangout, I think we want to take a different tack and not have to do login / update-password.


set timeout 10
set controller_name [lindex $argv 1]
spawn juju login -u admin -c {*}$argv
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this syntax seems a bit hard to understand, but I have the feeling we'll get used to it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backup/restore acoounts.yaml file helped to avoid using expect so we can postpone this tool introduction


controller_name=$(juju controllers --format=json | jq -r '."current-controller"')

echo "Change admin password"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a high level, why is our "unregister test suite" worrying about change user password and login? (IOW, while this may be a faithful representation of our existing test suite, and it is great to port across, we should take a critical view and consider if we should be testing this behavior as part of this test.)

Maybe it should, as you test that you can login again to a controller that you have unregistered. (presumably this is testing that the controller hasn't actually been destroyed, just removed from local info?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backup/restore acoounts.yaml file helped to avoid using juju login (and expect tool)

echo "Unregister controller"
juju unregister --yes "${controller_name}"

juju controllers --format=json | jq -r ".\"controllers\".\"${controller_name}\"" | check null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a comment here with:

# if you unregister the active controller, it should ensure that the current active controller is reset to empty

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do have a concern that this check doesn't really check what I think the behavior of unregister is meant to be.

The meaning of juju unregister is not 'I have unset the default controller'. The meaning is that "I no longer know who $controller is", whether they were the default or not.
So I'd rather see a test of:
juju controllers and that before the unregister it lists that the named controller is there, and after the unregister it no longer does.
I think it is fine to then also include "and if the controller that was removed was the default controller, we don't leave a default value that points to something that is now unknown".
But we are missing the bit that says "this is no longer a known controller".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it,

I've added:

  • a check that the named controller is in juju controllers output before the unregister
  • a check that the default controller is not equal to the unregistered one after juju unregister.

tests/main.sh Outdated
@@ -227,7 +227,7 @@ fi
echo ""

echo "==> Checking for dependencies"
check_dependencies curl jq yq shellcheck
check_dependencies curl jq yq shellcheck expect
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README.md also needs to be updated:

## Getting started

Before running tests, you'll need to install `jq`, `yq`, `shellcheck` and `golangci-lint`:

sudo snap install jq
sudo snap install yq
sudo snap install shellcheck
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.44.2

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if that exact version is still even correct anymore. I feel like this README entry should probably be redirected to something that is actually used by the CI suite as well, to ensure dependencies, so that we get them lined up, and can avoid future skew.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backup/restore acoounts.yaml file helped to avoid using expect so we can postpone this tool introduction

Copy link
Member

@manadart manadart 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.

@anvial
Copy link
Member Author

anvial commented Sep 6, 2022

/merge

@jujubot jujubot merged commit 5ec3e38 into juju:2.9 Sep 6, 2022
@ycliuhw ycliuhw mentioned this pull request Sep 9, 2022
jujubot added a commit that referenced this pull request Sep 10, 2022
#14595

```
Merge branch '2.9' into 2.9-into-develop

# Conflicts:
# acceptancetests/assess_cloud.py
# acceptancetests/assess_endpoint_bindings.py
# acceptancetests/assess_heterogeneous_control.py
# state/migration_import_test.go
# apiserver/facades/client/client/status.go
# scripts/win-installer/setup.iss
# snap/snapcraft.yaml
# version/version.go
```

- #14551
- #14557
- #14560
- #14558
- #14554
- #14570
- #14577
- #14506
- #14538
- #14559
- #14574
- #14573
- #14567
- #14545
- #14541
- #14588
@anvial anvial deleted the JUJU-1209-rewrite-to-bash-based-nw-unregister-controller branch November 2, 2022 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants