Combine 2 sctipts, add GCE image listing, add README
This commit is contained in:
parent
343f25cea8
commit
0f7da9394a
21
README.md
Normal file
21
README.md
Normal file
@ -0,0 +1,21 @@
|
||||
Some scripts to help with some simple auto testing
|
||||
|
||||
# `do_sos_avocado.sh`
|
||||
|
||||
Runs avocado tests on the latest commits in your folder on all the supported
|
||||
distros
|
||||
|
||||
# `do_sos_testing.sh`
|
||||
|
||||
Runs a quick sos report on all distros from a PPA or a snap channel
|
||||
|
||||
# `sos_collect_testing.sh`
|
||||
|
||||
* Creates a new juju model
|
||||
* Launches N number of ubuntu units
|
||||
* Runs sos collect to test the functionality
|
||||
|
||||
# `get_image_names.sh`
|
||||
|
||||
Grabs image names for Cirrus CI testing purspoes, this ensures we can get
|
||||
these quickly, rather than trawling on GCE UI
|
@ -2,9 +2,18 @@
|
||||
|
||||
#set -ax
|
||||
|
||||
latest_dev_series="noble"
|
||||
latest_sup_series="mantic"
|
||||
all_series="bionic focal jammy ${latest_sup_series} ${latest_dev_series}"
|
||||
script_cmd=${0##*/}
|
||||
|
||||
latest_dev_series=""
|
||||
latest_sup_series="noble"
|
||||
non_lts_releases="mantic"
|
||||
all_series="bionic focal jammy noble ${non_lts_releases} ${latest_dev_series}"
|
||||
|
||||
sos_type="deb"
|
||||
sos_channel="latest/candidate"
|
||||
|
||||
ppa_user="arif-ali"
|
||||
ppa_name="sosreport-dev"
|
||||
|
||||
project_name="sos-testing"
|
||||
project="--project ${project_name}"
|
||||
@ -32,11 +41,14 @@ do
|
||||
|
||||
${lxc} launch ${image} ${inst_name} --vm -c limits.cpu=4 -c limits.memory=4GiB
|
||||
|
||||
cd ${sos_location}
|
||||
find . -type f -name "*.pyc" -exec sudo rm -f {} \;
|
||||
rm -rf .tox *.snap *.deb
|
||||
tar cfz /tmp/sos.tgz .
|
||||
cd -
|
||||
|
||||
if [[ "${script_cmd}" == "do_sos_avocado.sh" ]] ; then
|
||||
cd ${sos_location}
|
||||
find . -type f -name "*.pyc" -exec sudo rm -f {} \;
|
||||
rm -rf .tox *.snap *.deb
|
||||
tar cfz /tmp/sos.tgz .
|
||||
cd -
|
||||
fi
|
||||
|
||||
echo -n "Checking VM status of ${inst_name} "
|
||||
|
||||
@ -49,7 +61,9 @@ do
|
||||
|
||||
echo done
|
||||
|
||||
${lxc} file push /tmp/sos.tgz ${inst_name}/root/sos.tgz
|
||||
if [[ "${script_cmd}" == "do_sos_avocado.sh" ]] ; then
|
||||
${lxc} file push /tmp/sos.tgz ${inst_name}/root/sos.tgz
|
||||
fi
|
||||
|
||||
echo -n "Checking cloud-init status of ${inst_name} "
|
||||
|
||||
@ -63,7 +77,32 @@ do
|
||||
|
||||
echo done
|
||||
|
||||
${lxc_exec} ${inst_name} -- bash /root/run_avocado.sh
|
||||
if [[ "${script_cmd}" == "do_sos_testing.sh" ]] ; then
|
||||
${lxc_exec} ${inst_name} -- sudo add-apt-repository -y ppa:${ppa_user}/${ppa_name}
|
||||
if [[ "${distro}" == "${latest_dev_series}" ]] ; then
|
||||
filename="$(echo ${ppa_name} | sed 's/\./_/g')"
|
||||
${lxc_exec} ${inst_name} -- 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
|
||||
cat > setup_sos.sh << EOF
|
||||
#!/bin/bash
|
||||
|
||||
sos_type="${sos_type}"
|
||||
|
||||
if [[ "\${sos_type}" == "deb" ]] ; then
|
||||
apt -y install sosreport
|
||||
elif [[ "\${sos_type}" == "snap" ]] ; then
|
||||
snap install sosreport --channel ${sos_channel} --classic
|
||||
fi
|
||||
EOF
|
||||
${lxc} file push setup_sos.sh ${inst_name}/root/setup_sos.sh
|
||||
fi
|
||||
|
||||
if [[ "${script_cmd}" == "do_sos_avocado.sh" ]] ; then
|
||||
${lxc_exec} ${inst_name} -- bash /root/run_avocado.sh
|
||||
elif [[ "${script_cmd}" == "do_sos_testing.sh" ]] ; then
|
||||
${lxc_exec} ${inst_name} -- bash /root/setup_sos.sh
|
||||
${lxc_exec} ${inst_name} -- bash /root/run_sos.sh
|
||||
fi
|
||||
${lxc} stop ${inst_name}
|
||||
|
||||
done
|
||||
|
@ -1,65 +0,0 @@
|
||||
#!/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
|
1
do_sos_testing.sh
Symbolic link
1
do_sos_testing.sh
Symbolic link
@ -0,0 +1 @@
|
||||
do_sos_avocado.sh
|
@ -21,7 +21,7 @@ do
|
||||
|
||||
done
|
||||
|
||||
# Fpr testing for the next daily release depdning on LTS or non-LTS
|
||||
# For testing for the next daily release depdning on LTS or non-LTS
|
||||
|
||||
#gcloud compute images list --project ubuntu-os-cloud-devel --filter="family:ubuntu-2410-amd64"
|
||||
#gcloud compute images list --project ubuntu-os-cloud-devel --filter="family:ubuntu-2404-lts-amd64"
|
||||
gcloud compute images list --project ubuntu-os-cloud-devel --filter="family:ubuntu-2410-amd64"
|
||||
gcloud compute images list --project ubuntu-os-cloud-devel --filter="family:ubuntu-2404-lts-amd64"
|
||||
|
@ -48,6 +48,13 @@ config:
|
||||
|
||||
echo "Running Stage Two Tests ..."
|
||||
tox -e stagetwo_tests
|
||||
- path: /root/run_sos.sh
|
||||
permissions: '0755'
|
||||
owner: root:root
|
||||
content: |
|
||||
#!bin/bash
|
||||
|
||||
sos report -a --all-logs --batch
|
||||
|
||||
runcmd:
|
||||
- [ /root/setup.sh ]
|
||||
|
Loading…
Reference in New Issue
Block a user