REC-11 Creating and testing Namespaces 90/1490/6
authorIndumathi Buddi <ib405q@att.com>
Thu, 29 Aug 2019 20:25:54 +0000 (20:25 +0000)
committerIndumathi Buddi <ib405q@att.com>
Wed, 25 Sep 2019 05:17:45 +0000 (05:17 +0000)
Signed-off-by: Indumathi Buddi <ib405q@att.com>
Change-Id: I3a996f8eb600a0f097a8005332fd8b09c25004c9

testcases/kube-namespace/kube-namespace.robot [new file with mode: 0644]

diff --git a/testcases/kube-namespace/kube-namespace.robot b/testcases/kube-namespace/kube-namespace.robot
new file mode 100644 (file)
index 0000000..c59d5f9
--- /dev/null
@@ -0,0 +1,64 @@
+# Copyright 2019 AT&T
+#
+# 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          Run Keywords
+...                 ssh.Setup Connections
+...                 Create Namespace
+Test Teardown       Run Keywords
+...                 Delete Namespace
+
+*** Keywords ***
+
+Create Namespace
+    ${command}=    set variable    kubectl create namespace test-ns
+    ${out}=    ssh.Execute Command    ${command}    controller-1
+    log    ${out}
+    Should contain    ${out}    namespace/test-ns created
+    
+Create pod in specific namespace
+    ${command}=    set variable    kubectl run --generator=run-pod/v1 my-pod --image=nginx --port=80 --namespace=test-ns
+    ${out}=    ssh.Execute Command    ${command}    controller-1
+    log    ${out}
+    Should contain    ${out}    pod/my-pod created
+
+Check whether pod was created in specific namespace
+    ${command}=    set variable    kubectl describe pod my-pod -n test-ns
+    ${out}=    ssh.Execute Command    ${command}    controller-1
+    log    ${out}
+    Should contain    ${out}    test-ns
+
+Delete pod
+    ${command}=    set variable    kubectl delete pod my-pod -n test-ns
+    ${out}=    ssh.Execute Command    ${command}    controller-1
+    log    ${out}
+    Should contain    ${out}    pod "my-pod" deleted
+
+Delete Namespace
+    ${command}=    set variable    kubectl delete namespace test-ns
+    ${out}=    ssh.Execute Command    ${command}    controller-1
+    log    ${out}
+    Should contain    ${out}    namespace "test-ns" deleted
+
+*** Test Cases ***
+
+Verify creating and testing Namespaces
+    Create pod in specific namespace
+    Check whether pod was created in specific namespace
+    Delete pod