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