verify: The ops "How to manage actions" doc shows a snapshot action handler th - #26
Closed
github-actions[bot] wants to merge 1 commit into
Closed
github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
Author
|
This PR is a draft. Inspect the changes, then mark it ready for review to run CI. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The ops "How to manage actions" doc shows a snapshot action handler that ends with
event.set_results({'result': msg})— so the action results dict contains the keyresult, with a value like"Stored snapshot in db-snapshot.tar.gz.". The very next code block, the unit test, asserts'snapshot-size' in ctx.action_results. I believe the doc is wrong here: the handler never sets asnapshot-sizekey, so that assertion would fail.I implemented the snapshot action in the kepler charm exactly as the doc describes (log a message, do the snapshot, then
event.set_results({'result': msg})), and added a test that asserts my understanding: that'snapshot-size'is NOT inctx.action_results(and that the results are exactly{'result': 'Stored snapshot in db-snapshot.tar.gz.'}). This test is expected to pass.If CI passes, the doc's example unit test is incorrect — the documented assertion
'snapshot-size' in ctx.action_resultsdoes not hold against the documented handler, because the handler setsresult, notsnapshot-size. If CI fails (i.e.,snapshot-sizesomehow IS in the results), then the doc's test would pass and the doc would be correct — but I'd be surprised, since nothing in the shown handler produces that key.