-
Notifications
You must be signed in to change notification settings - Fork 9
/
test.sh
42 lines (33 loc) · 1.3 KB
/
test.sh
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
#!/bin/bash
echo "$(minikube ip) minikube" | sudo tee -a /etc/hosts
## No HW virt
kubectl create configmap -n kubevirt kubevirt-config --from-literal debug.useEmulation=true --from-literal feature-gates=DataVolumes
kubectl scale --replicas=0 deployment/virt-controller -n kubevirt
kubectl scale --replicas=2 deployment/virt-controller -n kubevirt
kubectl scale --replicas=0 deployment/virt-api -n kubevirt
kubectl scale --replicas=2 deployment/virt-api -n kubevirt
## Prepare CDI
export CDI_VERSION=v1.5.0
kubectl apply -f https://github.com/kubevirt/containerized-data-importer/releases/download/$CDI_VERSION/cdi-controller.yaml
get_remaining_pods() {
kubectl get pods \
--all-namespaces \
--field-selector=status.phase!=Running,status.phase!=Succeeded ;
}
sleep 6;
while [[ "$( get_remaining_pods 2>&1 | wc -l)" -gt 2 ]];
do
kubectl get pods --all-namespaces
sleep 6;
done
## Build kubevirt provider
make build
mv terraform-provider-kubevirt examples/
## Execute test
cd examples/
terraform init
terraform plan -var minikube_ip=$(minikube ip)
terraform apply -auto-approve -var minikube_ip=$(minikube ip)
terraform plan -var minikube_ip=$(minikube ip)
echo $(sshpass -p 'gocubsgo' ssh cirros@$(minikube ip) -p 30000 -vvvv 'cat /tmp/test')
terraform destroy -var minikube_ip=$(minikube ip) -auto-approve