1 ##############################################################################
2 # Copyright (c) 2019 AT&T Intellectual Property. #
3 # Copyright (c) 2019 Nokia. #
4 # Copyright (c) 2019 Enea AB
6 # Licensed under the Apache License, Version 2.0 (the "License"); #
7 # you maynot use this file except in compliance with the License. #
9 # You may obtain a copy of the License at #
10 # http://www.apache.org/licenses/LICENSE-2.0 #
12 # Unless required by applicable law or agreed to in writing, software #
13 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
14 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
15 # See the License for the specific language governing permissions and #
16 # limitations under the License. #
17 ##############################################################################
20 Documentation Run k8s conformance test using sonobuoy
21 Library OperatingSystem
23 Test Setup Check that k8s cluster is reachable
24 Test Teardown Cleanup Sonobuoy
27 ${RESULT_PATH} /opt/akraino/validation/results/conformance/
28 ${REPO_PATH} /opt/akraino/validation/repo/conformance/
29 ${LOG} ${RESULT_PATH}${/}conformance.log
32 Run Sonobuoy Conformance Test
34 Run kubectl apply -f ${REPO_PATH}${/}sonobuoy.yaml
36 ${rc} ${output}= Run And Return Rc And Output
37 ... kubectl describe pod/sonobuoy -n heptio-sonobuoy
38 Append To File ${LOG} ${output}${\n}
40 # Wait until the test finishes execution
41 Run until sonobuoy status | grep "Sonobuoy has completed"; do sleep 120; done
42 Append To File ${LOG} "Sonobuoy has completed"${\n}
44 # Get the result and store the sonobuoy logs
45 ${rc} ${output}= Run And Return Rc And Output
46 ... results=$(sonobuoy retrieve ${RESULT_PATH}) && sonobuoy e2e $results
47 Append To File ${LOG} ${output}${\n}
48 Should Contain ${output} failed tests: 0
51 Check that k8s cluster is reachable
52 # Check that the config file is mounted in the container
53 File Should Not Be Empty /root/.kube/config
55 # Make sure the pod is reachable with the local k8s client
56 ${rc} ${output}= Run And Return Rc And Output
57 ... kubectl get pods --all-namespaces
58 Append To File ${LOG} ${output}${\n}
59 Should Contain ${output} kube-system
62 ${rc} ${output}= Run And Return Rc And Output
63 ... kubectl delete -f ${REPO_PATH}${/}sonobuoy.yaml
64 Append To File ${LOG} ${output}${\n}
66 Should Contain ${output} service "sonobuoy-master" deleted