Update to latest

* Add do_sos_testing.sh, which allows testing from custom PPA
* Update do_sos_avocado.sh, testing some simple avocado on 3 distros
* Update lxd profile for the avocado testing
This commit is contained in:
Arif Ali 2024-02-20 12:39:50 +00:00
parent 4a4a107450
commit e72f698f19
Signed by: arif
GPG Key ID: 369608FBA1353A70
4 changed files with 99 additions and 20 deletions

View File

@ -2,11 +2,16 @@
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}"
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"
@ -18,26 +23,33 @@ lxc project create ${project_name}
${lxc} profile edit default < lxd_profile.yaml
for distro in ${distros}
for distro in ${all_series}
do
${lxc} delete ${inst_name}-${distro} --force
${lxc} launch ubuntu:${distro} ${inst_name}-${distro}
${lxc} delete ${inst_name}-${distro} --force
cd $sos_location
tar cfz /tmp/sos.tgz .
cd -
if [[ "${distro}" == "${latest_dev_series}" ]] ; then
image="ubuntu-daily:devel"
else
image="ubuntu:${distro}"
fi
${lxc} file push /tmp/sos.tgz ${inst_name}-${distro}/root/sos.tgz
${lxc} launch ${image} ${inst_name}-${distro}
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
cd $sos_location
tar cfz /tmp/sos.tgz .
cd -
${lxc_exec} ${inst_name}-${distro} -- bash /root/run_avocado.sh
${lxc} stop ${inst_name}-${distro}
${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

65
do_sos_testing.sh Executable file
View File

@ -0,0 +1,65 @@
#!/bin/bash
latest_dev_series="noble"
latest_sup_series="mantic"
all_series="bionic focal jammy ${latest_sup_series} ${latest_dev_series}"
sos_type="deb"
sos_channel="latest/candidate"
ppa_user="arif-ali"
ppa_name="sosreport-dev"
for series in ${all_series}
do
lxc_host=${series}01-sos
# clean up any previous containers
lxc delete ${lxc_host} --force
if [[ "${series}" == "${latest_dev_series}" ]] ; then
image=ubuntu-daily:devel
else
image=ubuntu:${series}
fi
lxc launch ${image} ${lxc_host} -s virtual
repo="sosreport-dev"
## need to wait for the instance to come up, and have networking
sleep 5
if [[ "${sos_type}" == "deb" ]] ; then
lxc exec ${lxc_host} -- sudo add-apt-repository -y ppa:${ppa_user}/${ppa_name}
if [[ "${series}" == "${latest_dev_series}" ]] ; then
filename="$(echo ${repo} | sed 's/\./_/g')"
lxc exec ${lxc_host} -- sed -i s/i${latest_sup_series}/${latest_dev_series}/g /etc/apt/sources.list.d/${ppa_user}-ubuntu-${filename}-${latest_sup_series}.list
fi
fi
cat > test_sos.sh << EOF
#!/bin/bash
sos_type="${sos_type}"
apt -y update
apt -y --purge --autoremove remove sosreport
if [[ "\${sos_type}" == "deb" ]] ; then
apt -y install sosreport
elif [[ "\${sos_type}" == "snap" ]] ; then
snap install sosreport --channel ${sos_channel} --classic
fi
sos report -a --all-logs --batch
EOF
lxc file push test_sos.sh ${lxc_host}/root/test_sos.sh
lxc exec ${lxc_host} -- sudo bash /root/test_sos.sh
lxc delete ${lxc_host} --force
done

View File

@ -25,7 +25,11 @@ config:
codename=$(grep UBUNTU_CODENAME /etc/os-release | awk -F= '{print $2}')
pip_extra=""
[[ "${codename}" == "mantic" ]] || [[ "${codename}" == "lunar" ]] && pip_extra="--break-system-packages"
case "${codename}" in
"mantic"|"noble")
pip_extra="--break-system-packages"
;;
esac
pip3 install avocado-framework==94.0 ${pip_extra}
- path: /root/run_avocado.sh
@ -41,8 +45,6 @@ config:
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/

View File

@ -14,7 +14,7 @@ cloudinit-userdata: |
packages:
- sosreport
postruncmd:
- [ 'apt', 'install', '-y', 'sosreport/\$RELEASE-proposed' ]
- [ 'apt', 'install', '-y', 'sosreport/*-proposed' ]
EOF