Skip to content
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

o/h/ctlcmd: add a snapctl fail command #14525

Merged
merged 4 commits into from
Sep 25, 2024

Conversation

MiguelPires
Copy link
Contributor

Add a snapctl fail <reason> command to rejects changes in a registry transaction in change-view-<plug> hooks.

@MiguelPires MiguelPires added the registry registry related work (previously called aspects) label Sep 20, 2024
@github-actions github-actions bot added the Needs Documentation -auto- Label automatically added which indicates the change needs documentation label Sep 20, 2024
The snapctl fail commands rejects changes in a registry transaction.

Signed-off-by: Miguel Pires <[email protected]>
Copy link
Contributor

@zyga zyga left a comment

Choose a reason for hiding this comment

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

Should this be some sort of snapctl debug fail <...> command?

Separately I would make it take an argument that somehow implies where the failure is injected. As written it's somewhat generic in naming but very specific in semantics which feels wrong.

@MiguelPires
Copy link
Contributor Author

Should this be some sort of snapctl debug fail <...> command?

Separately I would make it take an argument that somehow implies where the failure is injected. As written it's somewhat generic in naming but very specific in semantics which feels wrong.

@zyga I don't think it should be a debug subcommand but maybe a registry subcommand?
I agree with the sentiment in general. At some point, I added a --view flag to relate this to registries, since we use it for other commands, but that also wasn't right. Maybe snapctl registry fail <reason> since I think we'll add snapctl registry sub-commands eventually. @pedronis wdyt?

Copy link

codecov bot commented Sep 23, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 78.86%. Comparing base (ac897ee) to head (61e31f4).
Report is 28 commits behind head on master.

Files with missing lines Patch % Lines
overlord/hookstate/ctlcmd/fail.go 89.28% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #14525   +/-   ##
=======================================
  Coverage   78.85%   78.86%           
=======================================
  Files        1079     1080    +1     
  Lines      145615   145666   +51     
=======================================
+ Hits       114828   114875   +47     
- Misses      23601    23605    +4     
  Partials     7186     7186           
Flag Coverage Δ
unittests 78.86% <90.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@ZeyadYasser ZeyadYasser left a comment

Choose a reason for hiding this comment

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

The changes look really good. I agree regarding moving this to a registry sub-command snapctl registry fail <reason>. Also, It would be nice to have a small spread test with a simple test snap.

overlord/hookstate/ctlcmd/fail_test.go Show resolved Hide resolved
@MiguelPires
Copy link
Contributor Author

MiguelPires commented Sep 24, 2024

Sorry, I thought I had commented here yesterday but looks like I forgot to click submit. Samuele's input was that this could be applicable to other hooks (so it would stay at snapctl fail) but to gate this behind the feature flag for now until we can confirm that

The spread test will be added once we have all the required pieces (I have a ticket for it already)

Copy link
Contributor

@ZeyadYasser ZeyadYasser left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@andrewphelpsj andrewphelpsj left a comment

Choose a reason for hiding this comment

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

Thanks!

@MiguelPires MiguelPires merged commit 9e91a46 into canonical:master Sep 25, 2024
53 of 56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Documentation -auto- Label automatically added which indicates the change needs documentation registry registry related work (previously called aspects)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants