From df19858776e9a60db1d0fc5b2c17f6898b0b9719 Mon Sep 17 00:00:00 2001 From: Indumathi Buddi Date: Thu, 29 Aug 2019 20:25:54 +0000 Subject: [PATCH] REC-11 Creating and testing Namespaces Signed-off-by: Indumathi Buddi Change-Id: I3a996f8eb600a0f097a8005332fd8b09c25004c9 --- testcases/kube-namespace/kube-namespace.robot | 64 +++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 testcases/kube-namespace/kube-namespace.robot diff --git a/testcases/kube-namespace/kube-namespace.robot b/testcases/kube-namespace/kube-namespace.robot new file mode 100644 index 0000000..c59d5f9 --- /dev/null +++ b/testcases/kube-namespace/kube-namespace.robot @@ -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 -- 2.16.6