github.com/anonymouse64/snapd@v0.0.0-20210824153203-04c4c42d842d/packaging/ubuntu-16.04/tests/integrationtests (about) 1 #!/bin/sh 2 3 set -ex 4 5 # required for the debian adt host 6 mkdir -p /etc/systemd/system/snapd.service.d/ 7 if [ "${http_proxy:-}" != "" ]; then 8 cat <<EOF | tee /etc/systemd/system/snapd.service.d/proxy.conf 9 [Service] 10 Environment=http_proxy=$http_proxy 11 Environment=https_proxy=$http_proxy 12 EOF 13 14 # ensure environment is updated 15 echo "http_proxy=$http_proxy" >> /etc/environment 16 echo "https_proxy=$http_proxy" >> /etc/environment 17 fi 18 systemctl daemon-reload 19 20 # ensure we are not get killed too easily 21 printf '%s\n' "-950" > /proc/$$/oom_score_adj 22 23 # see what mem we have (for debugging) 24 cat /proc/meminfo 25 26 # ensure we can do a connect to localhost 27 echo ubuntu:ubuntu|chpasswd 28 sed -i 's/\(PermitRootLogin\|PasswordAuthentication\)\>.*/\1 yes/' /etc/ssh/sshd_config 29 systemctl reload sshd.service 30 31 # Map snapd deb package pockets to core snap channels. This is intended to cope 32 # with the autopkgtest execution when testing packages from the different pockets 33 if apt -qq list snapd | grep -q -- -proposed; then 34 export SPREAD_CORE_CHANNEL=candidate 35 elif apt -qq list snapd | grep -q -- -updates; then 36 export SPREAD_CORE_CHANNEL=stable 37 fi 38 # ensure we always run from the deb that is currently tested 39 export SNAP_REEXEC=0 40 mkdir -p /etc/systemd/system/snapd.service.d 41 cat <<EOF > /etc/systemd/system/snapd.service.d/no-reexec.conf 42 [Service] 43 Environment=SNAP_REEXEC=$SNAP_REEXEC 44 EOF 45 systemctl daemon-reload 46 systemctl restart snapd 47 48 # Spread will only buid with recent go 49 snap install --classic go 50 51 # and now run spread against localhost 52 export GOPATH=/tmp/go 53 /snap/bin/go get -u github.com/snapcore/spread/cmd/spread 54 55 # the tests need this: 56 groupadd --gid 12345 test 57 adduser --uid 12345 --gid 12345 --disabled-password --gecos '' test 58 59 # we build our own minimal spread.yaml 60 cat > spread.yaml <<'EOF' 61 project: snapd 62 path: /home/gopath/src/github.com/snapcore/snapd 63 environment: 64 PROJECT_PATH: /home/gopath/src/github.com/snapcore/snapd 65 TESTSLIB: $PROJECT_PATH/tests/lib 66 TESTSTOOLS: $PROJECT_PATH/tests/lib/tools 67 SNAPPY_TESTING: 1 68 PATH: $PATH:$PROJECT_PATH/tests/bin 69 backends: 70 autopkgtest: 71 type: adhoc 72 allocate: ADDRESS localhost:22 73 systems: 74 - adt-local: 75 username: ubuntu 76 password: ubuntu 77 suites: 78 tests/smoke/: 79 summary: Essenial system level tests for snapd 80 EOF 81 /tmp/go/bin/spread -v autopkgtest:adt-local:tests/smoke/ 82 83 # store journal info for inspectsion 84 journalctl --sync 85 journalctl -ab > "$ADT_ARTIFACTS"/journal.txt