-
Notifications
You must be signed in to change notification settings - Fork 36
[DPE-9685] Release storage on teardown #1827
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e11ce49
fix(charm): release storage on unit teardown
marceloneppel e3da631
Merge remote-tracking branch 'origin/16/edge' into fix/1550-release-s…
marceloneppel 1641aeb
test(integration): reproduce #1550 teardown on juju 4.0
marceloneppel 4943352
Merge remote-tracking branch 'origin/16/edge' into fix/1550-release-s…
marceloneppel 1b7a4fb
fix(charm): only release storage on full app teardown
marceloneppel 817c857
Merge branch '16/edge' into fix/1550-release-storage-on-teardown
marceloneppel 333daca
docs(charm): trim storage-detaching comments and fix copyright year
marceloneppel b78b456
fix(charm): disable snap services on teardown, not just stop
marceloneppel 47fa98c
test(spread): run storage-detaching on juju36 as a no-regression guard
marceloneppel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| #!/usr/bin/env python3 | ||
| # Copyright 2026 Canonical Ltd. | ||
| # See LICENSE file for licensing details. | ||
|
|
||
| import logging | ||
|
|
||
| import pytest | ||
|
|
||
| from .adapters import JujuFixture | ||
| from .jubilant_helpers import DATABASE_APP_NAME | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
| # rootfs (machine-scoped) is the only pool that reproduces the stuck unmount on | ||
| # Juju 4.0: the detachable lxd pool destroys the container before detaching. | ||
| ROOTFS_STORAGE = dict.fromkeys(("archive", "data", "logs", "temp"), "rootfs") | ||
|
|
||
|
|
||
| @pytest.mark.abort_on_fail | ||
| def test_storage_released_on_removal(juju: JujuFixture, charm): | ||
| """Graceful removal must release the storage so teardown completes. | ||
|
|
||
| Regression test for canonical/postgresql-operator#1550: without stopping the | ||
| workload in the ``storage-detaching`` hook the snap keeps the storage mounts | ||
| busy, so Juju's unmount fails ("target is busy") and teardown hangs. | ||
| """ | ||
| juju.ext.model.deploy( | ||
| charm, | ||
| num_units=1, | ||
| config={"profile": "testing"}, | ||
| storage=ROOTFS_STORAGE, | ||
| force=True, | ||
| ) | ||
| juju.ext.model.wait_for_idle(apps=[DATABASE_APP_NAME], status="active") | ||
|
|
||
| logger.info("Removing %s and waiting for a clean teardown", DATABASE_APP_NAME) | ||
| juju.ext.model.remove_application( | ||
| DATABASE_APP_NAME, | ||
| block_until_done=True, | ||
| destroy_storage=True, | ||
| timeout=15 * 60, | ||
| ) | ||
|
|
||
| detaching = [ | ||
| storage for storage in juju.ext.model.list_storage() if storage["life"] == "detaching" | ||
| ] | ||
| assert not detaching, f"storage stuck detaching after removal: {detaching}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| summary: test_storage_detaching.py | ||
| environment: | ||
| TEST_MODULE: test_storage_detaching.py | ||
| # #1550 only reproduces on Juju 4.0 (3.6 masks it by removing still-Dying storage), | ||
| # so juju40 is the real regression test. Run juju36 too as a no-regression guard: | ||
| # stopping/disabling the snap in storage-detaching must not break 3.6 teardown. | ||
| CONCIERGE_JUJU_CHANNEL/juju40: 4.0/stable | ||
|
marceloneppel marked this conversation as resolved.
|
||
| execute: | | ||
| tox run -e integration -- "tests/integration/$TEST_MODULE" --model testing --alluredir="$SPREAD_TASK/allure-results" | ||
| artifacts: | ||
| - allure-results | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.