k3s/scripts/test
2019-01-01 01:23:01 -07:00

51 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
set -e
cd $(dirname $0)/..
echo Running tests
mkdir -p ./build
mkdir -p /var/lib/rancher/rio/agent
mount -t tmpfs none /var/lib/rancher/rio/agent
./bin/rio server --disable-agent | grep -v level=info > /var/lib/rancher/rio/agent/agent.log 2>&1 &
for i in {1..120}; do
if [ ! -e /var/lib/rancher/rio/server/node-token ]; then
sleep .5
continue
fi
curl -sf http://localhost:7080/healthz >/dev/null && break
sleep .5
done
curl -sf http://localhost:7080/healthz >/dev/null
rm -rf ./image/root
unsquashfs -d ./image/root ./image/main.squashfs
ENTER_ROOT=$(pwd)/image/root ./bin/rio --debug agent -s https://localhost:7443 -t $(</var/lib/rancher/rio/server/node-token) >>/var/lib/rancher/rio/agent/agent.log 2>&1 &
export PATH=$(pwd)/bin:$PATH
rio login -s https://localhost:7443 -t /var/lib/rancher/rio/server/client-token
echo Waiting for istio/istio-gateway
rio --project=rio-system wait istio/istio-gateway
rio --project=rio-system ps
rio --project=rio-system ps -c
chmod +x ./tests/init-nfs.bash
./tests/init-nfs.bash
export RUN_NFS_TEST=true
cd ./tests
tox -- -n $(nproc)
cd ..
bats -r ./tests || {
tail -n 100 /var/lib/rancher/rio/agent/agent.log
exit 1
}