From 255f307f8c9d37679f6c557298af78081d4d3f03 Mon Sep 17 00:00:00 2001 From: Alex Lowe Date: Tue, 15 Aug 2023 20:56:12 -0400 Subject: [PATCH] tests: add more charms to large spread tests --- .github/workflows/spread-large.yaml | 2 +- spread.yaml | 65 ++++++++---------- tests/spread/charms/bundle/task.yaml | 76 ++++++++++++---------- tests/spread/charms/k8s-operator/task.yaml | 12 +++- tests/spread/charms/operator/task.yaml | 21 +++++- 5 files changed, 100 insertions(+), 76 deletions(-) diff --git a/.github/workflows/spread-large.yaml b/.github/workflows/spread-large.yaml index d40cc72d5..f135f9739 100644 --- a/.github/workflows/spread-large.yaml +++ b/.github/workflows/spread-large.yaml @@ -29,7 +29,7 @@ jobs: strategy: fail-fast: false matrix: - charm: [k8s-operator, operator, magma] + charm: [k8s-operator, operator, magma, bundle] steps: - name: Cleanup job workspace diff --git a/spread.yaml b/spread.yaml index 50e3c1ef8..3c70c0a68 100644 --- a/spread.yaml +++ b/spread.yaml @@ -6,6 +6,12 @@ environment: SNAPD_TESTING_TOOLS: $PROJECT_PATH/tools/external/tools PATH: /snap/bin:$PATH:$SNAPD_TESTING_TOOLS +exclude: + - .git + - .github + - .tox + - .*_cache + backends: google: key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")' @@ -30,60 +36,45 @@ backends: multipass: type: adhoc allocate: | - if [ "$SPREAD_SYSTEM" = "ubuntu-18.04-64" ]; then - image="18.04" - instance_name="spread-18-04" - elif [ "$SPREAD_SYSTEM" = "ubuntu-20.04-64" ]; then - image="20.04" - instance_name="spread-20-04" - elif [ "$SPREAD_SYSTEM" = "ubuntu-22.04-64" ]; then - image="22.04" - instance_name="spread-22-04" - else - FATAL "$SPREAD_SYSTEM is not supported!" + sleep 0.$RANDOM + if [[ ! -f $HOME/.spread/multipass-count ]]; then + mkdir -p $HOME/.spread + echo 0 > $HOME/.spread/multipass-count fi + instance_num=$(< $HOME/.spread/multipass-count) + echo $(( $instance_num + 1 )) > $HOME/.spread/multipass-count + multipass_image=$(echo ${SPREAD_SYSTEM} | sed -e s/ubuntu-// -e s/-64//) - multipass launch --disk 20G --mem 2G --name "$instance_name" "$image" + system=$(echo "${SPREAD_SYSTEM}" | tr . -) + instance_name="spread-${SPREAD_BACKEND}-${instance_num}-${system}" - # Get the IP from the instance - ip=$(multipass info --format csv "$instance_name" | tail -1 | cut -d\, -f3) - # Enable PasswordAuthertication for root over SSH. + multipass launch --disk 20G --memory 2G --name "${instance_name}" "${multipass_image}" + + # Enable PasswordAuthentication for root over SSH. multipass exec "$instance_name" -- \ - sudo sh -c "echo root:ubuntu | sudo chpasswd" + sudo sh -c "echo root:${SPREAD_PASSWORD} | sudo chpasswd" multipass exec "$instance_name" -- \ sudo sh -c \ "sed -i /etc/ssh/sshd_config -e 's/^PasswordAuthentication.*/PasswordAuthentication yes/' -e 's/^#PermitRootLogin.*/PermitRootLogin yes/'" multipass exec "$instance_name" -- \ sudo systemctl restart ssh - ADDRESS "$ip:22" + multipass exec "$instance_name" -- sudo lxd init --auto + # Get the IP from the instance + ip=$(multipass info --format csv "$instance_name" | tail -1 | cut -d\, -f3) + ADDRESS "$ip" discard: | - if [ "$SPREAD_SYSTEM" = "ubuntu-18.04-64" ]; then - instance_name="spread-18-04" - elif [ "$SPREAD_SYSTEM" = "ubuntu-20.04-64" ]; then - instance_name="spread-20-04" - elif [ "$SPREAD_SYSTEM" = "ubuntu-22.04-64" ]; then - instance_name="spread-22-04" - else - FATAL "$SPREAD_SYSTEM is not supported!" - fi - - multipass delete --purge "$instance_name" + instance_name=$(multipass list --format csv | grep $SPREAD_SYSTEM_ADDRESS | cut -f1 -d\,) + multipass delete --purge "${instance_name}" systems: - ubuntu-18.04-64: - workers: 1 - username: root - password: ubuntu + workers: 2 - ubuntu-20.04-64: - workers: 1 - username: root - password: ubuntu + workers: 2 - ubuntu-22.04-64: - workers: 1 - username: root - password: ubuntu + workers: 4 prepare: | set -e diff --git a/tests/spread/charms/bundle/task.yaml b/tests/spread/charms/bundle/task.yaml index 83bbcf576..f53fca3d2 100644 --- a/tests/spread/charms/bundle/task.yaml +++ b/tests/spread/charms/bundle/task.yaml @@ -1,36 +1,42 @@ summary: Recursively pack a bundle with all charms -#systems: -# - ubuntu-22.04-64 -#kill-timeout: 30m -# -#environment: -# BUNDLE/notebook_operators: https://github.com/canonical/notebook-operators -# -#prepare: | -# git clone --depth=1 "${BUNDLE}" bundle -# -#restore: | -# pushd bundle/charms/jupyter-controller -# charmcraft clean -# popd -# pushd bundle/charms/jupyter-ui -# charmcraft clean -# popd -# -# rm -rf bundle -# -#execute: | -# cd bundle -# charmcraft pack --verbose --include-all-charms --output-bundle=output_bundle.yaml -# -# # Ensure that the output bundle.yaml file is the same as the bundle.yaml file -# # within the bundle itself. -# unzip -p *.zip bundle.yaml | diff -s output_bundle.yaml - -# # Ensure at least one charm file is referenced in the bundle.yaml -# test $(grep "charm: ${PWD}" output_bundle.yaml | wc -l) -ge 1 -# # Ensure all local charms referenced in the bundle exist -# grep "charm: ${PWD}" output_bundle.yaml | cut -d: -f2 | xargs file -E -# -# # Test deploying the bundle. -# # TODO: install juju on the runner and re-enable this. -# # juju deploy --dry-run *.zip +manual: true +systems: + - ubuntu-22.04-64 +kill-timeout: 30m + +environment: + BUNDLE/argo: https://github.com/canonical/argo-operators + # TODO: Enable once cos-lite uses charmcraft's recursive build. + # BUNDLE/cos_lite: https://github.com/canonical/cos-lite-bundle + BUNDLE/cos_proxy: https://github.com/canonical/cos-proxy-operator + BUNDLE/kfp: https://github.com/canonical/kfp-operators + BUNDLE/kubeflow: https://github.com/canonical/bundle-kubeflow + BUNDLE/notebook_operators: https://github.com/canonical/notebook-operators + +prepare: | + git clone --depth=1 "${BUNDLE}" bundle + +restore: | + for directory in $(ls -1 bundle/charms); do + pushd "bundle/charms/${directory}" + charmcraft clean + popd + done + + rm -rf bundle + +execute: | + cd bundle + charmcraft pack --verbose --include-all-charms --output-bundle=output_bundle.yaml + + # Ensure that the output bundle.yaml file is the same as the bundle.yaml file + # within the bundle itself. + unzip -p *.zip bundle.yaml | diff -s output_bundle.yaml - + # Ensure at least one charm file is referenced in the bundle.yaml + test $(grep "charm: ${PWD}" output_bundle.yaml | wc -l) -ge 1 + # Ensure all local charms referenced in the bundle exist + grep "charm: ${PWD}" output_bundle.yaml | cut -d: -f2 | xargs file -E + + # Test deploying the bundle. + # TODO: install juju on the runner and re-enable this. + # juju deploy --dry-run *.zip diff --git a/tests/spread/charms/k8s-operator/task.yaml b/tests/spread/charms/k8s-operator/task.yaml index 1000c846e..8f22a10d4 100644 --- a/tests/spread/charms/k8s-operator/task.yaml +++ b/tests/spread/charms/k8s-operator/task.yaml @@ -6,13 +6,21 @@ kill-timeout: 60m environment: CHARM/alertmanager: https://github.com/canonical/alertmanager-k8s-operator + CHARM/discourse: https://git.launchpad.net/charm-k8s-discourse CHARM/grafana: https://github.com/canonical/grafana-k8s-operator + CHARM/grafana_agent: https://github.com/canonical/grafana-agent-k8s-operator + CHARM/kafka: https://github.com/canonical/kafka-k8s-operator + CHARM/loki: https://github.com/canonical/loki-k8s-operator + CHARM/mattermost: https://git.launchpad.net/charm-k8s-mattermost + CHARM/mongodb: https://github.com/canonical/mongodb-k8s-operator CHARM/mysql: https://github.com/canonical/mysql-k8s-operator + CHARM/pgbouncer: https://github.com/canonical/pgbouncer-k8s-operator CHARM/postgresql: https://github.com/canonical/postgresql-k8s-operator CHARM/prometheus: https://github.com/canonical/prometheus-k8s-operator + CHARM/redis: https://github.com/canonical/redis-k8s-operator CHARM/traefik: https://github.com/canonical/traefik-k8s-operator - CHARM/mattermost: https://git.launchpad.net/charm-k8s-mattermost - CHARM/discourse: https://git.launchpad.net/charm-k8s-discourse + CHARM/wordpress: https://github.com/canonical/wordpress-k8s-operator + CHARM/zookeeper: https://github.com/canonical/zookeeper-k8s-operator prepare: | git clone --depth=1 "${CHARM}" charm diff --git a/tests/spread/charms/operator/task.yaml b/tests/spread/charms/operator/task.yaml index bee680884..e687e883e 100644 --- a/tests/spread/charms/operator/task.yaml +++ b/tests/spread/charms/operator/task.yaml @@ -5,9 +5,28 @@ systems: kill-timeout: 30m environment: + CHARM/dex_auth: https://github.com/canonical/dex-auth-operator + CHARM/github_runner: https://github.com/canonical/github-runner-operator + CHARM/haproxy: https://github.com/canonical/haproxy-operator + CHARM/hardware_observer: https://github.com/canonical/hardware-observer-operator + CHARM/hydra: https://github.com/canonical/hydra-operator + CHARM/identity_platform: https://github.com/canonical/identity-platform-login-ui-operator + CHARM/indico: https://github.com/canonical/indico-operator + CHARM/istio: https://github.com/canonical/istio-operators + CHARM/kafka: https://github.com/canonical/kafka-operator + CHARM/kratos: https://github.com/canonical/kratos-operator + CHARM/minio: https://github.com/canonical/minio-operator + CHARM/mlflow: https://github.com/canonical/mlflow-operator + CHARM/mongodb: https://github.com/canonical/mongodb-operator CHARM/mysql: https://github.com/canonical/mysql-operator + CHARM/nats: https://github.com/canonical/nats-operator + CHARM/opensearch: https://github.com/canonical/opensearch-operator + CHARM/pgbouncer: https://github.com/canonical/pgbouncer-operator CHARM/postgresql: https://github.com/canonical/postgresql-operator + CHARM/saml_integrator: https://github.com/canonical/saml-integrator-operator + CHARM/seldon_core: https://github.com/canonical/seldon-core-operator CHARM/tls_certificates: https://github.com/canonical/tls-certificates-operator + CHARM/zookeeper: https://github.com/canonical/zookeeper-operator prepare: | git clone --depth=1 "${CHARM}" charm @@ -16,7 +35,7 @@ restore: | pushd charm charmcraft clean popd - + rm -rf charm execute: |