Skip to content

Commit

Permalink
Add wait_for after removing offers, relations and saas
Browse files Browse the repository at this point in the history
CMR tests continue to fail on CI because of the controller not being
cleaned up. This happens because we try to destroy it *before* removing
the offers on the model. This patch fixes this.
  • Loading branch information
nvinuesa authored and jack-w-shaw committed Nov 15, 2023
1 parent 0ec38c2 commit 4117d19
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/suites/cmr/offer_consume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ run_offer_consume() {

echo "Remove offer"
juju remove-relation dummy-sink dummy-offer
# wait for the relation to be removed.
wait_for null '.applications["dummy-sink"] | .relations'
juju remove-saas dummy-offer
# wait for saas to be removed.
wait_for null '.["application-endpoints"]'
Expand All @@ -64,6 +66,7 @@ run_offer_consume() {
juju switch "model-offer"
wait_for null '.offers."dummy-offer"."total-connected-count"'
juju remove-offer "admin/model-offer.dummy-offer" -y
wait_for null '.offers'

echo "Clean up"
destroy_model "model-offer"
Expand Down Expand Up @@ -117,6 +120,8 @@ run_offer_consume_cross_controller() {

echo "Remove offer"
juju remove-relation dummy-sink dummy-source
# wait for the relation to be removed.
wait_for null '.applications["dummy-sink"] | .relations'
juju remove-saas dummy-source
# wait for saas to be removed.
wait_for null '.["application-endpoints"]'
Expand All @@ -125,6 +130,7 @@ run_offer_consume_cross_controller() {
juju switch "${offer_controller}:model-offer"
wait_for null '.offers."dummy-offer"."total-connected-count"'
juju remove-offer "${offer_controller}:admin/model-offer.dummy-source" -y
wait_for null '.offers'

echo "Clean up"
destroy_controller "controller-consume"
Expand Down

0 comments on commit 4117d19

Please sign in to comment.