fix tests

- only leave fedora enabled
- test each package one at a time to ensure they install correctly
This commit is contained in:
Matthew Stobbs
2025-02-28 20:11:35 -07:00
parent f4744bcec9
commit ac87ba3f4c
4 changed files with 56 additions and 39 deletions

View File

@@ -1,10 +1,16 @@
#!/usr/bin/env zsh #!/usr/bin/env zsh
IMAGE=packagetest [[ -f ./lib.sh ]] && source ./lib.sh || exit 1
CONTAINER=packagetest
MACHINENAME=podman-machine-default
ssh-keygen -R "[127.0.0.1]:2222" for os in ${OSBUILDS[@]}
podman stop $CONTAINER do
podman rm $IMAGE if podman container exists ${IMAGE}:${os}
podman machine stop $MACHINENAME then
podman stop ${IMAGE}:${os}
fi
done
if [ "$HOSTOS" = "Darwin" ]
then
podman machine stop ${MACHINENAME}
fi

10
tests/lib.sh Normal file
View File

@@ -0,0 +1,10 @@
HOSTOS="$(uname -o)"
IMAGE=${IMAGE:-packagetest}
CONTAINER=${CONTAINER:-packagetest}
MACHINENAME=${MACHINENAME:-podman-machine-default}
# OSBUILDS=("fedora" "el9" "debian" "ubuntu")
OSBUILDS=("fedora")
function machine_state {
echo $(podman machine inspect $MACHINENAME | jq -r '.[].State')
}

View File

@@ -1,13 +1,9 @@
#!/usr/bin/env zsh #!/usr/bin/env zsh
IMAGE=packagetest [[ -f ./lib.sh ]] && source ./lib.sh || exit 1
CONTAINER=packagetest
MACHINENAME=podman-machine-default
function machine_state {
echo $(podman machine inspect $MACHINENAME | jq -r '.[].State')
}
if [ "$HOSTOS" = "Darwin" ]
then
echo "Starting $MACHINENAME" echo "Starting $MACHINENAME"
podman machine start -q $MACHINENAME podman machine start -q $MACHINENAME
while [ "$(machine_state)" != "running" ] while [ "$(machine_state)" != "running" ]
@@ -18,9 +14,11 @@ do
done done
echo "Machine $MACHINENAME running" echo "Machine $MACHINENAME running"
fi
echo "Building container images" echo "Building container images"
#podman build --platform linux/amd64 -f Containerfile.el9 -t ${IMAGE}_el9 . for os in ${OSBUILDS[@]}
podman build --platform linux/amd64 -f Containerfile.fedora -t ${IMAGE}_fedora . do
#podman build --platform linux/amd64 -f Containerfile.debian -t ${IMAGE}_debian . echo "Building image for ${os}"
#podman build --platform linux/amd64 -f Containerfile.ubuntu -t ${IMAGE}_ubuntu . podman build --platform linux/amd64 -f Containerfile.${os} -t ${IMAGE}:${os} .
done

View File

@@ -1,14 +1,17 @@
#!/usr/bin/env zsh #!/usr/bin/env zsh
podman run --rm -it -d --platform linux/amd64 --name packagetest_fedora -p 2222:22 packagetest [[ -f ./lib.sh ]] && source ./lib.sh || exit 1
for os in ${OSBUILDS[@]}
do
if ! podman container exists ${IMAGE}:${os}
then
podman run --rm -it -d --platform linux/amd64 --name ${IMAGE}:${os} -p 2222:22 packagetest
fi
ansible-playbook test_not_local.yml -i inventory.yml ansible-playbook test_not_local.yml -i inventory.yml
podman stop packagetest if [ $? -eq 0 ]
# podman run --rm -it -d --platform linux/amd64 --name packagetest -p 2222:22 packagetest then
# ansible-playbook test_not_local.yml -i inventory.yml podman stop ${IMAGE}:${os}
# podman stop packagetest ssh-keygen -R "[127.0.0.1]:2222"
# podman run --rm -it -d --platform linux/amd64 --name packagetest -p 2222:22 packagetest fi
# ansible-playbook test_not_local.yml -i inventory.yml done
# podman stop packagetest
# podman run --rm -it -d --platform linux/amd64 --name packagetest -p 2222:22 packagetest
# ansible-playbook test_not_local.yml -i inventory.yml
# podman stop packagetest