-
Notifications
You must be signed in to change notification settings - Fork 441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests: support running spread suite in autopkgtests #2188
Changes from 1 commit
909bef1
16931e8
6b17e67
826676b
0c0e9ec
b1e4904
5fe72c5
05c1389
7a99733
646aedb
10fc5c7
a44bd18
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/sh | ||
|
||
set -ex | ||
|
||
# required for the debian adt host | ||
mkdir -p /etc/systemd/system/snapd.service.d/ | ||
if [ "${http_proxy:-}" != "" ]; then | ||
cat <<-EOF | tee /etc/systemd/system/snapd.service.d/proxy.conf | ||
[Service] | ||
Environment=http_proxy=$http_proxy | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would this be a harmless unit if $http_proxy is not defined? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It wouldn't be defined at all (see the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. duh, I completely missed that; my suggestion was going to be to gate it just like you did! |
||
Environment=https_proxy=$http_proxy | ||
EOF | ||
|
||
# ensure environment is updated | ||
echo "http_proxy=$http_proxy" >> /etc/environment | ||
echo "https_proxy=$http_proxy" >> /etc/environment | ||
fi | ||
systemctl daemon-reload | ||
|
||
# ensure we are not killed too easily | ||
printf '%s\n' "-950" > /proc/$$/oom_score_adj || true | ||
|
||
# see what mem we have (for debugging) | ||
cat /proc/meminfo | ||
|
||
# ensure we can do a connect to localhost | ||
echo ubuntu:ubuntu | chpasswd | ||
sed -i 's/\(PermitRootLogin\|PasswordAuthentication\)\>.*/\1 yes/' /etc/ssh/sshd_config | ||
systemctl reload sshd.service | ||
|
||
# Spread will only build with recent go | ||
snap install --classic go | ||
|
||
# and now run spread against localhost | ||
# shellcheck disable=SC1091 | ||
. /etc/os-release | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe "source" instead of "."? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
export GOPATH=/tmp/go | ||
/snap/bin/go get -u github.com/snapcore/spread/cmd/spread | ||
|
||
export SNAPCRAFT_PACKAGE_TYPE="deb" | ||
/tmp/go/bin/spread -v "autopkgtest:${ID}-${VERSION_ID}-$(dpkg --print-architecture)" | ||
|
||
# store journal info for inspection | ||
journalctl --sync | ||
journalctl -ab > "$ADT_ARTIFACTS/journal.txt" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,13 @@ environment: | |
# FIXME: This variable is only used by the spread_tests/ suite. | ||
SNAPCRAFT_FROM_SNAP: "1" | ||
|
||
# If this variable is defined, spread will install snapcraft from that | ||
# channel. Otherwise, it'll look for a snap in the source tree. | ||
# This variable can be set to either "deb" or "snap". It defaults to "snap". | ||
SNAPCRAFT_PACKAGE_TYPE: "$(HOST: echo ${SNAPCRAFT_PACKAGE_TYPE:-snap})" | ||
|
||
# If SNAPCRAFT_PACKAGE_TYPE is "snap" and this variable is defined, spread | ||
# will install snapcraft from that channel. Otherwise, it'll look for a snap | ||
# in the source tree. If SNAPCRAFT_PACKAGE_TYPE is "deb" this variable does | ||
# nothing. | ||
SNAPCRAFT_CHANNEL: "$(HOST: echo ${SNAPCRAFT_CHANNEL})" | ||
|
||
SETUP_DIR: /snapcraft/tests/spread/setup | ||
|
@@ -34,6 +39,89 @@ backends: | |
workers: 2 | ||
- ubuntu-18.04-64: | ||
workers: 2 | ||
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: | ||
# No Trusty systems since the deb doesn't exist there | ||
# 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 | ||
# 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 | ||
- ubuntu-18.04-arm64: | ||
username: ubuntu | ||
password: ubuntu | ||
# Cosmic | ||
- ubuntu-18.10-amd64: | ||
username: ubuntu | ||
password: ubuntu | ||
- ubuntu-18.10-i386: | ||
username: ubuntu | ||
password: ubuntu | ||
- ubuntu-18.10-ppc64el: | ||
username: ubuntu | ||
password: ubuntu | ||
- ubuntu-18.10-armhf: | ||
username: ubuntu | ||
password: ubuntu | ||
- ubuntu-18.10-s390x: | ||
username: ubuntu | ||
password: ubuntu | ||
- ubuntu-18.10-arm64: | ||
username: ubuntu | ||
password: ubuntu | ||
|
||
exclude: [snaps-cache/] | ||
|
||
|
@@ -66,18 +154,26 @@ prepare: | | |
|
||
apt install -y snapd | ||
|
||
# If $SNAPCRAFT_CHANNEL is defined, install snapcraft from that channel. | ||
# Otherwise, look for it in /snapcraft/. | ||
if [ -z "$SNAPCRAFT_CHANNEL" ]; then | ||
if stat /snapcraft/*.snap 2>/dev/null; then | ||
snap install --classic --dangerous /snapcraft/*.snap | ||
if [ "$SNAPCRAFT_PACKAGE_TYPE" = "deb" ]; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe not now, but this might be nice to have in helper scripts to be able to use shellcheck? Or did we discuss this already and am I going on in circles? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree 100%, sadly, see this comment for why it has to be this way. |
||
apt install -y snapcraft | ||
elif [ "$SNAPCRAFT_PACKAGE_TYPE" = "snap" ]; then | ||
# If $SNAPCRAFT_CHANNEL is defined, install snapcraft from that channel. | ||
# Otherwise, look for it in /snapcraft/. | ||
if [ -z "$SNAPCRAFT_CHANNEL" ]; then | ||
if stat /snapcraft/*.snap 2>/dev/null; then | ||
snap install --classic --dangerous /snapcraft/*.snap | ||
else | ||
echo "Expected a snap to exist in /snapcraft/. If your intention"\ | ||
"was to install from the store, set \$SNAPCRAFT_CHANNEL." | ||
exit 1 | ||
fi | ||
else | ||
echo "Expected a snap to exist in /snapcraft/. If your intention"\ | ||
"was to install from the store, set \$SNAPCRAFT_CHANNEL." | ||
exit 1 | ||
snap install --classic snapcraft --channel="$SNAPCRAFT_CHANNEL" | ||
fi | ||
else | ||
snap install --classic snapcraft --channel="$SNAPCRAFT_CHANNEL" | ||
echo "'$SNAPCRAFT_PACKAGE_TYPE' is not a supported snapcraft package type."\ | ||
" Supported types are 'deb' and 'snap'." | ||
exit 1 | ||
fi | ||
|
||
restore: $SETUP_DIR/restore.sh | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
autopkgtest instead of adt becuase the name changed in the archive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, there is no
adt-run
now.