2 ##############################################################################
3 # Copyright (c) 2020 Huawei Tech and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
11 KUBERNETES=~/testk8s-kubernetes.yaml
13 cat <<EOF > "${KUBERNETES}"
18 name: kubernets-deployment
39 CLUSTER_INFO=$(kubectl cluster-info)
43 result_nginx="failure"
46 if [[ $CLUSTER_INFO != "" ]]; then
47 kubectl create -f ~/testk8s-kubernetes.yaml
50 echo "No kubernetes cluster present"
55 echo "Kubectl deployments........................................."
56 kubectl get deployments
58 echo "Test Case: Nginx-Deployment started"
60 DEPLOY_CONDIT=$(kubectl get pods \
61 --field-selector=status.phase==Running \
62 | grep kubernets-deployment \
65 if [[ $DEPLOY_CONDIT == 1 ]]; then
66 result_nginx="success";
70 echo "Kubectl pods in default namespace................................."
73 echo "-------------------------------------------------------------------"
74 echo "-------------------------------------------------------------------"
78 echo "Test Case: Pods status check started"
80 PODS_NOT_RUN_COUNT=$(kubectl get pods \
81 --field-selector=status.phase!=Running \
84 if [[ $PODS_NOT_RUN_COUNT > 0 ]]; then > /dev/null 2>&1
85 result_pods="failure";
89 result_pods="success";
94 echo "-------------------------------------------------------------------"
95 echo "| Total CSIT Tests: $count |"
96 echo "|-----------------------------------------------------------------|"
97 echo "| TEST CASE NAME | RESULT |"
98 echo "|-----------------------------------------------------------------|"
100 echo "| Nginx-Deployment | $result_nginx |"
102 echo "| Pods status check | $result_pods |"
104 echo "|-----------------------------------------------------------------|"
105 echo "| Executed Total CSIT Tests: $count |"
106 echo "-------------------------------------------------------------------"