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

many: make API confdb reads load ephemeral data #15209

Merged
merged 3 commits into from
Mar 20, 2025

Conversation

miguelpires
Copy link
Contributor

Load ephemeral confdb data when reading from the API (for snap get). This requires making the read side of the API async, since it might be necessary to run hooks. The result in then transmitted through the change to the client. In case there are no custodian hooks to run, no tasks are run and the result is just directly placed into a "done" change.
This change turned out to be larger than I thought due to the API changes. The changes to the API are relatively simple but they required basically a re-write of the tests which blew up the diff. I can split the changes, if needed

Load ephemeral confdb data when reading from the API (for snap get).
This requires making the read side of the API async, since it might be
necessary to run hooks. The result in then transmitted through the
change to the client. In case there are no custodian hooks to run, no
tasks are run and the result is just directly placed into a "done"
change.

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
@miguelpires miguelpires added the confdb confdb work (previously called registries and before aspects) label Mar 14, 2025
@github-actions github-actions bot added the Needs Documentation -auto- Label automatically added which indicates the change needs documentation label Mar 14, 2025
Copy link

github-actions bot commented Mar 14, 2025

Thu Mar 20 11:07:54 UTC 2025
The following results are from: https://github.com/canonical/snapd/actions/runs/13945935117

Failures:

Preparing:

  • openstack:debian-sid-64

Executing:

  • openstack:opensuse-tumbleweed-64:tests/main/auto-refresh-pre-download:close
  • openstack:opensuse-tumbleweed-64:tests/main/auto-refresh-pre-download:ignore
  • openstack:opensuse-tumbleweed-64:tests/main/auto-refresh:parallel
  • openstack:opensuse-tumbleweed-64:tests/main/auto-refresh-backoff
  • openstack:opensuse-tumbleweed-64:tests/main/auto-refresh:regular
  • openstack:opensuse-tumbleweed-64:tests/main/auto-refresh-pre-download:close_mid_restart
  • openstack:opensuse-tumbleweed-64:tests/main/auto-refresh-pre-download:restart
  • openstack:opensuse-tumbleweed-64:tests/main/snap-refresh-hold
  • openstack:opensuse-tumbleweed-64:tests/main/auto-refresh-gating
  • openstack:opensuse-tumbleweed-64:tests/main/auto-refresh-gating-from-snap
  • openstack:opensuse-tumbleweed-64:tests/main/auto-refresh-retry
  • openstack:opensuse-tumbleweed-64:tests/main/refresh-app-awareness-notify
  • google:ubuntu-25.04-64:tests/main/microk8s-smoke:edge

Restoring:

  • openstack:debian-sid-64
  • openstack:debian-sid-64:tests/main/interfaces-timeserver-control
  • openstack:opensuse-tumbleweed-64:tests/main/refresh-app-awareness-notify

Copy link

codecov bot commented Mar 14, 2025

Codecov Report

Attention: Patch coverage is 70.19868% with 45 lines in your changes missing coverage. Please review.

Project coverage is 78.08%. Comparing base (d6d95f0) to head (e75b022).
Report is 29 commits behind head on master.

Files with missing lines Patch % Lines
overlord/confdbstate/confdbmgr.go 64.44% 11 Missing and 5 partials ⚠️
overlord/confdbstate/confdbstate.go 66.66% 10 Missing and 5 partials ⚠️
cmd/snap/cmd_get.go 66.66% 8 Missing and 3 partials ⚠️
daemon/api_confdb.go 72.72% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #15209      +/-   ##
==========================================
- Coverage   78.09%   78.08%   -0.01%     
==========================================
  Files        1190     1192       +2     
  Lines      158458   158979     +521     
==========================================
+ Hits       123746   124138     +392     
- Misses      27017    27110      +93     
- Partials     7695     7731      +36     
Flag Coverage Δ
unittests 78.08% <70.19%> (-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.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Thank you, small nitpick comments

@@ -76,14 +78,14 @@ func init() {
}

addCommand("get", shortGetHelp, longGetHelp, func() flags.Commander { return &cmdGet{} },
map[string]string{
waitDescs.also(map[string]string{
Copy link
Contributor

Choose a reason for hiding this comment

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

if the get command won't support --no-wait, why have it in the args description? the x.NoWait check below should be enough, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

snap expects a description for each option so if it's not included here, the parser creation panics. But I agree, this will look a bit confusing. I was trying to avoid making a new mixin but I'll do that. It'll be basically the same as the waitMixin but without NoWait

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, cmdWatch also uses waitMixin without NoWait and it was using it in a hacky way, so a new mixin makes more sense than I thought

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
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.

Thank you!

@miguelpires miguelpires requested a review from ZeyadYasser March 19, 2025 13:17
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.

Thank you!

@miguelpires miguelpires merged commit 28e3296 into canonical:master Mar 20, 2025
72 of 77 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confdb confdb work (previously called registries and before aspects) Needs Documentation -auto- Label automatically added which indicates the change needs documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants