Permalink
Fetching contributors…
Cannot retrieve contributors at this time
548 lines (524 sloc) 19.3 KB
project: snapd
environment:
GOHOME: /home/gopath
GOPATH: $GOHOME
REUSE_PROJECT: "$(HOST: echo $REUSE_PROJECT)"
PROJECT_PATH: $GOHOME/src/github.com/snapcore/snapd
# /usr/lib/go-1.6/bin for trusty (needs to be last as we use
# a different go in gccgo tests)
PATH: $GOHOME/bin:/snap/bin:$PATH:/usr/lib/go-1.6/bin:/var/lib/snapd/snap/bin
TESTSLIB: $PROJECT_PATH/tests/lib
SNAPPY_TESTING: 1
# we run the entire suite with re-exec on (the default) and modify
# the core snap so that it contains our new code. So we run new
# snapd from the deb that re-execs into new snapd in core. To
# test purely from the deb, set "export SPREAD_SNAP_REEXEC=0"
SNAP_REEXEC: "$(HOST: echo ${SPREAD_SNAP_REEXEC:-})"
MODIFY_CORE_SNAP_FOR_REEXEC: "$(HOST: echo ${SPREAD_MODIFY_CORE_SNAP_FOR_REEXEC:-1})"
SPREAD_STORE_USER: "$(HOST: echo $SPREAD_STORE_USER)"
SPREAD_STORE_PASSWORD: "$(HOST: echo $SPREAD_STORE_PASSWORD)"
SPREAD_STORE_EXPIRED_MACAROON: "$(HOST: echo $SPREAD_STORE_EXPIRED_MACAROON)"
SPREAD_STORE_EXPIRED_DISCHARGE: "$(HOST: echo $SPREAD_STORE_EXPIRED_DISCHARGE)"
SPREAD_DEBUG_EACH: "$(HOST: echo ${SPREAD_DEBUG_EACH:-1})"
LANG: "$(echo ${LANG:-C.UTF-8})"
LANGUAGE: "$(echo ${LANGUAGE:-en})"
# important to ensure adhoc and linode/qemu behave the same
SUDO_USER: ""
SUDO_UID: ""
TRUST_TEST_KEYS: "$(HOST: echo ${SPREAD_TRUST_TEST_KEYS:-true})"
MANAGED_DEVICE: "false"
CORE_CHANNEL: "$(HOST: echo ${SPREAD_CORE_CHANNEL:-edge})"
KERNEL_CHANNEL: "$(HOST: echo ${SPREAD_KERNEL_CHANNEL:-edge})"
GADGET_CHANNEL: "$(HOST: echo ${SPREAD_GADGET_CHANNEL:-edge})"
REMOTE_STORE: "$(HOST: echo ${SPREAD_REMOTE_STORE:-production})"
SNAPPY_USE_STAGING_STORE: "$(HOST: if [ $SPREAD_REMOTE_STORE = staging ]; then echo 1; else echo 0; fi)"
DELTA_REF: 2.29
DELTA_PREFIX: snapd-$DELTA_REF/
SNAPD_PUBLISHED_VERSION: "$(HOST: echo $SPREAD_SNAPD_PUBLISHED_VERSION)"
HTTP_PROXY: "$(HOST: echo $SPREAD_HTTP_PROXY)"
HTTPS_PROXY: "$(HOST: echo $SPREAD_HTTPS_PROXY)"
NO_PROXY: "127.0.0.1"
NEW_CORE_CHANNEL: "$(HOST: echo $SPREAD_NEW_CORE_CHANNEL)"
SRU_VALIDATION: "$(HOST: echo ${SPREAD_SRU_VALIDATION:-0})"
PRE_CACHE_SNAPS: core ubuntu-core test-snapd-tools
backends:
linode:
key: "$(HOST: echo $SPREAD_LINODE_KEY)"
halt-timeout: 2h
environment:
# Using proxy can help to accelerate testing in local conditions
# but it is unlikely anyone has a proxy that is addressable from
# Linode network. As such, don't honor host's SPREAD_HTTP_PROXY
# that was set globally above.
HTTP_PROXY: null
HTTPS_PROXY: null
systems:
- ubuntu-14.04-64:
kernel: GRUB 2
workers: 4
- ubuntu-16.04-64:
kernel: GRUB 2
workers: 4
- ubuntu-16.04-32:
kernel: GRUB 2
workers: 4
- ubuntu-core-16-64:
kernel: Direct Disk
image: ubuntu-16.04-64
workers: 4
- debian-sid-64:
kernel: GRUB 2
workers: 4
manual: true
- debian-9-64:
kernel: GRUB 2
workers: 4
- fedora-25-64:
workers: 3
manual: true
- fedora-26-64:
workers: 3
- opensuse-42.2-64:
workers: 3
manual: true
qemu:
systems:
- ubuntu-14.04-32:
username: ubuntu
password: ubuntu
- ubuntu-14.04-64:
username: ubuntu
password: ubuntu
- ubuntu-16.04-32:
username: ubuntu
password: ubuntu
- ubuntu-16.04-64:
username: ubuntu
password: ubuntu
- ubuntu-core-16-64:
image: ubuntu-16.04-64
username: ubuntu
password: ubuntu
- ubuntu-16.10-64:
username: ubuntu
password: ubuntu
- ubuntu-17.04-64:
username: ubuntu
password: ubuntu
- ubuntu-17.10-64:
username: ubuntu
password: ubuntu
- ubuntu-18.04-64:
username: ubuntu
password: ubuntu
- debian-sid-64:
username: debian
password: debian
- debian-9-64:
username: debian
password: debian
- debian-sid-64:
username: debian
password: debian
- fedora-25-64:
username: fedora
password: fedora
- fedora-26-64:
username: fedora
password: fedora
autopkgtest:
type: adhoc
allocate: |
echo "Allocating ad-hoc $SPREAD_SYSTEM"
if [ -z "${ADT_ARTIFACTS}" ]; then
FATAL "adhoc only works inside autopkgtest"
exit 1
fi
echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/99-spread-users
ADDRESS localhost:22
discard: |
echo "Discarding ad-hoc $SPREAD_SYSTEM"
systems:
# Trusty
- ubuntu-14.04-amd64:
username: ubuntu
password: ubuntu
- ubuntu-14.04-i386:
username: ubuntu
password: ubuntu
# Xenial
- ubuntu-16.04-amd64:
username: ubuntu
password: ubuntu
- ubuntu-16.04-i386:
username: ubuntu
password: ubuntu
- ubuntu-16.04-ppc64el:
username: ubuntu
password: ubuntu
- ubuntu-16.04-armhf:
username: ubuntu
password: ubuntu
- ubuntu-16.04-s390x:
username: ubuntu
password: ubuntu
# Yakkety
- ubuntu-16.10-amd64:
username: ubuntu
password: ubuntu
- ubuntu-16.10-i386:
username: ubuntu
password: ubuntu
- ubuntu-16.10-ppc64el:
username: ubuntu
password: ubuntu
- ubuntu-16.10-armhf:
username: ubuntu
password: ubuntu
- ubuntu-16.10-s390x:
username: ubuntu
password: ubuntu
# Zesty
- ubuntu-17.04-amd64:
username: ubuntu
password: ubuntu
- ubuntu-17.04-i386:
username: ubuntu
password: ubuntu
- ubuntu-17.04-ppc64el:
username: ubuntu
password: ubuntu
- ubuntu-17.04-armhf:
username: ubuntu
password: ubuntu
- ubuntu-17.04-s390x:
username: ubuntu
password: ubuntu
# Artful
- ubuntu-17.10-amd64:
username: ubuntu
password: ubuntu
- ubuntu-17.10-i386:
username: ubuntu
password: ubuntu
- ubuntu-17.10-ppc64el:
username: ubuntu
password: ubuntu
- ubuntu-17.10-armhf:
username: ubuntu
password: ubuntu
- ubuntu-17.10-s390x:
username: ubuntu
password: ubuntu
# Bionic
- ubuntu-18.04-amd64:
username: ubuntu
password: ubuntu
- ubuntu-18.04-i386:
username: ubuntu
password: ubuntu
- ubuntu-18.04-ppc64el:
username: ubuntu
password: ubuntu
- ubuntu-18.04-armhf:
username: ubuntu
password: ubuntu
- ubuntu-18.04-s390x:
username: ubuntu
password: ubuntu
external:
type: adhoc
environment:
SPREAD_EXTERNAL_ADDRESS: "$(HOST: echo ${SPREAD_EXTERNAL_ADDRESS:-localhost:8022})"
MANAGED_DEVICE: "true"
TRUST_TEST_KEYS: "false"
allocate: |
ADDRESS $SPREAD_EXTERNAL_ADDRESS
systems:
- ubuntu-core-16-64:
username: test
password: ubuntu
- ubuntu-core-16-32:
username: test
password: ubuntu
- ubuntu-core-16-arm-64:
username: test
password: ubuntu
- ubuntu-core-16-arm-32:
username: test
password: ubuntu
linode-sru:
type: linode
key: "$(HOST: echo $SPREAD_LINODE_KEY)"
halt-timeout: 2h
systems:
- ubuntu-14.04-64:
kernel: GRUB 2
workers: 2
- ubuntu-16.04-64:
kernel: GRUB 2
workers: 2
- ubuntu-16.10-64:
kernel: GRUB 2
workers: 2
- ubuntu-17.04-64:
kernel: GRUB 2
workers: 2
- ubuntu-17.10-64:
kernel: GRUB 2
workers: 2
path: /home/gopath/src/github.com/snapcore/snapd
exclude:
- .git
- cmd/snap/snap
- cmd/snapd/snapd
- cmd/snapctl/snapctl
- cmd/snap-exec/snap-exec
- "*.o"
- "*.a"
debug-each: |
if [ "$SPREAD_DEBUG_EACH" = 1 ]; then
echo '# journal messages for snapd'
journalctl -u snapd
echo '# apparmor denials '
dmesg --ctime | grep DENIED || true
echo '# seccomp denials (kills) '
dmesg --ctime | grep type=1326 || true
echo '# snap interfaces'
snap interfaces || true
fi
rename:
# Move content into a directory, so that deltas computed by repack benefit
# from the content looking similar to codeload.github.com.
- s,^,$DELTA_PREFIX,S
repack: |
# For Linode, compute a delta based on a known git reference that can be
# obtained directly from GitHub. There's nothing special about that reference,
# other than it will often be in the local repository's history already.
# The more recent the reference, the smaller the delta.
if ! echo $SPREAD_BACKENDS | grep linode; then
cat <&3 >&4
elif ! git show-ref $DELTA_REF > /dev/null; then
cat <&3 >&4
else
trap "rm -f delta-ref.tar current.delta" EXIT
git archive -o delta-ref.tar --format=tar --prefix=$DELTA_PREFIX $DELTA_REF
xdelta3 -s delta-ref.tar <&3 > current.delta
tar c current.delta >&4
fi
kill-timeout: 20m
prepare: |
# NOTE: This part of the code needs to be in spread.yaml as it runs before
# the rest of the source code (including the tests/lib directory) is
# around. The purpose of this code is to fix some connectivity issues and
# then apply the delta of the git repository.
# apt update is hanging on security.ubuntu.com with IPv6, prefer IPv4 over IPv6
cat <<EOF > gai.conf
precedence ::1/128 50
precedence ::/0 40
precedence 2002::/16 30
precedence ::/96 20
precedence ::ffff:0:0/96 100
EOF
if ! mv gai.conf /etc/gai.conf; then
echo "/etc/gai.conf is not writable, ubuntu-core system? apt update won't be affected in that case"
rm -f gai.conf
fi
# Unpack delta, or move content out of the prefixed directory (see rename and repack above).
# (needs to be in spread.yaml directly because there's nothing else on the filesystem yet)
if [ -f current.delta ]; then
tf=$(mktemp)
# NOTE: We can't use tests/lib/pkgdb.sh here as it doesn't exist at
# this time when none of the test files is yet in place.
case "$SPREAD_SYSTEM" in
ubuntu-*|debian-*)
apt-get update >& "$tf" || ( cat "$tf"; exit 1 )
apt-get install -y xdelta3 curl >& "$tf" || ( cat "$tf"; exit 1 )
;;
fedora-*)
dnf install --refresh -y xdelta curl &> "$tf" || (cat "$tf"; exit 1)
;;
opensuse-*)
zypper -q install -y xdelta3 curl &> "$tf" || (cat "$tf"; exit 1)
;;
esac
rm -f "$tf"
curl -sS -o - "https://codeload.github.com/snapcore/snapd/tar.gz/$DELTA_REF" | gunzip > delta-ref.tar
xdelta3 -q -d -s delta-ref.tar current.delta | tar x --strip-components=1
rm -f delta-ref.tar current.delta
elif [ -d "$DELTA_PREFIX" ]; then
find "$DELTA_PREFIX" -mindepth 1 -maxdepth 1 -exec mv {} . \;
rmdir "$DELTA_PREFIX"
fi
# NOTE: At this stage the source tree is available and no more special
# considerations apply.
"$TESTSLIB"/prepare-restore.sh --prepare-project
prepare-each: |
"$TESTSLIB"/prepare-restore.sh --prepare-project-each
restore: |
"$TESTSLIB"/prepare-restore.sh --restore-project
restore-each: |
"$TESTSLIB"/prepare-restore.sh --restore-project-each
suites:
tests/main/:
summary: Full-system tests for snapd
prepare: |
. $TESTSLIB/prepare.sh
if [[ "$SPREAD_SYSTEM" == ubuntu-core-16-* ]]; then
prepare_all_snap
else
prepare_classic
fi
prepare-each: |
$TESTSLIB/reset.sh --reuse-core
. $TESTSLIB/prepare.sh
if [[ "$SPREAD_SYSTEM" != ubuntu-core-16-* ]]; then
prepare_each_classic
fi
restore: |
$TESTSLIB/reset.sh --store
if [[ "$SPREAD_SYSTEM" != ubuntu-core-16-* ]]; then
. $TESTSLIB/pkgdb.sh
distro_purge_package snapd
if [[ "$SPREAD_SYSTEM" != opensuse-* ]]; then
# A snap-confine package never existed on openSUSE
distro_purge_package snap-confine
fi
fi
tests/completion/:
summary: completion tests
# ppc64el disabled because of https://bugs.launchpad.net/snappy/+bug/1655594
systems: [-ubuntu-core-*, -ubuntu-*-ppc64el]
prepare: |
. $TESTSLIB/prepare.sh
prepare_classic
prepare-each: |
$TESTSLIB/reset.sh --reuse-core
. $TESTSLIB/prepare.sh
prepare_each_classic
restore: |
$TESTSLIB/reset.sh --store
. $TESTSLIB/pkgdb.sh
distro_purge_package snapd
environment:
_/plain: _
_/plain_plusdirs: _
_/funky: _
_/files: _
# dirs fails on indirection because of (mis)handling of trailing
# slashes. This might be configuration-dependent.
# _/dirs: _
_/hosts: _
_/hosts_n_dirs: _
# twisted fails in travis (but not regular spread).
# _/twisted: _
_/func: _
_/funkyfunc: _
tests/regression/:
summary: Regression tests for snapd
prepare: |
. $TESTSLIB/prepare.sh
if [[ "$SPREAD_SYSTEM" == ubuntu-core-16-* ]]; then
prepare_all_snap
else
prepare_classic
fi
prepare-each: |
$TESTSLIB/reset.sh --reuse-core
restore: |
$TESTSLIB/reset.sh
if [[ "$SPREAD_SYSTEM" != ubuntu-core-16-* ]]; then
. $TESTSLIB/pkgdb.sh
distro_purge_package snapd
fi
tests/upgrade/:
summary: Tests for snapd upgrade
# Test cases are not yet ported to openSUSE that is why we keep
# it disabled. A later PR will enable most tests and
# drop this blacklist.
systems: [-ubuntu-core-16-*, -opensuse-*]
restore: |
if [ "$REMOTE_STORE" = staging ]; then
echo "skip upgrade tests while talking to the staging store"
exit 0
fi
restore-each: |
if [ "$REMOTE_STORE" = staging ]; then
echo "skip upgrade tests while talking to the staging store"
exit 0
fi
. $TESTSLIB/pkgdb.sh
distro_purge_package snapd
distro_purge_package snapd-xdg-open || true
tests/unit/:
summary: Suite to run unit tests (non-go and different go runtimes)
# Test cases are not yet ported to Fedora/openSUSE that is why
# we keep them disabled. A later PR will enable most tests and
# drop this blacklist.
systems: [-ubuntu-core-16-*, -fedora-*, -opensuse-*]
environment:
# env vars required for coverage reporting from a spread task
TRAVIS_BUILD_NUMBER: "$(HOST: echo $TRAVIS_BUILD_NUMBER)"
TRAVIS_BRANCH: "$(HOST: echo $TRAVIS_BRANCH)"
TRAVIS_COMMIT: "$(HOST: echo $TRAVIS_COMMIT)"
TRAVIS_JOB_NUMBER: "$(HOST: echo $TRAVIS_JOB_NUMBER)"
TRAVIS_PULL_REQUEST: "$(HOST: echo $TRAVIS_PULL_REQUEST)"
TRAVIS_JOB_ID: "$(HOST: echo $TRAVIS_JOB_ID)"
TRAVIS_REPO_SLUG: "$(HOST: echo $TRAVIS_REPO_SLUG)"
TRAVIS_TAG: "$(HOST: echo $TRAVIS_TAG)"
COVERMODE: "$(HOST: echo $COVERMODE)"
prepare: |
. $TESTSLIB/prepare.sh
prepare_classic
prepare-each: |
$TESTSLIB/reset.sh --reuse-core
. $TESTSLIB/prepare.sh
prepare_each_classic
restore: |
$TESTSLIB/reset.sh --store
. $TESTSLIB/pkgdb.sh
distro_purge_package snapd snap-confine ubuntu-core-launcher
tests/nightly/:
summary: Suite for nightly, expensive, tests
manual: true
# Test cases are not yet ported to Fedora/openSUSE that is why
# we keep them disabled. A later PR will enable most tests and
# drop this blacklist.
systems: [-fedora-*, -opensuse-*]
prepare: |
. $TESTSLIB/prepare.sh
if [[ "$SPREAD_SYSTEM" == ubuntu-core-16-* ]]; then
prepare_all_snap
else
prepare_classic
fi
prepare-each: |
$TESTSLIB/reset.sh --reuse-core
restore: |
$TESTSLIB/reset.sh
if [[ "$SPREAD_SYSTEM" != ubuntu-core-16-* ]]; then
. $TESTSLIB/pkgdb.sh
distro_purge_package snapd
fi
tests/nested/:
summary: Tests for nested images
# Test cases are not yet ported to Fedora/openSUSE that is why
# we keep them disabled. A later PR will enable most tests and
# drop this blacklist.
systems: [-fedora-*, -opensuse-*]
environment:
NESTED_ARCH: "$(HOST: echo ${SPREAD_NESTED_ARCH:-amd64})"
CORE_REFRESH_CHANNEL: "$(HOST: echo ${SPREAD_CORE_REFRESH_CHANNEL:-candidate})"
halt-timeout: 2h
kill-timeout: 2h
manual: true
prepare: |
. $TESTSLIB/pkgdb.sh
distro_update_package_db
distro_install_package snapd qemu genisoimage sshpass
snap install --classic --beta ubuntu-image
restore: |
. $TESTSLIB/pkgdb.sh
distro_purge_package qemu genisoimage sshpass
snap remove ubuntu-image
# vim:ts=4:sw=4:et