Skip to content

[JUJU-858] Add quality of life feature ensure application removal at return#665

Merged
jujubot merged 1 commit intojuju:masterfrom
cderici:wait-for-app-remove
Apr 19, 2022
Merged

[JUJU-858] Add quality of life feature ensure application removal at return#665
jujubot merged 1 commit intojuju:masterfrom
cderici:wait-for-app-remove

Conversation

@cderici
Copy link
Copy Markdown
Contributor

@cderici cderici commented Apr 6, 2022

Description

This is to make life easier by allowing the following pattern:

    await ops_test.model.applications[related_app.name].remove()
    # Block until it is really gone. Added after an itest failed when tried to redeploy:
    # juju.errors.JujuError: ['cannot add application "related-app": application already exists']
    await ops_test.model.block_until(lambda: related_app.name not in ops_test.model.applications)

to be written as:

    await ops_test.model.remove_application(related_app.name, block_until_done=True)

Fixes #656

QA Steps

tox -e integration -- tests/integration/test_application.py::test_app_remove_wait_flag

Notes & Discussion

Another option would be to do await ops_test.model.applications[related_app.name].remove(block_until_done=True), however, then it gets weird to ask the app.model to block_until the app.name is no longer in model.applications while the app object is being torn down.

Copy link
Copy Markdown
Contributor

@juanmanuel-tirado juanmanuel-tirado left a comment

Choose a reason for hiding this comment

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

LG2M

@cderici
Copy link
Copy Markdown
Contributor Author

cderici commented Apr 19, 2022

$$merge$$

@jujubot jujubot merged commit 7d2a423 into juju:master Apr 19, 2022
@cderici cderici deleted the wait-for-app-remove branch April 19, 2022 15:52
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.

Means to wait for an app to really be removed

3 participants