-
Notifications
You must be signed in to change notification settings - Fork 7
/
run_tests
executable file
·57 lines (46 loc) · 1.4 KB
/
run_tests
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
# install bats if needed
if [ ! -d "node_modules" ]; then
echo "Installing Bats"
npm install
else
echo "Bats installed"
fi
. tests/utils.sh
# create juju models for centos and ubuntu
postfix=$(date +'%Y-%m-%d-')$RANDOM
# The first arg is the operating system
BASE_OS=$1
if [[ $BASE_OS == "centos" ]]; then
model="centos-test-$postfix"
else
if [[ $BASE_OS == "focal" ]]; then
model="focal-test-$postfix"
else
echo "Usage: ./run_tests <OS>"
echo
echo "Supported operating systems: [centos, focal]"
echo
exit
fi
fi
echo "Creating model $model"
juju add-model "$model"
juju switch "$model"
juju model-config --model "$model" logging-config="<unit>=DEBUG;<root>=DEBUG"
juju model-config --model "$model" update-status-hook-interval=1m
juju wait-for model "$model" --timeout=10s
cd ../slurm-bundles
target=$(echo $model | cut -d"-" -f1)
make lxd-$target
cd ../slurm-charms
# wait for deploy to finish
sleep 10
juju wait-for unit percona-cluster/0 --query='agent-status=="idle"' --timeout=9m
juju wait-for unit slurmctld/0 --query='agent-status=="idle"' --timeout=9m
juju wait-for unit slurmdbd/0 --query='agent-status=="idle"' --timeout=9m
juju wait-for unit slurmrestd/0 --query='agent-status=="idle"' --timeout=9m
juju wait-for unit slurmd/0 --query='agent-status=="idle"' --timeout=9m
myjuju run --all --model "$model" "sudo reboot"
juju status
JUJU_MODEL="$model" npx bats tests/