tests/main/searching: limit the number of calls to snap find
During tests, snapd is run with SNAPD_DEBUG_HTTP=7 which causes a lot of logging
to stderr. The logs are forwarded to journald and later end up on disk.
On openSUSE 15.1, we have observed that excessive logging, especially for snap
find --section=featured, may choke journald and cause the whole of the API call
to snapd take much longer than expected.
Specifically a request like this was observed:
Oct 02 06:36:47 oct020627-523151 snapd[8948]: retry.go:61:
DEBUG: The retry loop for https://api.snapcraft.io/api/v1/snaps/search?...§ion=featured
finished after 1 retries, elapsed time=1m0.45638716s, status: 200
Try to workaround the problem by reusing cached test data.
Signed-off-by: Maciej Borzecki <email address hidden>
client: refactor the timeout to be per single raw request
The higher level client.do() call already sets up a timeout that covers the
retries of client.raw() requests. Add a helper to up a per-request timeout that
covers both the request and the response. Since the timeout is set for a single
request only, we can properly distinguish the errors caused by reaching the
request deadline and ones caused by other factors (eg. no socket availble) that
trigger the retry mechanism.
Signed-off-by: Maciej Borzecki <email address hidden>
interfaces/seccomp: query apparmor sandbox helper rather than aggregate info
Some snippets are added conditionally depending on AppAmor being fully supported
by the host system. Instead of querying the aggregate forced-dev-mode staus,
poke the AppArmor sandbox helpers in sandbox/apparmor directly.
Make the unit test more specific.
Signed-off-by: Maciej Borzecki <email address hidden>