Skip to content

Commit c7e1ef6

Browse files
sergiocazzolatoZeyadYasser
authored andcommitted
tests: add debug info to snap-user-service-socket-activation (canonical#17030)
* tests: add debug info to snap-user-service-socket-activation This is failing constantly in uc26 with the following error. The idea is to add some extra info in order to see the root cause. ``` + nc -w 30 -U /home/test/snap/test-snapd-user-service-sockets/common/common.sock + MATCH 'Connected to common' nc: /home/test/snap/test-snapd-user-service-sockets/common/common.sock: Permission denied ``` * run nc from user session * minor change to retrigger tests * remove uc26 from fundamental * remove newline
1 parent 5765ec4 commit c7e1ef6

2 files changed

Lines changed: 15 additions & 13 deletions

File tree

.github/workflows/data-fundamental-systems.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@
7373
"rules": "main"
7474
}
7575
]
76-
}
76+
}

tests/main/snap-user-service-socket-activation/task.yaml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,31 @@ debug: |
2727
tests.session -u test exec systemctl --user status snapd.session-agent.service || true
2828
tests.session -u test exec journalctl --user || true
2929
30+
echo "socket file and parent permissions"
31+
ls -ld ~test ~test/snap ~test/snap/test-snapd-user-service-sockets ~test/snap/test-snapd-user-service-sockets/common || true
32+
ls -l ~test/snap/test-snapd-user-service-sockets/common/common.sock || true
33+
stat ~test/snap/test-snapd-user-service-sockets/common/common.sock || true
34+
35+
echo "socket listeners (user session)"
36+
tests.session -u test exec ss -xlpn | grep -F 'test-snapd-user-service-sockets/common/common.sock' || true
37+
38+
echo "direct nc stderr for common.sock"
39+
tests.session -u test exec nc -v -w 30 -U /home/test/snap/test-snapd-user-service-sockets/common/common.sock || true
40+
3041
execute: |
3142
echo "When the service snap is installed"
3243
"$TESTSTOOLS"/snaps-state install-local test-snapd-user-service-sockets
3344
3445
echo "And the user mode systemd instance is started"
3546
tests.session -u test prepare
36-
# Staring with Ubuntu 25.04, many programs gain dedicated apparmor
37-
# profiles. This includes the nc program which is now confined and does
38-
# not allow for cap_dac_override required to traverse /run/user/$(id -u
39-
# test)/ or /home/test, which do not have o+x permission. As such, poke a
40-
# small hole to allow that.
41-
HOME_TEST_MODE="$(stat -c '%a' ~test)"
42-
chmod +x /run/user/"$(id -u test)" ~test
43-
# The runtime directory will be removed by now.
44-
tests.cleanup defer chmod "$HOME_TEST_MODE" ~test
4547
4648
echo "It's sockets are created in the test user's directories and activate the service"
4749
[ -S ~test/snap/test-snapd-user-service-sockets/common/common.sock ]
48-
nc -w 30 -U ~test/snap/test-snapd-user-service-sockets/common/common.sock | MATCH "Connected to common"
50+
tests.session -u test exec nc -w 30 -U /home/test/snap/test-snapd-user-service-sockets/common/common.sock | MATCH "Connected to common"
4951
5052
[ -S ~test/snap/test-snapd-user-service-sockets/x1/data.sock ]
51-
nc -w 30 -U ~test/snap/test-snapd-user-service-sockets/x1/data.sock | MATCH "Connected to data"
53+
tests.session -u test exec nc -w 30 -U /home/test/snap/test-snapd-user-service-sockets/x1/data.sock | MATCH "Connected to data"
5254
5355
USER_RUNTIME_DIR="/run/user/$(id -u test)"
5456
[ -S "$USER_RUNTIME_DIR"/snap.test-snapd-user-service-sockets/run.sock ]
55-
nc -w 30 -U "$USER_RUNTIME_DIR"/snap.test-snapd-user-service-sockets/run.sock | MATCH "Connected to runtime"
57+
tests.session -u test exec nc -w 30 -U "$USER_RUNTIME_DIR"/snap.test-snapd-user-service-sockets/run.sock | MATCH "Connected to runtime"

0 commit comments

Comments
 (0)