1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
summary: Ensure that the core.proxy.* settings are honored
details: |
Snapd provides the core.proxy.* config which can be used to setup the proxy used.
This test verifies that when a proxy config is set, the snapd commands go through
the proxy.
# ubuntu-14.04 does not have systemd-run
systems: [-ubuntu-14.04-*]
restore: |
snap set core proxy.https=
systemctl stop tinyproxy || true
execute: |
if ! command -v python3; then
echo "SKIP: need python3"
exit 0
fi
if [ -n "${http_proxy:-}" ] || [ -n "${https_proxy:-}" ] ||
[ -n "${HTTPS_PROXY:-}" ] || [ -n "${HTTPS_PROXY:-}" ]; then
echo "SKIP: cannot run when there is another http proxy"
exit 0
fi
systemd-run --service-type=notify --unit tinyproxy -- python3 "$TESTSLIB/tinyproxy/tinyproxy.py"
tests.systemd wait-for-service -n 30 --state active tinyproxy
echo "Setup proxy config"
snap set core proxy.https=http://localhost:3128
echo "Check that the commands go through the proxy"
snap find test-snapd-tools | MATCH test-snapd-tools
# check unit output
"$TESTSTOOLS"/journal-state match-log 'CONNECT api.snapcraft.io' -u tinyproxy
|