Skip to content

t/m/apparmor-prompting-smoke-camera: adds smoke spread test for permission prompting for camera interface#16682

Open
natibek wants to merge 1 commit intocanonical:masterfrom
natibek:camera-interface-smoke-test
Open

t/m/apparmor-prompting-smoke-camera: adds smoke spread test for permission prompting for camera interface#16682
natibek wants to merge 1 commit intocanonical:masterfrom
natibek:camera-interface-smoke-test

Conversation

@natibek
Copy link
Contributor

@natibek natibek commented Feb 26, 2026

This addresses SNAPDENG-35726

Adds a smoke test to more simply test permission prompting end-to-end without having to run the full apparmor-prompting-integration-tests. This smoke test specifically checks for the correct flow of permission prompting for the camera interface by

  • reading /dev/video9 by a user without access to the camera
  • allowing or denying the resulting permission prompt for either a 10s duration, a single request, a session, or forever
  • checking that the original request succeeds or fails with respect to the response to the prompt
  • retrying the read on /dev/video9 and checking if the rule created for the 10s duration, the session, or forever lifespan is applied for the second request or that the flow is the same if the prompt response was for a single request

@github-actions
Copy link

Thu Feb 26 21:07:00 UTC 2026
The following results are from: https://github.com/canonical/snapd/actions/runs/22459216177

Failures:

Skipped tests from snapd-testing-skip

@codecov
Copy link

codecov bot commented Feb 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.52%. Comparing base (c28008a) to head (08adf88).
⚠️ Report is 21 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #16682      +/-   ##
==========================================
- Coverage   77.62%   77.52%   -0.10%     
==========================================
  Files        1348     1360      +12     
  Lines      186909   187181     +272     
  Branches     2449     2446       -3     
==========================================
+ Hits       145085   145121      +36     
- Misses      33054    33279     +225     
- Partials     8770     8781      +11     
Flag Coverage Δ
unittests 77.52% <ø> (-0.10%) ⬇️

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
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.

Looks really good! Just a few small things

prepare: |
snap set system experimental.user-daemons=true
# make sure the video dev file exists
touch "$TARGET_FILE"
Copy link
Member

Choose a reason for hiding this comment

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

We may need to chmod 666 the video file, though I'm not certain

- ubuntu-2*

environment:
TARGET_FILE: /dev/video9
Copy link
Member

Choose a reason for hiding this comment

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

Maybe worth adding a comment something like # use a fake video device path which is extremely unlikely to actually exist


echo "Check the process exited correctly"
case "$PROMPT_RESPONSE" in
"allow") MATCH "" < "$TMP_STDOUT";;
Copy link
Member

Choose a reason for hiding this comment

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

I think matching against nothing will always succeed. I think what we need to do is NOMATCH "Permission denied" < "$TMP_STDERR"


echo "Check the process exited correctly"
case "$PROMPT_RESPONSE" in
"allow") MATCH "" < "$TMP_STDOUT";;
Copy link
Member

Choose a reason for hiding this comment

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

Same here, want to use NOMATCH on stderr

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