This repository was archived by the owner on Jan 29, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·50 lines (38 loc) · 1.33 KB
/
test.sh
File metadata and controls
executable file
·50 lines (38 loc) · 1.33 KB
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
#!/usr/bin/bash
set -e
bold() { echo -e "\e[1m$@\e[0m" ; }
red() { echo -e "\e[31m$@\e[0m" ; }
green() { echo -e "\e[32m$@\e[0m" ; }
PASS() { green PASS ; }
condTravisFold() {
[[ -n "$TRAVIS" ]] && echo "travis_fold:start:SCRIPT folding starts" || :
eval "$@"
[[ -n "$TRAVIS" ]] && echo "travis_fold:end:SCRIPT folding ends" || :
}
timeout_while() { timeout $1 sh -c "while true; do $2 && break || : ; sleep 1 ; done" ; }
k_wait_all_running() { bash ci/wait-pods-ok; }
{
kubectl apply -f manifests/vm.yaml
kubectl get vm testvm
kubectl patch virtualmachine testvm --type merge -p '{"spec":{"running":true}}'
timeout_while 30s "kubectl get vmis | grep testvm"
condTravisFold k_wait_all_running
# Some additional time to schedule the VM
kubectl describe vmis testvm
timeout_while 2m "kubectl get vmis testvm -o jsonpath='{.status.phase}' | grep Running"
if [[ "$(kubectl get -o name nodes) | wc -l)" -gt 1 ]];
then
virtctl migrate testvm
sleep 20
kubectl describe VirtualMachineInstanceMigration testvm-migration
fi
kubectl delete -n kubevirt kubevirt kubevirt --wait=true
kubectl delete namespace kubevirt --wait=true
} || {
echo "Something went wrong, gathering debug infos"
kubectl describe -n kubevirt kubevirt kubevirt
kubectl get --all-namespaces events
kubectl describe vmis
exit 1
}
PASS