commit e51f241e1af13671c54f37344bd430c10f1cb11c Author: Arif Ali Date: Mon Oct 30 19:52:44 2023 +0000 Initial Commit diff --git a/do_sos_avocado.sh b/do_sos_avocado.sh new file mode 100755 index 0000000..110b235 --- /dev/null +++ b/do_sos_avocado.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +set -ax + +project_name="sos-testing" +project="--project ${project_name}" +lxc="lxc ${project}" +inst_name=sos-avocado01 +distros="focal jammy lunar mantic" + +sos_location="$HOME/gitRepos/sos" + +lxc_exec="${lxc} exec" + +${lxc} delete ${inst_name} --force + +lxc project create ${project_name} + +${lxc} profile edit default < lxd_profile.yaml + +for distro in ${distros} +do + +${lxc} delete ${inst_name}-${distro} --force +${lxc} launch ubuntu:${distro} ${inst_name}-${distro} + +cd $sos_location +tar cfz /tmp/sos.tgz . +cd - + +${lxc} file push /tmp/sos.tgz ${inst_name}-${distro}/root/sos.tgz + +while true ; do + status=$(${lxc_exec} ${inst_name}-${distro} -- cloud-init status | grep status | awk '{print $2}') + [[ "${status}" == "done" ]] && break + [[ "${status}" == "error" ]] && break + sleep 3 +done + +${lxc_exec} ${inst_name}-${distro} -- bash /root/run_avocado.sh +${lxc} stop ${inst_name}-${distro} + +done diff --git a/lxd_profile.yaml b/lxd_profile.yaml new file mode 100644 index 0000000..18fb83f --- /dev/null +++ b/lxd_profile.yaml @@ -0,0 +1,53 @@ +devices: + eth0: + name: eth0 + network: lxdbr0 + type: nic + root: + path: / + pool: virtual + type: disk +config: + user.user-data: | + #cloud-config + packages: + - python3-pip + - snapd + write_files: + - path: /root/setup.sh + permissions: '0755' + owner: root:root + content: | + #!bin/bash + sudo apt -y purge sosreport + sudo apt update --allow-releaseinfo-change + + codename=$(grep UBUNTU_CODENAME /etc/os-release | awk -F= '{print $2}') + pip_extra="" + + [[ "${codename}" == "mantic" ]] || [[ "${codename}" == "lunar" ]] && pip_extra="--break-system-packages" + + pip3 install avocado-framework==94.0 ${pip_extra} + - path: /root/run_avocado.sh + permissions: '0755' + owner: root:root + content: | + #!bin/bash + + mkdir -p /root/sos + cd /root/sos + tar xfz ../sos.tgz + + mkdir -p /etc/sos + cp sos.conf /etc/sos/sos.conf + + #pip3 install -r requirements.txt --break-system-packages + + echo "Running Unit Tests ..." + PYTHONPATH=. avocado run tests/unittests/ + + echo "Running Stage One Tests ..." + PYTHONPATH=tests/ avocado run -p TESTLOCAL=true --test-runner=runner -t stageone tests/{cleaner,collect,report,vendor}_tests + + runcmd: + - [ /root/setup.sh ]