github.com/anonymouse64/snapd@v0.0.0-20210824153203-04c4c42d842d/spread.yaml (about)

     1  project: snapd
     2  
     3  environment:
     4      GOHOME: /home/gopath
     5      GOPATH: $GOHOME
     6      # TODO: some distros started shipping Go 1.16 which defaults to having
     7      # modules enabled, drop this when snapd starts supporting Go modules
     8      GO111MODULE: "off"
     9      REUSE_PROJECT: '$(HOST: echo "$REUSE_PROJECT")'
    10      PROJECT_PATH: $GOHOME/src/github.com/snapcore/snapd
    11      # /usr/lib/go-1.6/bin for trusty (needs to be last as we use
    12      # a different go in gccgo tests)
    13      PATH: $GOHOME/bin:/snap/bin:$PATH:/usr/lib/go-1.6/bin:/var/lib/snapd/snap/bin:$PROJECT_PATH/tests/bin
    14      TESTSLIB: $PROJECT_PATH/tests/lib
    15      TESTSTOOLS: $PROJECT_PATH/tests/lib/tools
    16      SNAPPY_TESTING: 1
    17      # we run the entire suite with re-exec on (the default) and modify
    18      # the core snap so that it contains our new code.  So we run new
    19      # snapd from the deb that re-execs into new snapd in core.  To
    20      # test purely from the deb, set "export SPREAD_SNAP_REEXEC=0"
    21      SNAP_REEXEC: '$(HOST: echo "${SPREAD_SNAP_REEXEC:-}")'
    22      MODIFY_CORE_SNAP_FOR_REEXEC: '$(HOST: echo "${SPREAD_MODIFY_CORE_SNAP_FOR_REEXEC:-1}")'
    23      SPREAD_STORE_USER: '$(HOST: echo "$SPREAD_STORE_USER")'
    24      SPREAD_STORE_PASSWORD: '$(HOST: echo "$SPREAD_STORE_PASSWORD")'
    25      SPREAD_STORE_EXPIRED_MACAROON: '$(HOST: echo "$SPREAD_STORE_EXPIRED_MACAROON")'
    26      SPREAD_STORE_EXPIRED_DISCHARGE: '$(HOST: echo "$SPREAD_STORE_EXPIRED_DISCHARGE")'
    27      SPREAD_DEBUG_EACH: '$(HOST: echo "${SPREAD_DEBUG_EACH:-1}")'
    28      LANG: "C.UTF-8"
    29      LANGUAGE: "en"
    30      # important to ensure adhoc and linode/qemu behave the same
    31      SUDO_USER: ""
    32      SUDO_UID: ""
    33      TRUST_TEST_KEYS: '$(HOST: echo "${SPREAD_TRUST_TEST_KEYS:-true}")'
    34      MANAGED_DEVICE: "false"
    35      # a global setting for LXD channel to use in the tests
    36      LXD_SNAP_CHANNEL: "latest/candidate"
    37      CORE_CHANNEL: '$(HOST: echo "${SPREAD_CORE_CHANNEL:-edge}")'
    38      BASE_CHANNEL: '$(HOST: echo "${SPREAD_BASE_CHANNEL:-edge}")'
    39      KERNEL_CHANNEL: '$(HOST: echo "${SPREAD_KERNEL_CHANNEL:-edge}")'
    40      GADGET_CHANNEL: '$(HOST: echo "${SPREAD_GADGET_CHANNEL:-edge}")'
    41      SNAPD_CHANNEL: '$(HOST: echo "${SPREAD_SNAPD_CHANNEL:-edge}")'
    42      REMOTE_STORE: '$(HOST: echo "${SPREAD_REMOTE_STORE:-production}")'
    43      SNAPPY_USE_STAGING_STORE: '$(HOST: if [ "$SPREAD_REMOTE_STORE" = staging ]; then echo 1; else echo 0; fi)'
    44      DELTA_REF: 2.50
    45      DELTA_PREFIX: snapd-$DELTA_REF/
    46      REPACK_KEEP_VENDOR: '$(HOST: echo "${REPACK_KEEP_VENDOR:-n}")'
    47      SNAPD_PUBLISHED_VERSION: '$(HOST: echo "$SPREAD_SNAPD_PUBLISHED_VERSION")'
    48      HTTP_PROXY: '$(HOST: echo "$SPREAD_HTTP_PROXY")'
    49      HTTPS_PROXY: '$(HOST: echo "$SPREAD_HTTPS_PROXY")'
    50      NO_PROXY: "127.0.0.1"
    51      NEW_CORE_CHANNEL: '$(HOST: echo "$SPREAD_NEW_CORE_CHANNEL")'
    52      SRU_VALIDATION: '$(HOST: echo "${SPREAD_SRU_VALIDATION:-0}")'
    53      # use the ppa_validation_name to install snapd from that ppa
    54      PPA_VALIDATION_NAME: '$(HOST: echo "${SPREAD_PPA_VALIDATION_NAME:-}")'
    55      PRE_CACHE_SNAPS: test-snapd-tools test-snapd-sh jq
    56      # always skip removing the rsync snap
    57      SKIP_REMOVE_SNAPS: '$(HOST: echo "${SPREAD_SKIP_REMOVE_SNAPS:-}") test-snapd-rsync test-snapd-rsync-core18 test-snapd-rsync-core20'
    58      # Use the installed snapd and reset the systems without removing snapd
    59      REUSE_SNAPD: '$(HOST: echo "${SPREAD_REUSE_SNAPD:-0}")'
    60  
    61      # Directory where the nested images and test assets are stored
    62      NESTED_WORK_DIR: '$(HOST: echo "${NESTED_WORK_DIR:-/tmp/work-dir}")'
    63      # Channel used to create the nested vm
    64      NESTED_CORE_CHANNEL: '$(HOST: echo "${NESTED_CORE_CHANNEL:-edge}")'
    65      # Use cloud init to make initial system configuration instead of user assertion
    66      NESTED_CORE_REFRESH_CHANNEL: '$(HOST: echo "${NESTED_CORE_REFRESH_CHANNEL:-edge}")'
    67      # Use cloud init to make initial system configuration instead of user assertion
    68      NESTED_USE_CLOUD_INIT: '$(HOST: echo "${NESTED_USE_CLOUD_INIT:-true}")'
    69      # Build and use snapd from current branch
    70      NESTED_BUILD_SNAPD_FROM_CURRENT: '$(HOST: echo "${NESTED_BUILD_SNAPD_FROM_CURRENT:-true}")'
    71      # Download and use an custom image from this url
    72      NESTED_CUSTOM_IMAGE_URL: '$(HOST: echo "${NESTED_CUSTOM_IMAGE_URL:-}")'
    73      # Configure nested images to be reused on the following tests
    74      NESTED_CONFIGURE_IMAGES: '$(HOST: echo "${NESTED_CONFIGURE_IMAGES:-false}")'
    75  
    76  backends:
    77      google:
    78          key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
    79          location: snapd-spread/us-east1-b
    80          halt-timeout: 2h
    81          systems:
    82              - ubuntu-14.04-64:
    83                    workers: 6
    84              - ubuntu-16.04-64:
    85                    workers: 8
    86              - ubuntu-18.04-32:
    87                    workers: 6
    88              - ubuntu-18.04-64:
    89                    workers: 8
    90              - ubuntu-20.04-64:
    91                    workers: 8
    92              - ubuntu-core-16-64:
    93                    image: ubuntu-16.04-64
    94                    workers: 6
    95              - ubuntu-core-18-64:
    96                    image: ubuntu-16.04-64
    97                    workers: 6
    98              - ubuntu-core-20-64:
    99                    image: ubuntu-20.04-64
   100                    workers: 6
   101                    storage: 20G
   102              - ubuntu-secboot-20.04-64:
   103                    image: ubuntu-20.04-64
   104                    workers: 1
   105                    secure-boot: true
   106              - ubuntu-21.04-64:
   107                    workers: 8
   108              - ubuntu-21.10-64:
   109                    image: ubuntu-os-cloud-devel/ubuntu-2110
   110                    storage: 12G
   111                    workers: 8
   112  
   113              - debian-9-64:
   114                    workers: 6
   115                    manual: true
   116              - debian-10-64:
   117                    workers: 6
   118              - debian-sid-64:
   119                    workers: 6
   120  
   121              - fedora-33-64:
   122                    workers: 6
   123              - fedora-34-64:
   124                    workers: 6
   125  
   126              - arch-linux-64:
   127                    workers: 6
   128              - amazon-linux-2-64:
   129                    workers: 6
   130                    storage: preserve-size
   131  
   132              - centos-7-64:
   133                    workers: 6
   134                    storage: preserve-size
   135                    image: centos-7-64
   136              # unstable systems below
   137              - opensuse-15.1-64:
   138                    workers: 6
   139              - opensuse-15.2-64:
   140                    workers: 6
   141              - opensuse-tumbleweed-64:
   142                    workers: 6
   143                    manual: true
   144              - centos-8-64:
   145                    workers: 6
   146                    storage: preserve-size
   147                    image: centos-8-64
   148  
   149      google-sru:
   150          type: google
   151          key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
   152          location: snapd-spread/us-east1-b
   153          halt-timeout: 2h
   154          systems:
   155              - ubuntu-18.04-64:
   156                    workers: 6
   157              - ubuntu-20.04-64:
   158                    workers: 6
   159              - ubuntu-21.04-64:
   160                    workers: 6
   161  
   162      google-nested:
   163          type: google
   164          key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
   165          location: snapd-spread/us-east1-b
   166          plan: n2-standard-2
   167          halt-timeout: 2h
   168          systems:
   169              - ubuntu-16.04-64:
   170                    image: ubuntu-1604-64-virt-enabled
   171                    storage: 20G
   172                    workers: 3
   173              - ubuntu-18.04-64:
   174                    image: ubuntu-1804-64-virt-enabled
   175                    storage: 20G
   176                    workers: 3
   177              - ubuntu-20.04-64:
   178                    image: ubuntu-2004-64-virt-enabled
   179                    storage: 20G
   180                    workers: 7
   181              - ubuntu-21.04-64:
   182                    image: ubuntu-2104-64-virt-enabled
   183                    storage: 20G
   184                    workers: 3
   185  
   186      qemu-nested:
   187          memory: 4G
   188          type: qemu
   189          systems:
   190              - ubuntu-16.04-64:
   191                    username: ubuntu
   192                    password: ubuntu
   193              - ubuntu-18.04-64:
   194                    username: ubuntu
   195                    password: ubuntu
   196              - ubuntu-20.04-64:
   197                    username: ubuntu
   198                    password: ubuntu
   199  
   200      qemu:
   201          systems:
   202              - ubuntu-14.04-32:
   203                    username: ubuntu
   204                    password: ubuntu
   205              - ubuntu-14.04-64:
   206                    username: ubuntu
   207                    password: ubuntu
   208              - ubuntu-16.04-32:
   209                    username: ubuntu
   210                    password: ubuntu
   211              - ubuntu-16.04-64:
   212                    username: ubuntu
   213                    password: ubuntu
   214              - ubuntu-core-16-64:
   215                    image: ubuntu-16.04-64
   216                    username: ubuntu
   217                    password: ubuntu
   218              - ubuntu-core-18-64:
   219                    image: ubuntu-16.04-64
   220                    username: ubuntu
   221                    password: ubuntu
   222              - ubuntu-core-20-64:
   223                    image: ubuntu-20.04-64
   224                    username: ubuntu
   225                    password: ubuntu
   226                    flags: [virtio]
   227              - ubuntu-18.04-64:
   228                    username: ubuntu
   229                    password: ubuntu
   230              - ubuntu-18.04-32:
   231                    username: ubuntu
   232                    password: ubuntu
   233              - ubuntu-20.04-64:
   234                    username: ubuntu
   235                    password: ubuntu
   236              - ubuntu-20.04-32:
   237                    username: ubuntu
   238                    password: ubuntu
   239              - ubuntu-20.10-64:
   240                    username: ubuntu
   241                    password: ubuntu
   242              - ubuntu-21.04-64:
   243                    username: ubuntu
   244                    password: ubuntu
   245              - debian-sid-64:
   246                    username: debian
   247                    password: debian
   248              - debian-9-64:
   249                    username: debian
   250                    password: debian
   251              - debian-sid-64:
   252                    username: debian
   253                    password: debian
   254              - centos-7-64:
   255                    username: centos
   256                    password: centos
   257              - amazon-linux-2-64:
   258                    username: ec2-user
   259                    password: ec2-user
   260              - opensuse-15.2-64:
   261                    username: opensuse
   262                    password: opensuse
   263              - opensuse-tumbleweed-64:
   264                    username: opensuse
   265                    password: opensuse
   266      autopkgtest:
   267          type: adhoc
   268          allocate: |
   269              echo "Allocating ad-hoc $SPREAD_SYSTEM"
   270              if [ -z "${ADT_ARTIFACTS}" ]; then
   271                  FATAL "adhoc only works inside autopkgtest"
   272                  exit 1
   273              fi
   274              echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/99-spread-users
   275              ADDRESS localhost:22
   276          discard: |
   277              echo "Discarding ad-hoc $SPREAD_SYSTEM"
   278          systems:
   279              # Trusty
   280              - ubuntu-14.04-amd64:
   281                    username: ubuntu
   282                    password: ubuntu
   283              - ubuntu-14.04-i386:
   284                    username: ubuntu
   285                    password: ubuntu
   286              # Xenial
   287              - ubuntu-16.04-amd64:
   288                    username: ubuntu
   289                    password: ubuntu
   290              - ubuntu-16.04-i386:
   291                    username: ubuntu
   292                    password: ubuntu
   293              - ubuntu-16.04-ppc64el:
   294                    username: ubuntu
   295                    password: ubuntu
   296              - ubuntu-16.04-armhf:
   297                    username: ubuntu
   298                    password: ubuntu
   299              - ubuntu-16.04-s390x:
   300                    username: ubuntu
   301                    password: ubuntu
   302              # Artful
   303              - ubuntu-17.10-amd64:
   304                    username: ubuntu
   305                    password: ubuntu
   306              - ubuntu-17.10-i386:
   307                    username: ubuntu
   308                    password: ubuntu
   309              - ubuntu-17.10-ppc64el:
   310                    username: ubuntu
   311                    password: ubuntu
   312              - ubuntu-17.10-armhf:
   313                    username: ubuntu
   314                    password: ubuntu
   315              - ubuntu-17.10-s390x:
   316                    username: ubuntu
   317                    password: ubuntu
   318              # Bionic
   319              - ubuntu-18.04-amd64:
   320                    username: ubuntu
   321                    password: ubuntu
   322              - ubuntu-18.04-i386:
   323                    username: ubuntu
   324                    password: ubuntu
   325              - ubuntu-18.04-ppc64el:
   326                    username: ubuntu
   327                    password: ubuntu
   328              - ubuntu-18.04-armhf:
   329                    username: ubuntu
   330                    password: ubuntu
   331              - ubuntu-18.04-s390x:
   332                    username: ubuntu
   333                    password: ubuntu
   334              - ubuntu-18.04-arm64:
   335                    username: ubuntu
   336                    password: ubuntu
   337              # Focal
   338              - ubuntu-20.04-amd64:
   339                    username: ubuntu
   340                    password: ubuntu
   341              - ubuntu-20.04-i386:
   342                    username: ubuntu
   343                    password: ubuntu
   344              - ubuntu-20.04-ppc64el:
   345                    username: ubuntu
   346                    password: ubuntu
   347              - ubuntu-20.04-armhf:
   348                    username: ubuntu
   349                    password: ubuntu
   350              - ubuntu-20.04-s390x:
   351                    username: ubuntu
   352                    password: ubuntu
   353              - ubuntu-20.04-arm64:
   354                    username: ubuntu
   355                    password: ubuntu
   356  
   357      external:
   358          type: adhoc
   359          environment:
   360              SPREAD_EXTERNAL_ADDRESS: '$(HOST: echo "${SPREAD_EXTERNAL_ADDRESS:-localhost:8022}")'
   361              MANAGED_DEVICE: "true"
   362              TRUST_TEST_KEYS: "false"
   363          allocate: |
   364              ADDRESS $SPREAD_EXTERNAL_ADDRESS
   365          systems:
   366              - ubuntu-core-16-64:
   367                    username: external
   368                    password: ubuntu
   369              - ubuntu-core-16-32:
   370                    username: external
   371                    password: ubuntu
   372              - ubuntu-core-16-arm-64:
   373                    username: external
   374                    password: ubuntu
   375              - ubuntu-core-16-arm-32:
   376                    username: external
   377                    password: ubuntu
   378              - ubuntu-core-18-64:
   379                    username: external
   380                    password: ubuntu
   381              - ubuntu-core-18-32:
   382                    username: external
   383                    password: ubuntu
   384              - ubuntu-core-18-arm-64:
   385                    username: external
   386                    password: ubuntu
   387              - ubuntu-core-18-arm-32:
   388                    username: external
   389                    password: ubuntu
   390              - ubuntu-core-20-64:
   391                    username: external
   392                    password: ubuntu
   393              - ubuntu-core-20-32:
   394                    username: external
   395                    password: ubuntu
   396              - ubuntu-core-20-arm-64:
   397                    username: external
   398                    password: ubuntu
   399              - ubuntu-core-20-arm-32:
   400                    username: external
   401                    password: ubuntu
   402  
   403  path: /home/gopath/src/github.com/snapcore/snapd
   404  
   405  exclude:
   406      - .git
   407      - cmd/snap/snap
   408      - cmd/snapd/snapd
   409      - cmd/snapctl/snapctl
   410      - cmd/snap-exec/snap-exec
   411      - cmd/autom4te.cache
   412      - "*.o"
   413      - "*.a"
   414      - ./vendor
   415      - "*.snap"
   416      - "*.img"
   417  
   418  debug-each: |
   419      if [ "$SPREAD_DEBUG_EACH" = 1 ]; then
   420          #shellcheck source=tests/lib/state.sh
   421          . "$TESTSLIB/state.sh"
   422          #shellcheck source=tests/lib/nested.sh
   423          . "$TESTSLIB/nested.sh"
   424  
   425          echo '# System information'
   426          cat /etc/os-release || true
   427  
   428          echo '# Kernel information'
   429          uname -a
   430  
   431          echo '# Go information'
   432          go version || true
   433  
   434          if nested_is_nested_system; then
   435              echo '# nested VM status'
   436              systemctl status nested-vm || true
   437              nested_print_serial_log
   438              # add another echo in case the serial log is missing a newline
   439              echo
   440  
   441              tests.nested exec "sudo journalctl --no-pager -u snapd" || true
   442          fi
   443  
   444          echo '# journal messages for snapd'
   445          "$TESTSTOOLS"/journal-state get-log -u snapd
   446          case "$SPREAD_SYSTEM" in
   447              fedora-*|centos-*|amazon-*)
   448                  if [ -e "$RUNTIME_STATE_PATH/audit-stamp" ]; then
   449                      ausearch -i -m AVC --checkpoint "$RUNTIME_STATE_PATH/audit-stamp" --start checkpoint || true
   450                  else
   451                      ausearch -i -m AVC || true
   452                  fi
   453                  (
   454                      find /root/snap -printf '%Z\t%H/%P\n' || true
   455                      find /home -regex '/home/[^/]*/snap\(/.*\)?' -printf '%Z\t%H/%P\n' || true
   456                  ) | grep -v snappy_home_t || true
   457                  find /var/snap -printf '%Z\t%H/%P\n' | grep -v snappy_var_t || true
   458                  ;;
   459              opensuse-*)
   460                  echo '# apparmor denials logged by auditd'
   461                  ausearch -m AVC | grep DENIED || true
   462                  ;;
   463              *)
   464                  echo '# apparmor denials '
   465                  dmesg --ctime | grep DENIED || true
   466                  ;;
   467          esac
   468          echo '# seccomp denials (kills) '
   469          dmesg --ctime | grep type=1326 || true
   470          echo '# snap connections --all'
   471          snap connections --all || true
   472          echo '# tasks executed on system'
   473          cat "$RUNTIME_STATE_PATH/runs" || true
   474          echo '# free space'
   475          df -h || true
   476          echo '# mounts'
   477          # use ascii output to prevent travis from messing up the encoding
   478          findmnt --ascii -o+PROPAGATION || true
   479          echo "# processes"
   480          ps axl
   481          echo "# /var/lib/snapd"
   482          find /var/lib/snapd/ -not -path '/var/lib/snapd/snap/*' -ls || true
   483      fi
   484  
   485  rename:
   486      # Move content into a directory, so that deltas computed by repack benefit
   487      # from the content looking similar to codeload.github.com.
   488      - s,^,$DELTA_PREFIX,S
   489  
   490  repack: |
   491      # For Linode, compute a delta based on a known git reference that can be
   492      # obtained directly from GitHub. There's nothing special about that reference,
   493      # other than it will often be in the local repository's history already.
   494      # The more recent the reference, the smaller the delta.
   495      if ! echo "$SPREAD_BACKENDS" | grep -e linode -e google; then
   496          cat <&3 >&4
   497      elif ! git show-ref "$DELTA_REF" > /dev/null; then
   498          cat <&3 >&4
   499      else
   500          tmpdir="$(mktemp -d)"
   501          #shellcheck disable=SC2064
   502          trap "rm -rf delta-ref.tar current.delta repacked-current.tar $tmpdir" EXIT
   503          if [ "$REPACK_KEEP_VENDOR" = "n" ]; then
   504              tar -C "$tmpdir" -xvf - <&3
   505              find "$tmpdir/$DELTA_PREFIX/vendor/" ! -wholename "$tmpdir/$DELTA_PREFIX/vendor/" \
   506                  ! -wholename "$tmpdir/$DELTA_PREFIX/vendor/vendor.json" \
   507                  -delete
   508              tar -C "$tmpdir" -c "$DELTA_PREFIX" --sort=name > repacked-current.tar
   509          else
   510              cat <&3 > repacked-current.tar
   511          fi
   512          git archive -o delta-ref.tar --format=tar --prefix="$DELTA_PREFIX" "$DELTA_REF"
   513          xdelta3 -S none -s delta-ref.tar repacked-current.tar > current.delta
   514          tar c current.delta >&4
   515      fi
   516  
   517  kill-timeout: 30m
   518  
   519  prepare: |
   520      # NOTE: This part of the code needs to be in spread.yaml as it runs before
   521      # the rest of the source code (including the tests/lib directory) is
   522      # around. The purpose of this code is to fix some connectivity issues and
   523      # then apply the delta of the git repository.
   524  
   525      # apt update is hanging on security.ubuntu.com with IPv6, prefer IPv4 over IPv6
   526      cat <<EOF > gai.conf
   527      precedence  ::1/128       50
   528      precedence  ::/0          40
   529      precedence  2002::/16     30
   530      precedence ::/96          20
   531      precedence ::ffff:0:0/96 100
   532      EOF
   533      if ! mv gai.conf /etc/gai.conf; then
   534          echo "/etc/gai.conf is not writable, ubuntu-core system? apt update won't be affected in that case"
   535          rm -f gai.conf
   536      fi
   537      if command -v restorecon ; then
   538          # restore proper context otherwise SELinux may complain
   539          restorecon -v /etc/gai.conf
   540      fi
   541  
   542      # Note that os.query or any other tool cannot be used here before the current.delta file is unpacked
   543      if [[ "$SPREAD_SYSTEM" == fedora-* ]]; then
   544          # The Fedora archive mirror seems to be unreliable.
   545          # Switch to the main archive by commenting out metalink and uncommenting
   546          # baseurl with a tweak to go to dl.fedoraproject.org which doens't redirect
   547          # to mirrors again.
   548          #
   549          # https://forum.snapcraft.io/t/issues-with-the-fedora-mirror-network/3489/
   550          sed -i -s -E -e 's@^#?baseurl=http://download.fedoraproject.org/@baseurl=http://dl.fedoraproject.org/@g' -e 's@^metalink=@#metalink@g' /etc/yum.repos.d/fedora*.repo
   551  
   552          dnf --refresh -y makecache
   553  
   554          # enable audit daemon
   555          systemctl enable --now auditd.service
   556      fi
   557  
   558      if [[ "$SPREAD_SYSTEM" == opensuse-* ]]; then
   559          # refresh metadatadata
   560          # Auto import gpg keys needed for could repository added to support google backend
   561          zypper --gpg-auto-import-keys ref
   562          # We seem to be hitting a flaky openSUSE mirror from time to time,
   563          # increase the number of download attempts libzypp will try to
   564          # workaround that.
   565          cat <<-EOF >> /etc/zypp/zypp.conf
   566      # added by spread tests
   567      download.max_silent_tries = 20
   568      EOF
   569  
   570          # Make sure docs are installed with the packages
   571          sed 's/rpm.install.excludedocs = yes/rpm.install.excludedocs = no/g' -i /etc/zypp/zypp.conf
   572      fi
   573  
   574      if [[ "$SPREAD_SYSTEM" == arch-* ]]; then
   575          # Possible that AppArmor was not started and is not enabled in the
   576          # image, do both now
   577          if systemctl show -p LoadState apparmor.service | MATCH 'LoadState=loaded' ; then
   578              if ! systemctl is-enabled apparmor.service; then
   579                  systemctl enable apparmor.service
   580              fi
   581              systemctl start apparmor.service
   582          else
   583              exit 1
   584          fi
   585      fi
   586  
   587      if [[ "$SPREAD_SYSTEM" == debian-* ]]; then
   588          apt-get update && apt-get install -y eatmydata
   589      fi
   590  
   591      if [[ "$SPREAD_SYSTEM" == centos-* ]]; then
   592          # make sure EPEL is enabled
   593          yum install -y epel-release
   594      fi
   595  
   596      case "$SPREAD_SYSTEM" in
   597          ubuntu-*|debian-*)
   598              # make sure unattended-upgrades does not get in the way
   599              if systemctl is-enabled unattended-upgrades.service; then
   600                  systemctl stop unattended-upgrades.service
   601                  systemctl mask unattended-upgrades.service
   602              fi
   603              ;;
   604      esac
   605  
   606      # Unpack delta, or move content out of the prefixed directory (see rename and repack above).
   607      # (needs to be in spread.yaml directly because there's nothing else on the filesystem yet)
   608      if [ -f current.delta ]; then
   609          tf=$(mktemp)
   610          # NOTE: We can't use tests/lib/pkgdb.sh here as it doesn't exist at
   611          # this time when none of the test files is yet in place.
   612          case "$SPREAD_SYSTEM" in
   613              ubuntu-*|debian-*)
   614                  apt-get update >& "$tf" || ( cat "$tf"; exit 1 )
   615                  apt-get install -y xdelta3 curl eatmydata >& "$tf" || ( cat "$tf"; exit 1 )
   616                  ;;
   617              amazon-*|centos-7-*)
   618                  yum install -y xdelta curl &> "$tf" || (cat "$tf"; exit 1)
   619                  ;;
   620              fedora-*|centos-*)
   621                  dnf install --refresh -y xdelta curl &> "$tf" || (cat "$tf"; exit 1)
   622                  ;;
   623              opensuse-*)
   624                  zypper -q --gpg-auto-import-keys refresh
   625                  zypper -q install -y xdelta3 curl &> "$tf" || (cat "$tf"; exit 1)
   626                  ;;
   627              arch-*)
   628                  # there may be a libc upgrade which only -Syu handles;
   629                  # ignore linux kernel as we would fail to detect it and handle
   630                  # reboot; actual distro upgrade is done later in prepare.
   631                  pacman -Syu --noconfirm xdelta3 curl --ignore linux &> "$tf" || (cat "$tf"; exit 1)
   632                  ;;
   633          esac
   634          rm -f "$tf"
   635          curl -sS -o - "https://codeload.github.com/snapcore/snapd/tar.gz/$DELTA_REF" | gunzip > delta-ref.tar
   636          xdelta3 -q -c -d -s delta-ref.tar current.delta | tar x --strip-components=1
   637          rm -f delta-ref.tar current.delta
   638      elif [ -d "$DELTA_PREFIX" ]; then
   639          find "$DELTA_PREFIX" -mindepth 1 -maxdepth 1 -exec mv {} . \;
   640          rmdir "$DELTA_PREFIX"
   641      fi
   642  
   643      # TODO: drop once 21.10 images are fixed
   644      if [[ "$SPREAD_SYSTEM" == ubuntu-21.10-* ]] && [[ -e /home/ubuntu/.ssh ]]; then
   645          chown -R ubuntu:ubuntu /home/ubuntu/.ssh
   646      fi
   647  
   648      # Take the MATCH and REBOOT functions from spread and allow our shell
   649      # scripts to use them as shell commands. The replacements are real
   650      # executables in tests/lib/bin (which is on PATH) but they source
   651      # spread-funcs.sh written here, base on the definitions provided by SPREAD.
   652      # This ensures that 1) spread functions define the code 2) both MATCH and
   653      # REBOOT are executables and not functions, and can be called from any
   654      # context.
   655      type MATCH | tail -n +2 > "$TESTSLIB"/spread-funcs.sh
   656      unset MATCH
   657      type NOMATCH | tail -n +2 >> "$TESTSLIB"/spread-funcs.sh
   658      unset NOMATCH
   659      type REBOOT | tail -n +2 >> "$TESTSLIB"/spread-funcs.sh
   660      unset REBOOT
   661  
   662      # NOTE: At this stage the source tree is available and no more special
   663      # considerations apply.
   664      "$TESTSLIB"/prepare-restore.sh --prepare-project
   665  prepare-each: |
   666      "$TESTSLIB"/prepare-restore.sh --prepare-project-each
   667  restore: |
   668      "$TESTSLIB"/prepare-restore.sh --restore-project
   669  restore-each: |
   670      "$TESTSLIB"/prepare-restore.sh --restore-project-each
   671  suites:
   672      tests/lib/tools/suite/:
   673          summary: Tests for tests/lib/tools tools
   674          prepare-each: |
   675              "$TESTSLIB"/prepare-restore.sh --prepare-suite-each-minimal-no-snaps
   676          restore-each: |
   677              "$TESTSLIB"/prepare-restore.sh --restore-suite-each-minimal-no-snaps
   678      # The essential tests designed to run inside the autopkgtest
   679      # environment on each platform. On autopkgtest we cannot run all tests
   680      # as this is very slow and we run into timeouts.
   681      #
   682      # These tests are executed on all other plattforms as they
   683      # are designed to run on pristine systems
   684      tests/smoke/:
   685          summary: Essential system level tests for snapd
   686          prepare: |
   687              "$TESTSLIB"/prepare-restore.sh --prepare-suite
   688          prepare-each: |
   689              "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
   690          restore-each: |
   691              "$TESTSLIB"/prepare-restore.sh --restore-suite-each
   692          restore: |
   693              "$TESTSLIB"/prepare-restore.sh --restore-suite
   694      # All other tests run now and will heavily modify the system.
   695      tests/main/:
   696          summary: Full-system tests for snapd
   697          systems: [-ubuntu-secboot-*]
   698          prepare: |
   699              "$TESTSLIB"/prepare-restore.sh --prepare-suite
   700          prepare-each: |
   701              "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
   702          restore-each: |
   703              "$TESTSLIB"/prepare-restore.sh --restore-suite-each
   704          restore: |
   705              "$TESTSLIB"/prepare-restore.sh --restore-suite
   706          debug: |
   707              if [ "$SPREAD_DEBUG_EACH" = 1 ]; then
   708                  systemctl status snapd.socket || true
   709                  journalctl -e
   710              fi
   711      tests/core/:
   712          summary: Subset of Ubuntu Core specific tests
   713          systems: [ubuntu-core-*]
   714          prepare: |
   715              "$TESTSLIB"/prepare-restore.sh --prepare-suite
   716          prepare-each: |
   717              "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
   718          restore-each: |
   719              "$TESTSLIB"/prepare-restore.sh --restore-suite-each
   720          restore: |
   721              "$TESTSLIB"/prepare-restore.sh --restore-suite
   722      tests/completion/:
   723          summary: completion tests
   724          # ppc64el disabled because of https://bugs.launchpad.net/snappy/+bug/1655594
   725          systems: [-ubuntu-core-*, -ubuntu-*-ppc64el, -ubuntu-secboot-*]
   726          prepare: |
   727              "$TESTSLIB"/prepare-restore.sh --prepare-suite
   728          prepare-each: |
   729              "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
   730          restore-each: |
   731              "$TESTSLIB"/prepare-restore.sh --restore-suite-each
   732          restore: |
   733              "$TESTSLIB"/prepare-restore.sh --restore-suite
   734          environment:
   735              _/plain: _
   736              _/plain_plusdirs: _
   737              _/funky: _
   738              _/files: _
   739              # dirs fails on indirection because of (mis)handling of trailing
   740              # slashes. This might be configuration-dependent.
   741              # _/dirs: _
   742              _/hosts: _
   743              _/hosts_n_dirs: _
   744              # twisted fails in travis (but not regular spread).
   745              # _/twisted: _
   746              _/func: _
   747              _/funkyfunc: _
   748              _/funcarg: _
   749  
   750      tests/regression/:
   751          summary: Regression tests for snapd
   752          systems: [-ubuntu-secboot-*]
   753          prepare: |
   754              "$TESTSLIB"/prepare-restore.sh --prepare-suite
   755          prepare-each: |
   756              "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
   757          restore-each: |
   758              "$TESTSLIB"/prepare-restore.sh --restore-suite-each
   759          restore: |
   760              "$TESTSLIB"/prepare-restore.sh --restore-suite
   761  
   762      tests/upgrade/:
   763          summary: Tests for snapd upgrade
   764          # Test cases are not yet ported to openSUSE that is why we keep
   765          # it disabled. A later PR will enable most tests and
   766          # drop this blacklist.
   767          systems: [-ubuntu-core-*, -opensuse-*, -ubuntu-secboot-*]
   768          prepare-each: |
   769              # FIXME: this should really use prepare-restore.sh --prepare-suite-each
   770              # like other suites, needs more investigation
   771  
   772              # shellcheck source=tests/lib/state.sh
   773              . "$TESTSLIB"/state.sh
   774              mkdir -p "$RUNTIME_STATE_PATH"
   775              # save the job which is going to be executed in the system
   776              echo -n "$SPREAD_JOB " >> "$RUNTIME_STATE_PATH/runs"
   777          restore: |
   778              if [ "$REMOTE_STORE" = staging ]; then
   779                  echo "skip upgrade tests while talking to the staging store"
   780                  exit 0
   781              fi
   782          restore-each: |
   783              if [ "$REMOTE_STORE" = staging ]; then
   784                  echo "skip upgrade tests while talking to the staging store"
   785                  exit 0
   786              fi
   787              #shellcheck source=tests/lib/pkgdb.sh
   788              . "$TESTSLIB"/pkgdb.sh
   789              distro_purge_package snapd
   790              distro_purge_package snapd-xdg-open || true
   791      tests/cross/:
   792          summary: Cross-compile tests
   793          systems: [ubuntu-16.04-64, ubuntu-18.04-64]
   794  
   795      tests/unit/:
   796          summary: Suite to run unit tests (non-go and different go runtimes)
   797          # Test cases are not yet ported to Fedora/openSUSE/Arch that is why
   798          # we keep them disabled. A later PR will enable most tests and
   799          # drop this blacklist.
   800          systems:
   801              [
   802                  -ubuntu-core-*,
   803                  -fedora-*,
   804                  -opensuse-*,
   805                  -arch-*,
   806                  -amazon-*,
   807                  -centos-*,
   808                  -ubuntu-secboot-*,
   809              ]
   810          # unittests are run as part of the autopkgtest build already
   811          backends: [-autopkgtest]
   812          environment:
   813              # env vars required for coverage reporting from a spread task
   814              TRAVIS_BUILD_NUMBER: '$(HOST: echo "$TRAVIS_BUILD_NUMBER")'
   815              TRAVIS_BRANCH: '$(HOST: echo "$TRAVIS_BRANCH")'
   816              TRAVIS_COMMIT: '$(HOST: echo "$TRAVIS_COMMIT")'
   817              TRAVIS_JOB_NUMBER: '$(HOST: echo "$TRAVIS_JOB_NUMBER")'
   818              TRAVIS_PULL_REQUEST: '$(HOST: echo "$TRAVIS_PULL_REQUEST")'
   819              TRAVIS_JOB_ID: '$(HOST: echo "$TRAVIS_JOB_ID")'
   820              TRAVIS_REPO_SLUG: '$(HOST: echo "$TRAVIS_REPO_SLUG")'
   821              TRAVIS_TAG: '$(HOST: echo "$TRAVIS_TAG")'
   822              COVERMODE: '$(HOST: echo "$COVERMODE")'
   823          prepare: |
   824              #shellcheck source=tests/lib/prepare.sh
   825              . "$TESTSLIB"/prepare.sh
   826              prepare_classic
   827          prepare-each: |
   828              "$TESTSLIB"/reset.sh --reuse-core
   829              #shellcheck source=tests/lib/prepare.sh
   830              . "$TESTSLIB"/prepare.sh
   831              prepare_each_classic
   832          restore: |
   833              "$TESTSLIB"/reset.sh --store
   834              #shellcheck source=tests/lib/pkgdb.sh
   835              . "$TESTSLIB"/pkgdb.sh
   836  
   837              distro_purge_package snapd
   838              case "$SPREAD_SYSTEM" in
   839                  arch-*)
   840                      # there is no snap-confine and ubuntu-core-launcher
   841                      # in Arch
   842                      ;;
   843                  *)
   844                      distro_purge_package snap-confine ubuntu-core-launcher
   845                      ;;
   846              esac
   847  
   848      tests/nightly/:
   849          summary: Suite for nightly, expensive, tests
   850          manual: true
   851          # Test cases are not yet ported to Fedora/openSUSE/Arch/AMZN2 that is why
   852          # we keep them disabled. A later PR will enable most tests and
   853          # drop this blacklist.
   854          prepare: |
   855              "$TESTSLIB"/prepare-restore.sh --prepare-suite
   856          prepare-each: |
   857              "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
   858          restore-each: |
   859              "$TESTSLIB"/prepare-restore.sh --restore-suite-each
   860          restore: |
   861              "$TESTSLIB"/prepare-restore.sh --restore-suite
   862  
   863      tests/nested/manual/:
   864          summary: Tests for nested images controlled manually from the tests
   865          backends: [google-nested, qemu-nested]
   866          systems:
   867              - ubuntu-16.04-64
   868              - ubuntu-18.04-64
   869              - ubuntu-20.04-64
   870              - ubuntu-20.10-64
   871          environment:
   872              NESTED_TYPE: "classic"
   873              # Enable kvm in the qemu command line
   874              NESTED_ENABLE_KVM: '$(HOST: echo "${NESTED_ENABLE_KVM:-true}")'
   875              # Enable tpm in the nested vm in case it is supported
   876              NESTED_ENABLE_TPM: '$(HOST: echo "${NESTED_ENABLE_TPM:-}")'
   877              # Enable secure boot in the nested vm in case it is supported
   878              NESTED_ENABLE_SECURE_BOOT: '$(HOST: echo "${NESTED_ENABLE_SECURE_BOOT:-}")'
   879          manual: true
   880          warn-timeout: 10m
   881          kill-timeout: 60m
   882          prepare: |
   883              #shellcheck source=tests/lib/pkgdb.sh
   884              . "$TESTSLIB"/pkgdb.sh
   885              distro_update_package_db
   886              distro_install_package snapd qemu qemu-utils genisoimage sshpass qemu-kvm cloud-image-utils ovmf kpartx xz-utils
   887              snap install ubuntu-image --classic
   888  
   889              # Install the snapd built
   890              dpkg -i "$SPREAD_PATH"/../snapd_*.deb
   891          prepare-each: |
   892              tests.backup prepare
   893              tests.nested prepare
   894          restore-each: |
   895              tests.nested remove-vm
   896              tests.nested restore
   897              tests.backup restore
   898          restore: |
   899              #shellcheck source=tests/lib/pkgdb.sh
   900              . "$TESTSLIB"/pkgdb.sh
   901              distro_purge_package qemu genisoimage sshpass qemu-kvm cloud-image-utils xz-utils
   902  
   903      tests/nested/classic/:
   904          summary: Tests for nested images
   905          backends: [google-nested, qemu-nested]
   906          systems: [ubuntu-16.04-64, ubuntu-18.04-64, ubuntu-20*]
   907          environment:
   908              NESTED_TYPE: "classic"
   909              # Channel used to create the nested vm
   910              NESTED_ENABLE_KVM: '$(HOST: echo "${NESTED_ENABLE_KVM:-true}")'
   911              # Enable tpm in the nested vm in case it is supported
   912              NESTED_ENABLE_TPM: '$(HOST: echo "${NESTED_ENABLE_TPM:-false}")'
   913              # Enable secure boot in the nested vm in case it is supported
   914              NESTED_ENABLE_SECURE_BOOT: '$(HOST: echo "${NESTED_ENABLE_SECURE_BOOT:-false}")'
   915          manual: true
   916          prepare: |
   917              #shellcheck source=tests/lib/pkgdb.sh
   918              . "$TESTSLIB"/pkgdb.sh
   919              distro_update_package_db
   920              distro_install_package snapd qemu qemu-utils genisoimage sshpass qemu-kvm cloud-image-utils ovmf kpartx xz-utils
   921              snap install ubuntu-image --classic
   922  
   923              # Install the snapd built
   924              dpkg -i "$SPREAD_PATH"/../snapd_*.deb
   925  
   926              tests.nested prepare
   927              tests.nested build-image classic
   928          prepare-each: |
   929              tests.backup prepare
   930              tests.nested create-vm classic
   931          restore-each: |
   932              tests.nested remove-vm
   933              tests.backup restore
   934          restore: |
   935              tests.nested restore
   936  
   937              #shellcheck source=tests/lib/pkgdb.sh
   938              . "$TESTSLIB"/pkgdb.sh
   939              distro_purge_package qemu genisoimage sshpass qemu-kvm cloud-image-utils xz-utils
   940  
   941      tests/nested/core/:
   942          summary: Tests for nested images
   943          backends: [google-nested, qemu-nested]
   944          systems: [ubuntu-16.04-64, ubuntu-18.04-64, ubuntu-20.04-64]
   945          environment:
   946              NESTED_TYPE: "core"
   947              # Enable kvm in the qemu command line
   948              NESTED_ENABLE_KVM: '$(HOST: echo "${NESTED_ENABLE_KVM:-}")'
   949              # Enable tpm in the nested vm in case it is supported
   950              NESTED_ENABLE_TPM: '$(HOST: echo "${NESTED_ENABLE_TPM:-}")'
   951              # Enable secure boot in the nested vm in case it is supported
   952              NESTED_ENABLE_SECURE_BOOT: '$(HOST: echo "${NESTED_ENABLE_SECURE_BOOT:-}")'
   953          manual: true
   954          prepare: |
   955              #shellcheck source=tests/lib/pkgdb.sh
   956              . "$TESTSLIB"/pkgdb.sh
   957              distro_update_package_db
   958              distro_install_package snapd qemu qemu-utils genisoimage sshpass qemu-kvm cloud-image-utils ovmf kpartx xz-utils
   959              snap install ubuntu-image --classic
   960  
   961              # Install the snapd built
   962              dpkg -i "$SPREAD_PATH"/../snapd_*.deb
   963  
   964              tests.nested prepare
   965              tests.nested build-image core
   966          prepare-each: |
   967              tests.backup prepare
   968              tests.nested create-vm core
   969          restore-each: |
   970              tests.nested remove-vm
   971              tests.backup restore
   972          restore: |
   973              tests.nested restore
   974  
   975              #shellcheck source=tests/lib/pkgdb.sh
   976              . "$TESTSLIB"/pkgdb.sh
   977              distro_purge_package qemu genisoimage sshpass qemu-kvm cloud-image-utils xz-utils
   978  
   979  # vim:ts=4:sw=4:et