Added Ampere_Openedge hardware type
[rec.git] / workflows / robot_test_ric.sh
1 #!/bin/bash
2 #-----------Pre-modification------------------------------
3 cd RIC
4 git clone https://gerrit.o-ran-sc.org/r/it/test
5 cp test/ric_robot_suite/helm/robot_install.sh /home/cloudadmin/RIC/dep/generated/ricplt
6
7 #-----------Changing the repo location to rec.io-----------
8 sed -i 's,snapshot.docker.ranco-dev-tools.eastus.cloudapp.azure.com:10001,registry.kube-system.svc.rec.io:5555,g' test/ric_robot_suite/helm/ric-robot/values.yaml
9 sed -ri '/nodePort: 30209/d' test/ric_robot_suite/helm/ric-robot/values.yaml
10 sed -ri 's/^(\s*)(type\s*:\s*NodePort\s*$)/\1type: ClusterIP/' test/ric_robot_suite/helm/ric-robot/values.yaml
11 sed -i 's/  tag: latest/  tag: 0.1.0-SNAPSHOT-20190318152929/' test/ric_robot_suite/helm/ric-robot/values.yaml
12 cd dep/generated/ricplt
13
14 #-----------Doing the Docker pull--------------------------
15 #echo "docker" | docker login -u docker --password-stdin snapshot.docker.ranco-dev-tools.eastus.cloudapp.azure.com:10001
16 #docker pull snapshot.docker.ranco-dev-tools.eastus.cloudapp.azure.com:10001/test/ric-robot:latest
17 docker pull rancodev/ric-robot:0.1.0-SNAPSHOT-20190318152929
18 #docker logout snapshot.docker.ranco-dev-tools.eastus.cloudapp.azure.com:10001
19
20
21 #-----------Retagging---------------------------------------
22 docker tag  rancodev/ric-robot:0.1.0-SNAPSHOT-20190318152929 registry.kube-system.svc.rec.io:5555/test/ric-robot:0.1.0-SNAPSHOT-20190318152929
23 docker push  registry.kube-system.svc.rec.io:5555/test/ric-robot:0.1.0-SNAPSHOT-20190318152929
24
25
26 #----------- robot_install----------------------------------
27 #  Note:
28 #  This file needs to be in the it/dep/generated/ricplt directory with ric_install.sh/ric_uninstall.sh
29 #  so that it can use the same dist/packages as the ricplt install
30 #
31 #  ricplt is in:     it/dep/geneated/ricplt
32 #  ric-robot is in:  it/test/ric_robot_suite
33 #
34 if [ ! -e ric-robot ]; then
35     ln  -s ../../../test/ric_robot_suite/helm/ric-robot  ric-robot
36 fi
37
38
39 helm repo add localric http://127.0.0.1:8879/charts
40 helm package -d dist/packages ric-robot
41 pkill helm
42 helm serve --repo-path dist/packages &
43 sleep 2
44 helm repo update
45
46 # if you need to override the repo change the image.repository line for deployment
47 # helm install local/ric-robot --namespace ricplatform --name ric-robot --set image.repository=snapshot.docker.ranco-dev-tools.eastus.cloudapp.azure.com:10001/test/ric-robot
48 #
49 helm install localric/ric-robot --namespace ricplatform --name ric-robot
50 helm repo update
51 #cd ../../../
52 ric_robot_pod=$(kubectl get pods -l app.kubernetes.io/instance=ric-robot -n ricplatform -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
53 kubectl exec -n ricplatform -it $ric_robot_pod -- sed -i '17,19 s/^/#/' /var/opt/RIC/robot/testsuites/health-check.robot
54
55 #---------show the test cases------------------------------
56 cd /home/cloudadmin/RIC/test/ric_robot_suite/helm/ric-robot/
57 bash ete-k8s.sh ricplatform health
58 #--------------kill helm---------------------------------------------------------------------
59 pkill helm
60 #----------checking the status of the pods------------------
61 sleep 30
62 command="$(kubectl get po --no-headers --namespace=ricplatform --field-selector status.phase!=Running 2> /dev/null)"
63 if [[ $command != "" ]]; then
64   exit 1
65 fi
66