summaryrefslogtreecommitdiffstats
path: root/clover
diff options
context:
space:
mode:
authorStephen Wong <stephen.kf.wong@gmail.com>2018-11-01 06:49:50 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-11-01 06:49:50 +0000
commitaedfdecd5647fc5c2de987e49a487053c78db8fc (patch)
tree4a53d99e8a625aa9ff71efbf7380623e84828fab /clover
parent257e0d846ade5b1051c3734ad6a2d5bea4ce4ca7 (diff)
parent9845df11434dcc268049509c83457fb7debd035c (diff)
Merge "Add initial Istio validation testcase for CI"
Diffstat (limited to 'clover')
-rw-r--r--clover/functest/clover_k8s.py5
-rw-r--r--clover/servicemesh/validate.py47
2 files changed, 50 insertions, 2 deletions
diff --git a/clover/functest/clover_k8s.py b/clover/functest/clover_k8s.py
index eb546f2..25850c6 100644
--- a/clover/functest/clover_k8s.py
+++ b/clover/functest/clover_k8s.py
@@ -7,6 +7,7 @@
import functest_kubernetes.k8stest as k8stest
+import clover.servicemesh.validate as istio_validate
class K8sCloverTest(k8stest.K8sTesting):
"""Clover test suite"""
@@ -17,8 +18,8 @@ class K8sCloverTest(k8stest.K8sTesting):
super(K8sCloverTest, self).__init__(**kwargs)
def run_kubetest(self):
- success = True
+ success = istio_validate.validateDeploy()
if success:
self.result = 100
- elif failure:
+ else:
self.result = 0
diff --git a/clover/servicemesh/validate.py b/clover/servicemesh/validate.py
new file mode 100644
index 0000000..0e2e59a
--- /dev/null
+++ b/clover/servicemesh/validate.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+
+# Copyright (c) Authors of Clover
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+
+from kubernetes import client, config
+
+ISTIO_NAMESPACE = "istio-system"
+ISTIO_DEPLOYMENT = "istio-pilot"
+
+
+def validateDeploy():
+ config.load_kube_config()
+ appsv1 = client.AppsV1Api()
+ corev1 = client.CoreV1Api()
+ find_flag = False
+
+ # check deploytment
+ ret = appsv1.list_deployment_for_all_namespaces(watch=False)
+ for i in ret.items:
+ if ISTIO_DEPLOYMENT == i.metadata.name and \
+ ISTIO_NAMESPACE == i.metadata.namespace:
+ find_flag = True
+ break
+ if find_flag == False:
+ print("ERROR: Deployment: {} doesn't present in {} namespace".format(
+ ISTIO_DEPLOYMENT, ISTIO_NAMESPACE))
+ return False
+
+ return True
+
+
+def main():
+ if validateDeploy():
+ print"Istio install validation has passed"
+ return True
+ else:
+ print"ERROR: Istio install validation has failed"
+ return False
+
+
+if __name__ == '__main__':
+ main()