upload post-install
[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 Testing Docker
32     ${search}=     set variable    Docker version 18.09.2
33     ${command}=    set variable    docker --version
34     ${out}=    ssh.Execute Command    ${command}    controller-1
35     log    ${out}
36     Should contain    ${out}    ${search}
37
38 Testing Kubernetes Cluster
39     ${command}=    set variable    kubectl get po --no-headers --namespace=kube-system --field-selector status.phase!=Running 2> /dev/null
40     ${out}=    ssh.Execute Command    ${command}    controller-1
41     log    ${out}
42     Should be empty    ${out}
43
44 Testing State Services
45     Test Service State    docker.service
46     Test Service State    kubelet.service
47
48 Test Service State
49     [Arguments]   ${service}
50     ${running}=    set variable    running
51     ${active}=    set variable    active
52     ${command1}=    set variable    systemctl show -p SubState ${service} | sed 's/SubState=//g'
53     ${command2}=    set variable    systemctl show -p ActiveState ${service} | sed 's/ActiveState=//g'
54     ${out1}=    ssh.Execute Command    ${command1}    controller-1
55     ${out2}=    ssh.Execute Command    ${command2}    controller-1
56     log    ${out1}
57     log    ${out2}
58     Should contain    ${out1}    ${running}
59     Should contain    ${out2}    ${active}
60
61 Testing Node
62     ${count1}=    get length    ${ALL_MASTERS_IN_SYSTEM}
63     ${count2}=    get length    ${ALL_PURE_WORKERS_IN_SYSTEM}
64     ${total}=     evaluate   ${count1}+${count2}
65     ${command}=    set variable    kubectl get no --no-headers | grep Ready | grep -v SchedulingDisabled | wc -l
66     ${out}=    ssh.Execute Command    ${command}    controller-1
67     log    ${out}
68     Should be equal as integers    ${out}    ${total}
69
70 Testing Package Manager Status
71     ${docker_image}=     set variable    docker images -f \'reference=*/caas/hyperkube\' --format=\"{{.Repository}}:{{.Tag}}\"
72     ${out1}=    ssh.Execute Command    ${docker_image}    controller-1
73     ${image_pull}=    set variable    docker pull ${out1} | grep -i status
74     ${out2}=    ssh.Execute Command    ${image_pull}    controller-1
75     ${uptodate}=    set variable    Status: Image is up to date for ${out1}
76     ${out3}=    ssh.Execute Command    ${image_pull}    controller-1
77     log    ${out3}
78     Should be equal    ${out3}    ${uptodate}
79
80 Testing Helm Caas infra Status
81
82     ${search}=     set variable    STATUS: DEPLOYED
83     ${command}=    set variable    helm status caas-infra --kube-context string | grep STATUS:
84     ${out}=    ssh.Execute Command    ${command}    controller-1
85     log    ${out}
86     Should be equal    ${out}    ${search}
87
88
89 *** Test Cases ***
90 Verify Deployment
91     Testing Deployment
92 Verify Docker Version
93     Testing Docker
94 Verify Kubernetes Clusters
95     Testing Kubernetes Cluster
96 Verify State of required services
97     Testing State Services
98 Verify Node Functionality
99     Testing Node
100 Verify Package Manager Status
101     Testing Package Manager Status
102 Verify Helm Caas Infra Status
103     Testing Helm Caas infra Status