Set of TCs to test K8s layer via Robot
[validation.git] / conformance / conformance.robot
1 ##############################################################################
2 # Copyright (c) 2019 AT&T Intellectual Property.                             #
3 # Copyright (c) 2019 Nokia.                                                  #
4 #                                                                            #
5 # Licensed under the Apache License, Version 2.0 (the "License");            #
6 # you maynot use this file except in compliance with the License.            #
7 #                                                                            #
8 # You may obtain a copy of the License at                                    #
9 #       http://www.apache.org/licenses/LICENSE-2.0                           #
10 #                                                                            #
11 # Unless required by applicable law or agreed to in writing, software        #
12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT  #
13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.           #
14 # See the License for the specific language governing permissions and        #
15 # limitations under the License.                                             #
16 ##############################################################################
17
18
19 *** Settings ***
20 Documentation     Run K8s Conformance Test
21 Library           SSHLibrary
22 Library           OperatingSystem
23 Library           BuiltIn
24 Suite Setup       Open Connection And Log In
25 Suite Teardown    Close All Connections
26
27 *** Variables ***
28 ${HOST}           localhost
29 ${USERNAME}       localadmin
30 ${LOG}            /opt/akraino/validation/conformance/print_conformance.txt
31
32 *** Test Cases ***
33 Get Robot Version
34         [Documentation]         Verify Robot
35         Start Command           robot --version
36         ${stdout}=              Read Command Output
37         Append To File          ${LOG}  ${stdout}${\n}
38         Should Contain          ${stdout}               Robot Framework
39
40 Verify Go Package
41         [Documentation]         Verify Go Package
42         Start Command           hello
43         ${stdout}=              Read Command Output
44         Append To File          ${LOG}  ${stdout}${\n}
45         Should Contain          ${stdout}               Hello, world!
46
47
48 Start Sonobuoy Conformance Test
49         [Documentation]         Test will take about 1hr and 40 mins to complete
50         ${output}=              Execute Command     cat /opt/akraino/validation/conformance/sonobuoy.yaml | kubectl apply -f -    sudo=True
51         Append To File          ${LOG}  ${output}${\n}
52         Sleep                   3s
53         Should Contain          ${output}             pod/sonobuoy created
54
55
56 Description of Sonobuoy Pods
57         [Documentation]         Description of Sonobuoy Pod
58         ${output}  ${rc}=       Execute Command      kubectl describe pod/sonobuoy -n heptio-sonobuoy    return_rc=True    sudo=True
59         Append To File          ${LOG}  ${output}${\n}
60         Should Be Equal As Integers  ${rc}  0
61
62
63 Verify Conformance Test is Running
64         [Documentation]         Conformance Test ongoing
65         ${output}  ${rc}=       Execute Command       kubectl get pods --all-namespaces -o wide | grep heptio    return_rc=True    sudo=True
66         Append To File          ${LOG}  ${output}${\n}
67         Should Be Equal As Integers  ${rc}  0
68
69
70
71 *** Keywords ***
72 Open Connection And Log In
73   Open Connection       ${HOST}
74   Login With Public Key    ${USERNAME}  /root/.ssh/${USERNAME}_id_rsa
75