mirror of
https://github.com/JasonN3/build-container-installer.git
synced 2025-12-25 10:57:55 +01:00
add tests
This commit is contained in:
parent
a78999eca9
commit
15b436cb1b
4 changed files with 62 additions and 17 deletions
47
.github/workflows/build-and-test.yml
vendored
47
.github/workflows/build-and-test.yml
vendored
|
|
@ -111,10 +111,13 @@ jobs:
|
|||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Ensure qemu is installed
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y qemu qemu-utils xorriso unzip qemu-system-x86 netcat socat jq isomd5sum
|
||||
sudo apt-get install -y qemu qemu-utils xorriso unzip qemu-system-x86 netcat socat jq isomd5sum ansible
|
||||
|
||||
- name: Create disk
|
||||
run: |
|
||||
|
|
@ -128,6 +131,17 @@ jobs:
|
|||
- name: Verify ISO
|
||||
run: checkisomd5 ${{ env.IMAGE_NAME }}-${{ env.VERSION }}.iso
|
||||
|
||||
- name: Run ISO checks
|
||||
run: |
|
||||
for check in $(ls tests/iso)
|
||||
do
|
||||
if [[ -f $check && $check != "README.md" ]]
|
||||
then
|
||||
chmod +x $check
|
||||
./${check} ${{ env.IMAGE_NAME }}-${{ env.VERSION }}.iso
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Add Kickstart and Grub options to ISO
|
||||
run: |
|
||||
sudo mkdir /mnt/iso
|
||||
|
|
@ -184,20 +198,19 @@ jobs:
|
|||
|
||||
timeout 30m bash -c "while ! (grep 'login:' vm.stdout); do sleep 1; done"
|
||||
|
||||
VM_IP=$({ echo '{"execute": "guest-network-get-interfaces"}'; sleep 2; } | socat unix-connect:/tmp/qga.sock - | jq -r '.return[1]["ip-addresses"][] | select(."ip-address-type"=="ipv4") | .["ip-address"]')
|
||||
echo "VM ready for tests at IP ${VM_IP}"
|
||||
#if ! (echo /dev/tcp/${VM_IP}/22)
|
||||
#then
|
||||
echo ${VM_USER} >> vm.stdin
|
||||
|
||||
timeout 30m bash -c "while ! (grep 'Password:' vm.stdout); do sleep 1; done"
|
||||
echo > vm.stdout
|
||||
echo ${VM_PASS} >> vm.stdin
|
||||
|
||||
timeout 30m bash -c "while ! (grep '#' vm.stdout); do sleep 1; done"
|
||||
echo > vm.stdout
|
||||
echo "dnf install -y openssh; systemctl enable --now sshd"
|
||||
timeout 30m bash -c "while ! (grep '#' vm.stdout); do sleep 1; done"
|
||||
#fi
|
||||
export VM_IP=$({ echo '{"execute": "guest-network-get-interfaces"}'; sleep 2; } | socat unix-connect:/tmp/qga.sock - | jq -r '.return[1]["ip-addresses"][] | select(."ip-address-type"=="ipv4") | .["ip-address"]')
|
||||
if ! (echo /dev/tcp/${VM_IP}/22)
|
||||
then
|
||||
echo "SSH must be installed and enabled inside the container"
|
||||
fi
|
||||
|
||||
echo "VM ready for tests at IP ${VM_IP}"
|
||||
echo "VM ready for tests at IP ${VM_IP}"
|
||||
for check in $(ls tests/vm)
|
||||
do
|
||||
if [[ -f $check && $check != "README.md" ]]
|
||||
then
|
||||
chmod +x $check
|
||||
./${check}
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue