Skip to content

ci: Execute rest_api_test tests in codeconv#16653

Open
sergio-costas wants to merge 2 commits intocanonical:masterfrom
sergio-costas:ensure-all-tests-are-done
Open

ci: Execute rest_api_test tests in codeconv#16653
sergio-costas wants to merge 2 commits intocanonical:masterfrom
sergio-costas:ensure-all-tests-are-done

Conversation

@sergio-costas
Copy link
Contributor

@sergio-costas sergio-costas commented Feb 24, 2026

The tests in the rest_api_test.go file require dbus-launch, available in dbus-x11. If that binary isn't available, the tests are skipped.

A clear proof of this are the Codecov checks, which show that the code in rest_api.go isn't being checked, even when there are tests that cover it.

This patch fixes this.

Thanks for helping us make a better snapd!
Have you signed the license agreement and read the contribution guide?

@sergio-costas sergio-costas marked this pull request as ready for review February 24, 2026 10:24
@github-actions github-actions bot added Run only one system Only runs spread tests on one system and removed Run only one system Only runs spread tests on one system labels Feb 24, 2026
@github-actions
Copy link

github-actions bot commented Feb 24, 2026

Fri Feb 27 12:15:21 UTC 2026
The following results are from: https://github.com/canonical/snapd/actions/runs/22479051640

Failures:

Preparing:

  • openstack:ubuntu-core-24-64:tests/main/apparmor-prompting-support
  • openstack:ubuntu-20.04-64:tests/main/nss-modules:winbind
  • openstack:ubuntu-25.10-64:tests/main/apparmor-prompting-integration-tests:create_multiple_deny

Executing:

  • openstack:ubuntu-core-20-64:tests/core/snapd-maintenance-msg
  • openstack:ubuntu-core-20-64:tests/core/services
  • openstack:ubuntu-core-24-64:tests/core/kernel-base-gadget-pair-single-reboot-failover:gadget_base
  • openstack:ubuntu-core-24-64:tests/core/kernel-base-gadget-single-reboot-failover
  • openstack:ubuntu-core-24-64:tests/main/dbus-activation-session
  • openstack:ubuntu-core-24-64:tests/main/snap-user-service-upgrade-failure
  • openstack:ubuntu-25.10-64:tests/unit/go:clang
  • openstack:ubuntu-25.10-64:tests/main/auto-refresh-gating
  • openstack:ubuntu-25.10-64:tests/main/apparmor-prompting-snapd-startup
  • openstack:ubuntu-25.10-64:tests/main/appstream-id

Restoring:

  • openstack:ubuntu-core-20-64:tests/core/snapd-maintenance-msg
  • openstack:ubuntu-core-20-64:tests/core/
  • openstack:ubuntu-core-20-64:
  • openstack:ubuntu-core-24-64:tests/core/kernel-base-gadget-pair-single-reboot-failover:gadget_base
  • openstack:ubuntu-core-24-64:tests/core/
  • openstack:ubuntu-core-24-64:
  • openstack:ubuntu-core-24-64:tests/core/kernel-base-gadget-single-reboot-failover
  • openstack:ubuntu-core-24-64:tests/core/
  • openstack:ubuntu-core-24-64:
  • openstack:ubuntu-25.10-64:tests/main/apparmor-prompting-snapd-startup
  • openstack:ubuntu-25.10-64:tests/main/
  • openstack:ubuntu-25.10-64:

Skipped tests from snapd-testing-skip

  • openstack:ubuntu-24.04-64:tests/main/i18n

@sergio-costas
Copy link
Contributor Author

Or maybe... should we install the package in the tests themselves...?

@codecov
Copy link

codecov bot commented Feb 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.88%. Comparing base (8d929ea) to head (e83eef8).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #16653      +/-   ##
==========================================
+ Coverage   77.52%   78.88%   +1.35%     
==========================================
  Files        1359     1358       -1     
  Lines      187225   187223       -2     
  Branches     2446     2446              
==========================================
+ Hits       145152   147695    +2543     
+ Misses      33298    30534    -2764     
- Partials     8775     8994     +219     
Flag Coverage Δ
unittests 78.88% <ø> (+1.35%) ⬆️

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.

@sergio-costas
Copy link
Contributor Author

Codecov changes:
Captura desde 2026-02-24 11-48-58
Captura desde 2026-02-24 11-48-42
Captura desde 2026-02-24 11-48-30
Captura desde 2026-02-24 11-48-18
Captura desde 2026-02-24 11-48-04

@sergio-costas
Copy link
Contributor Author

@olivercalder What do you think? Should I add dbus-x11 in each test, or keep it in the control file?

@sergio-costas sergio-costas force-pushed the ensure-all-tests-are-done branch from 3f9178e to 521e994 Compare February 24, 2026 11:34
@sergio-costas
Copy link
Contributor Author

I moved it to the tests only.

@sergio-costas sergio-costas force-pushed the ensure-all-tests-are-done branch 2 times, most recently from 37e32cf to 8db092d Compare February 24, 2026 15:29
@sergio-costas sergio-costas force-pushed the ensure-all-tests-are-done branch 2 times, most recently from d7b2b26 to 434dd8a Compare February 25, 2026 10:45
Copy link
Member

@olivercalder olivercalder left a comment

Choose a reason for hiding this comment

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

I think we need a solution which works when running unit tests locally via ./run-checks as well as in spread and in GitHub CI. The current approach only works in GitHub CI it seems.

I think this should either be packaging as a dependency of snapd, or at least a build-dep. Or it's something we'll want to demand when running ./run-checks, similar to what we do for clang-format.

@bboozzoo will know better than I do, though :)

@sergio-costas
Copy link
Contributor Author

Then an extra step would be to check in ./run-checks if dbus-launcher is available, and abort if not... What do you think? @bboozzoo ?

The tests in the rest_api_test.go file require dbus-launcher,
available in dbus-x11. If that binary isn't available, the tests
are skipped.

A clear proof of this is the Codeconv checks, which show that
the code in rest_api.go isn't being checked, even when there
are tests that cover it.

This patch fixes this.
@sergio-costas sergio-costas force-pushed the ensure-all-tests-are-done branch from 434dd8a to e83eef8 Compare February 27, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants