Commit 7d2a423
authored
Merge pull request #665 from cderici/wait-for-app-remove
#665
#### Description
This is to make life easier by allowing the following pattern:
```python
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:
```python
await ops_test.model.remove_application(related_app.name, block_until_done=True)
```
Fixes #656
#### QA Steps
```sh
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.2 files changed
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
875 | 875 | | |
876 | 876 | | |
877 | 877 | | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
878 | 893 | | |
879 | 894 | | |
880 | 895 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
0 commit comments