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-1198] Rewrite to bash-based nw-destroy-model-lxd #14436

Merged

Conversation

anvial
Copy link
Member

@anvial anvial commented Aug 8, 2022

This patch adds destroy model test to the model suite in bash-based tests.

Original (python-based) tests live here.

Checklist

  • Code style: imports ordered, good names, simple structure, etc
  • Comments saying why design decisions were made
  • [ ] Go unit tests, with comments saying what you're testing
  • [ ] Integration tests, with comments saying what you're testing
  • [ ] doc.go added or updated in changed packages

QA steps

cd tests
./main.sh -v -p lxd model test_model_destroy

@anvial anvial changed the base branch from develop to 2.9 August 8, 2022 09:40

echo "Destroy model 'model-new'"
destroy_model "model-new"
juju switch :model-destroy
Copy link
Member

Choose a reason for hiding this comment

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

We technically don't need the colon here

And also, this is incorrect I believe. The original test asserts that if the active model is destroyed, you are automatically switched to another

Copy link
Member Author

Choose a reason for hiding this comment

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

I agreed about the colon. But I've concerns about automatic switching:
https://pastebin.canonical.com/p/99Y9R7jQ7b/

Here is the origin (python-based) test:

destroy_model(client, new_client)
log.info('Juju successfully dropped its current model. '
'Switching to {} to complete test'.format(current_model))
switch_model(client, current_model, controller)
log.info('SUCCESS')

juju models --format json | jq -r '."current-model"' | check model-destroy

destroy_model "model-destroy"
}
Copy link
Member

Choose a reason for hiding this comment

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

One small bit of coverage missing

if not_found_error in e.stderr:
log.info("Model fully removed")
break

The python based test ensures that the created model can't be found

Copy link
Member Author

Choose a reason for hiding this comment

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

destroy_model "model-new"
is_destroyed=$(juju models --format json | jq -r '.models[] | select(."short-name" == "model-new")')
if [[ -z ${is_destroyed} ]]; then is_destroyed=true; fi
check_contains "${is_destroyed}" true

Added explicit model deletion check.

Copy link
Member

@jack-w-shaw jack-w-shaw left a comment

Choose a reason for hiding this comment

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

LGTM

@anvial
Copy link
Member Author

anvial commented Aug 12, 2022

/merge

@jujubot jujubot merged commit fc368fd into juju:2.9 Aug 12, 2022
@ycliuhw ycliuhw mentioned this pull request Aug 19, 2022
jujubot added a commit that referenced this pull request Aug 20, 2022
#14488

```
Merge branch '2.9' into develop

# Conflicts:
# .github/workflows/smoke.yml
# apiserver/common/tools_test.go
# apiserver/facades/client/application/application_unit_test.go
# apiserver/facades/client/application/mock_test.go
# apiserver/facades/client/application/package_test.go
# apiserver/facades/client/cloud/cloudV2_test.go
# apiserver/facades/client/cloud/cloud_test.go
# caas/kubernetes/provider/application/application.go
# cmd/juju/commands/upgradecontroller_test.go
# cmd/juju/commands/upgrademodel.go
# cmd/juju/commands/upgrademodel_test.go
# cmd/juju/controller/kill.go
# go.mod
# go.sum
# scripts/win-installer/setup.iss
# snap/snapcraft.yaml
# tests/suites/deploy/bundles/lxd-profile-bundle.yaml
# tests/suites/deploy/bundles/telegraf_bundle.yaml
# tests/suites/deploy/bundles/trusted_bundle.yaml
# tests/suites/deploy/deploy_charms.sh
# tests/suites/network/network_health.sh
# tests/suites/ovs_maas/ovs_netplan_config.sh
# tests/suites/spaces_ec2/juju_bind.sh
# tests/suites/spaces_ec2/upgrade_charm_with_bind.sh
# tests/suites/upgrade/streams.sh
# upgrades/operations.go
# upgrades/upgrade_test.go
# version/version.go
```

Includes PRs:
- #14424
- #14428
- #14430
- #14431
- #14427
- #14433
- #14434
- #14437
- #14439
- #14440
- #14442
- #14445
- #14446
- #14444
- #14448
- #14453
- #14436
- #14459
- #14462
- #14458
- #14418
- #14419
- #14463
- #14464
- #14455
- #14449
- #14465
- #14470
- #14473
- #14476
- #14468
- #14383
- #14483
@anvial anvial deleted the JUJU-1198-rewrite-to-bash-based-nw-destroy-model-lxd 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
3 participants