Initial Commit

This commit is contained in:
Arif Ali 2023-10-30 19:52:44 +00:00
commit e51f241e1a
Signed by: arif
GPG Key ID: 369608FBA1353A70
2 changed files with 96 additions and 0 deletions

43
do_sos_avocado.sh Executable file
View File

@ -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

53
lxd_profile.yaml Normal file
View File

@ -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 ]