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
IMAGE=packagetest
CONTAINER=packagetest
MACHINENAME=podman-machine-default
[[ -f ./lib.sh ]] && source ./lib.sh || exit 1
ssh-keygen -R "[127.0.0.1]:2222"
podman stop $CONTAINER
podman rm $IMAGE
podman machine stop $MACHINENAME
for os in ${OSBUILDS[@]}
do
if podman container exists ${IMAGE}:${os}
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,26 +1,24 @@
#!/usr/bin/env zsh
IMAGE=packagetest
CONTAINER=packagetest
MACHINENAME=podman-machine-default
[[ -f ./lib.sh ]] && source ./lib.sh || exit 1
function machine_state {
echo $(podman machine inspect $MACHINENAME | jq -r '.[].State')
}
if [ "$HOSTOS" = "Darwin" ]
then
echo "Starting $MACHINENAME"
podman machine start -q $MACHINENAME
while [ "$(machine_state)" != "running" ]
do
echo $(machine_state)
echo "Wating for $MACHINENAME to start"
sleep 1
done
echo "Starting $MACHINENAME"
podman machine start -q $MACHINENAME
while [ "$(machine_state)" != "running" ]
do
echo $(machine_state)
echo "Wating for $MACHINENAME to start"
sleep 1
done
echo "Machine $MACHINENAME running"
echo "Machine $MACHINENAME running"
fi
echo "Building container images"
#podman build --platform linux/amd64 -f Containerfile.el9 -t ${IMAGE}_el9 .
podman build --platform linux/amd64 -f Containerfile.fedora -t ${IMAGE}_fedora .
#podman build --platform linux/amd64 -f Containerfile.debian -t ${IMAGE}_debian .
#podman build --platform linux/amd64 -f Containerfile.ubuntu -t ${IMAGE}_ubuntu .
for os in ${OSBUILDS[@]}
do
echo "Building image for ${os}"
podman build --platform linux/amd64 -f Containerfile.${os} -t ${IMAGE}:${os} .
done

View File

@@ -1,14 +1,17 @@
#!/usr/bin/env zsh
podman run --rm -it -d --platform linux/amd64 --name packagetest_fedora -p 2222:22 packagetest
ansible-playbook test_not_local.yml -i inventory.yml
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
# 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
# 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
[[ -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
if [ $? -eq 0 ]
then
podman stop ${IMAGE}:${os}
ssh-keygen -R "[127.0.0.1]:2222"
fi
done