diff --git a/do_sos_avocado.sh b/do_sos_avocado.sh index 67ade92..dec7684 100755 --- a/do_sos_avocado.sh +++ b/do_sos_avocado.sh @@ -1,23 +1,17 @@ #!/bin/bash -set -ax +#set -ax latest_dev_series="noble" latest_sup_series="mantic" -#all_series="bionic focal jammy ${latest_sup_series} ${latest_dev_series}" -all_series="jammy ${latest_sup_series} ${latest_dev_series}" - +all_series="bionic focal jammy ${latest_sup_series} ${latest_dev_series}" project_name="sos-testing" project="--project ${project_name}" lxc="lxc ${project}" -inst_name=sos-avocado01 - -sos_location="$HOME/gitRepos/sos" - lxc_exec="${lxc} exec" -${lxc} delete ${inst_name} --force +sos_location="$HOME/gitRepos/sos" lxc project create ${project_name} @@ -26,7 +20,9 @@ ${lxc} profile edit default < lxd_profile.yaml for distro in ${all_series} do - ${lxc} delete ${inst_name}-${distro} --force + inst_name=sos-avocado01-${distro} + + ${lxc} delete ${inst_name} --force if [[ "${distro}" == "${latest_dev_series}" ]] ; then image="ubuntu-daily:devel" @@ -34,22 +30,40 @@ do image="ubuntu:${distro}" fi - ${lxc} launch ${image} ${inst_name}-${distro} + ${lxc} launch ${image} ${inst_name} --vm -c limits.cpu=4 -c limits.memory=4GiB - cd $sos_location + cd ${sos_location} + find . -type f -name "*.pyc" -exec sudo rm -f {} \; + rm -rf .tox *.snap *.deb tar cfz /tmp/sos.tgz . cd - - ${lxc} file push /tmp/sos.tgz ${inst_name}-${distro}/root/sos.tgz + echo -n "Checking VM status of ${inst_name} " while true ; do - status=$(${lxc_exec} ${inst_name}-${distro} -- cloud-init status | grep status | awk '{print $2}') + num_of_procs=$(${lxc} info ${inst_name} | yq .Resources.Processes) + [[ ${num_of_procs} -gt 0 ]] && break + sleep 3 + echo -n "." + done + + echo done + + ${lxc} file push /tmp/sos.tgz ${inst_name}/root/sos.tgz + + echo -n "Checking cloud-init status of ${inst_name} " + + while true ; do + status=$(${lxc_exec} ${inst_name} -- cloud-init status | grep status | awk '{print $2}') [[ "${status}" == "done" ]] && break [[ "${status}" == "error" ]] && break sleep 3 + echo -n "." done - ${lxc_exec} ${inst_name}-${distro} -- bash /root/run_avocado.sh - ${lxc} stop ${inst_name}-${distro} + echo done + + ${lxc_exec} ${inst_name} -- bash /root/run_avocado.sh + ${lxc} stop ${inst_name} done diff --git a/lxd_profile.yaml b/lxd_profile.yaml index cd9e13a..6823873 100644 --- a/lxd_profile.yaml +++ b/lxd_profile.yaml @@ -13,25 +13,15 @@ config: packages: - python3-pip - snapd + - tox 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="" - - case "${codename}" in - "mantic"|"noble") - pip_extra="--break-system-packages" - ;; - esac - - pip3 install avocado-framework==94.0 ${pip_extra} + sudo apt -y purge sosreport - path: /root/run_avocado.sh permissions: '0755' owner: root:root @@ -42,14 +32,22 @@ config: cd /root/sos tar xfz ../sos.tgz + git config --global --add safe.directory /root/sos + mkdir -p /etc/sos cp sos.conf /etc/sos/sos.conf + echo "Cleaning up any old .tox environments ..." + rm -rf .tox + echo "Running Unit Tests ..." - PYTHONPATH=. avocado run tests/unittests/ + tox -e unit_tests echo "Running Stage One Tests ..." - PYTHONPATH=tests/ avocado run -p TESTLOCAL=true --test-runner=runner -t stageone tests/{cleaner,collect,report,vendor}_tests + tox -e stageone_tests + + echo "Running Stage Two Tests ..." + tox -e stagetwo_tests runcmd: - [ /root/setup.sh ] diff --git a/sos_collect_testing.sh b/sos_collect_testing.sh index e53bebb..9a22ee6 100755 --- a/sos_collect_testing.sh +++ b/sos_collect_testing.sh @@ -1,6 +1,6 @@ #!/bin/bash -series="lunar" +series="jammy" model="${series}-sos" cat > juju-model-sos.yaml << EOF @@ -11,10 +11,12 @@ cloudinit-userdata: | sources: proposed: source: deb \$MIRROR \$RELEASE-proposed restricted main multiverse universe + ppa: + source: ppa:arif-ali/sosreport-dev packages: - sosreport - postruncmd: - - [ 'apt', 'install', '-y', 'sosreport/*-proposed' ] + #postruncmd: + # - [ 'apt', 'install', '-y', 'sosreport/*-proposed' ] EOF