Files
snapd/tests/main/debug-pprof/task.yaml
Sergio Cazzolato fe6e39a2bc tests: more details in spread tests - part 13 (#13924)
* Adding more details to tests - part 13

* Add more details

* adding more tests

* Update tests/main/debs/task.yaml

Co-authored-by: Miguel Pires <miguelpires94@gmail.com>

* Update tests/main/debug-sandbox/task.yaml

Co-authored-by: Miguel Pires <miguelpires94@gmail.com>

* Update tests/main/econnreset/task.yaml

Co-authored-by: Miguel Pires <miguelpires94@gmail.com>

* Update tests/main/enable-disable/task.yaml

Co-authored-by: Miguel Pires <miguelpires94@gmail.com>

* Update tests/main/health/task.yaml

Co-authored-by: Miguel Pires <miguelpires94@gmail.com>

* Update tests/main/snap-validate-enforce/task.yaml

Co-authored-by: Miguel Pires <miguelpires94@gmail.com>

* Update tests/main/snap-validate-with-store/task.yaml

Co-authored-by: Miguel Pires <miguelpires94@gmail.com>

* Update tests/main/enable-disable/task.yaml

Co-authored-by: Miguel Pires <miguelpires94@gmail.com>

* Update tests/main/debug-paths/task.yaml

Co-authored-by: Miguel Pires <miguelpires94@gmail.com>

* Update tests/main/default-tracks/task.yaml

Co-authored-by: Miguel Pires <miguelpires94@gmail.com>

* Update tests/main/enable-disable/task.yaml

Co-authored-by: Miguel Pires <miguelpires94@gmail.com>

---------

Co-authored-by: Miguel Pires <miguelpires94@gmail.com>
2024-05-02 08:14:13 -03:00

30 lines
1.2 KiB
YAML

summary: Verify pprof endpoints are accessible to the tooling
details: |
pprof is go a tool for visualization and analysis of profiling data.
This test checks that the pprof profiles can be accessed through
the http://localhost/v2/debug/pprof/ API
# ubuntu-core: no curl
# ubuntu-14.04: curl does not have --unix-socket option
systems: [-ubuntu-core-*, -ubuntu-14.04-*]
execute: |
# endpoints are accessible only for the root user
su -c 'curl -s --unix-socket /run/snapd.socket http://localhost/v2/debug/pprof/cmdline' test > unauthorized
MATCH '"kind":"login-required"' < unauthorized
# one of pprof endpoints exposes a cmdline of the process
curl -s --unix-socket /run/snapd.socket -o reported-cmdline http://localhost/v2/debug/pprof/cmdline
# should be the same as in /proc/<pid>/cmdline
mainpid=$(systemctl show -p MainPID snapd.service | cut -f2 -d=)
tr -d '\0' < "/proc/$mainpid/cmdline" > real-cmdline
diff -up <(od -c real-cmdline) <(od -c reported-cmdline)
# try to fetch a heap profile
curl -s --unix-socket /run/snapd.socket -o heap http://localhost/v2/debug/pprof/heap
# go tool pprof fails if profile is corrupted
go tool pprof -raw ./heap