upload post-install 51/1351/4
authorkinkwant <kinkwan.tsui@nokia.com>
Thu, 8 Aug 2019 15:01:09 +0000 (18:01 +0300)
committerkinkwan tsui <kinkwan.tsui@nokia.com>
Fri, 16 Aug 2019 14:26:18 +0000 (14:26 +0000)
Change-Id: I34e016393cfaa80c9970d27bcfa1073ceab1a9b3

testcases/post-install/post_install.robot [new file with mode: 0644]

diff --git a/testcases/post-install/post_install.robot b/testcases/post-install/post_install.robot
new file mode 100644 (file)
index 0000000..bdc3d76
--- /dev/null
@@ -0,0 +1,103 @@
+# Copyright 2019 Nokia
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Settings ***
+Library             Collections
+Library             cluster.cluster.Cluster    WITH NAME    Cluster
+Library             crl.remotesession.remotesession.RemoteSession
+...                 WITH NAME    RemoteSession
+Resource            ssh.robot
+Test Setup          ssh.Setup Connections
+
+*** Keywords ***
+Testing Deployment
+    ${search}=     set variable    log_installation_success Installation complete, Installation Succeeded
+    ${command}=    set variable    tail -n 1 /srv/deployment/log/bootstrap.log
+    ${out}=    ssh.Execute Command    ${command}    controller-1
+    log    ${out}
+    Should contain    ${out}    ${search}
+
+Testing Docker
+    ${search}=     set variable    Docker version 18.09.2
+    ${command}=    set variable    docker --version
+    ${out}=    ssh.Execute Command    ${command}    controller-1
+    log    ${out}
+    Should contain    ${out}    ${search}
+
+Testing Kubernetes Cluster
+    ${command}=    set variable    kubectl get po --no-headers --namespace=kube-system --field-selector status.phase!=Running 2> /dev/null
+    ${out}=    ssh.Execute Command    ${command}    controller-1
+    log    ${out}
+    Should be empty    ${out}
+
+Testing State Services
+    Test Service State    docker.service
+    Test Service State    kubelet.service
+
+Test Service State
+    [Arguments]   ${service}
+    ${running}=    set variable    running
+    ${active}=    set variable    active
+    ${command1}=    set variable    systemctl show -p SubState ${service} | sed 's/SubState=//g'
+    ${command2}=    set variable    systemctl show -p ActiveState ${service} | sed 's/ActiveState=//g'
+    ${out1}=    ssh.Execute Command    ${command1}    controller-1
+    ${out2}=    ssh.Execute Command    ${command2}    controller-1
+    log    ${out1}
+    log    ${out2}
+    Should contain    ${out1}    ${running}
+    Should contain    ${out2}    ${active}
+
+Testing Node
+    ${count1}=    get length    ${ALL_MASTERS_IN_SYSTEM}
+    ${count2}=    get length    ${ALL_PURE_WORKERS_IN_SYSTEM}
+    ${total}=     evaluate   ${count1}+${count2}
+    ${command}=    set variable    kubectl get no --no-headers | grep Ready | grep -v SchedulingDisabled | wc -l
+    ${out}=    ssh.Execute Command    ${command}    controller-1
+    log    ${out}
+    Should be equal as integers    ${out}    ${total}
+
+Testing Package Manager Status
+    ${docker_image}=     set variable    docker images -f \'reference=*/caas/hyperkube\' --format=\"{{.Repository}}:{{.Tag}}\"
+    ${out1}=    ssh.Execute Command    ${docker_image}    controller-1
+    ${image_pull}=    set variable    docker pull ${out1} | grep -i status
+    ${out2}=    ssh.Execute Command    ${image_pull}    controller-1
+    ${uptodate}=    set variable    Status: Image is up to date for ${out1}
+    ${out3}=    ssh.Execute Command    ${image_pull}    controller-1
+    log    ${out3}
+    Should be equal    ${out3}    ${uptodate}
+
+Testing Helm Caas infra Status
+
+    ${search}=     set variable    STATUS: DEPLOYED
+    ${command}=    set variable    helm status caas-infra --kube-context string | grep STATUS:
+    ${out}=    ssh.Execute Command    ${command}    controller-1
+    log    ${out}
+    Should be equal    ${out}    ${search}
+
+
+*** Test Cases ***
+Verify Deployment
+    Testing Deployment
+Verify Docker Version
+    Testing Docker
+Verify Kubernetes Clusters
+    Testing Kubernetes Cluster
+Verify State of required services
+    Testing State Services
+Verify Node Functionality
+    Testing Node
+Verify Package Manager Status
+    Testing Package Manager Status
+Verify Helm Caas Infra Status
+    Testing Helm Caas infra Status