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 ${LOG} ${LOG_PATH}${/}${SUITE_NAME.replace(' ','_')}.log
30 Run Sonobuoy Conformance Test
32 Run kubectl apply -f ${CURDIR}${/}sonobuoy.yaml
34 ${rc} ${output}= Run And Return Rc And Output
35 ... kubectl describe pod/sonobuoy -n heptio-sonobuoy
36 Append To File ${LOG} ${output}${\n}
38 # Wait until the test finishes execution
39 Run while sonobuoy status | grep "Sonobuoy is still running"; do sleep 120; done
40 Append To File ${LOG} "Sonobuoy has completed"${\n}
42 # Get the result and store the sonobuoy logs
43 ${rc} ${output}= Run And Return Rc And Output
44 ... results=$(sonobuoy retrieve ${LOG_PATH}) && sonobuoy e2e $results
45 Append To File ${LOG} ${output}${\n}
46 Should Contain ${output} failed tests: 0
49 Check that k8s cluster is reachable
50 # Check that the config file is mounted in the container
51 File Should Not Be Empty /root/.kube/config
53 # Make sure the pod is reachable with the local k8s client
54 ${rc} ${output}= Run And Return Rc And Output
55 ... kubectl get pods --all-namespaces
56 Append To File ${LOG} ${output}${\n}
57 Should Contain ${output} kube-system
60 ${rc} ${output}= Run And Return Rc And Output
61 ... kubectl delete -f ${CURDIR}${/}sonobuoy.yaml
62 Append To File ${LOG} ${output}${\n}
64 Should Contain ${output} service "sonobuoy-master" deleted