Skip to content

Commit

Permalink
tests: add more charms to large spread tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lengau committed Aug 16, 2023
1 parent 5d9bf14 commit 255f307
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 76 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/spread-large.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
65 changes: 28 additions & 37 deletions spread.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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")'
Expand All @@ -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
Expand Down
76 changes: 41 additions & 35 deletions tests/spread/charms/bundle/task.yaml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 10 additions & 2 deletions tests/spread/charms/k8s-operator/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 20 additions & 1 deletion tests/spread/charms/operator/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -16,7 +35,7 @@ restore: |
pushd charm
charmcraft clean
popd
rm -rf charm
execute: |
Expand Down

0 comments on commit 255f307

Please sign in to comment.