typo in grep command
[ta/cloudtaf.git] / testcases / post-install / post_install.robot
1 # Copyright 2019 Nokia
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 *** Settings ***
16 Library             Collections
17 Library             cluster.cluster.Cluster    WITH NAME    Cluster
18 Library             crl.remotesession.remotesession.RemoteSession
19 ...                 WITH NAME    RemoteSession
20 Resource            ssh.robot
21 Test Setup          ssh.Setup Connections
22
23 *** Keywords ***
24 Testing Deployment
25     ${search}=     set variable    log_installation_success Installation complete, Installation Succeeded
26     ${command}=    set variable    tail -n 1 /srv/deployment/log/bootstrap.log
27     ${out}=    ssh.Execute Command    ${command}    controller-1
28     log    ${out}
29     Should contain    ${out}    ${search}
30
31 Looking up LF Jenkins successful build iso number
32     ${command}=    set variable     rpm -qa |grep product-manifest | sed -E 's/^[^-]*-[^-]*-([^-]*)-.*$/\1/'
33     ${out}=    ssh.Execute Command    ${command}    controller-1
34     log    ${out}
35
36 Testing Docker
37     ${search}=     set variable    Docker version 19.03.2
38     ${command}=    set variable    docker --version
39     ${out}=    ssh.Execute Command    ${command}    controller-1
40     log    ${out}
41     Should contain    ${out}    ${search}
42
43 Testing Kubernetes Cluster
44     ${command}=    set variable    kubectl get po --no-headers --namespace=kube-system --field-selector status.phase!=Running 2> /dev/null
45     ${out}=    ssh.Execute Command    ${command}    controller-1
46     log    ${out}
47     Should be empty    ${out}
48
49 Testing State Services
50     Test Service State    docker.service
51     Test Service State    kubelet.service
52
53 Test Service State
54     [Arguments]   ${service}
55     ${running}=    set variable    running
56     ${active}=    set variable    active
57     ${command1}=    set variable    systemctl show -p SubState ${service} | sed 's/SubState=//g'
58     ${command2}=    set variable    systemctl show -p ActiveState ${service} | sed 's/ActiveState=//g'
59     ${out1}=    ssh.Execute Command    ${command1}    controller-1
60     ${out2}=    ssh.Execute Command    ${command2}    controller-1
61     log    ${out1}
62     log    ${out2}
63     Should contain    ${out1}    ${running}
64     Should contain    ${out2}    ${active}
65
66 Testing Node
67     ${count1}=    get length    ${ALL_MASTERS_IN_SYSTEM}
68     ${count2}=    get length    ${ALL_PURE_WORKERS_IN_SYSTEM}
69     ${total}=     evaluate   ${count1}+${count2}
70     ${command}=    set variable    kubectl get no --no-headers | grep Ready | grep -v SchedulingDisabled | wc -l
71     ${out}=    ssh.Execute Command    ${command}    controller-1
72     log    ${out}
73     Should be equal as integers    ${out}    ${total}
74
75 Testing Package Manager Status
76     ${docker_image}=     set variable    docker images -f \'reference=*/caas/hyperkube\' --format=\"{{.Repository}}:{{.Tag}}\"
77     ${out1}=    ssh.Execute Command    ${docker_image}    controller-1
78     ${image_pull}=    set variable    docker pull ${out1} | grep -i status
79     ${out2}=    ssh.Execute Command    ${image_pull}    controller-1
80     ${uptodate}=    set variable    Status: Image is up to date for ${out1}
81     ${out3}=    ssh.Execute Command    ${image_pull}    controller-1
82     log    ${out3}
83     Should be equal    ${out3}    ${uptodate}
84
85 Testing Helm Caas infra Status
86
87     ${search}=     set variable    STATUS: DEPLOYED
88     ${command}=    set variable    helm status caas-infra --kube-context string | grep STATUS:
89     ${out}=    ssh.Execute Command    ${command}    controller-1
90     log    ${out}
91     Should be equal    ${out}    ${search}
92
93
94 *** Test Cases ***
95 Verify Deployment
96     Testing Deployment
97 Verify Image Build Number
98     Looking up LF Jenkins successful build iso number
99 Verify Docker Version
100     Testing Docker
101 Verify Kubernetes Clusters
102     Testing Kubernetes Cluster
103 Verify State of required services
104     Testing State Services
105 Verify Node Functionality
106     Testing Node
107 Verify Package Manager Status
108     Testing Package Manager Status
109 Verify Helm Caas Infra Status
110     Testing Helm Caas infra Status