From 4a3c47e4d729c14aaeff29fcfb09799b3441ff13 Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Thu, 30 Aug 2018 22:43:13 +0200 Subject: Remove useless env vars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In OPNFV context, provider is always local. Change-Id: Ieb51153bedfec34c0a3dfba9705b0b2afcebb8c2 Signed-off-by: Cédric Ollivier --- functest_kubernetes/k8stest.py | 23 ++++++----------------- functest_kubernetes/test_k8stest.py | 17 ----------------- 2 files changed, 6 insertions(+), 34 deletions(-) diff --git a/functest_kubernetes/k8stest.py b/functest_kubernetes/k8stest.py index 95ebc321..c36863b8 100644 --- a/functest_kubernetes/k8stest.py +++ b/functest_kubernetes/k8stest.py @@ -28,9 +28,10 @@ class K8sTesting(testcase.TestCase): __logger = logging.getLogger(__name__) + config = '/root/.kube/config' + def __init__(self, **kwargs): super(K8sTesting, self).__init__(**kwargs) - self.config = '/root/.kube/config' self.cmd = [] self.result = 0 self.start_time = 0 @@ -113,17 +114,6 @@ class K8sTesting(testcase.TestCase): self.stop_time = time.time() return res - def check_envs(self): # pylint: disable=no-self-use - """Check if required environment variables are set""" - try: - assert 'DEPLOY_SCENARIO' in os.environ - assert 'KUBE_MASTER_IP' in os.environ - assert 'KUBERNETES_PROVIDER' in os.environ - assert 'KUBE_MASTER_URL' in os.environ - except Exception as ex: - raise Exception("Cannot run k8s testcases. " - "Please check env var: %s" % str(ex)) - class K8sSmokeTest(K8sTesting): """Kubernetes smoke test suite""" @@ -131,9 +121,9 @@ class K8sSmokeTest(K8sTesting): if "case_name" not in kwargs: kwargs.get("case_name", 'k8s_smoke') super(K8sSmokeTest, self).__init__(**kwargs) - self.check_envs() - self.cmd = ['/src/k8s.io/kubernetes/cluster/test-smoke.sh', '--host', - os.getenv('KUBE_MASTER_URL')] + self.cmd = ["/src/k8s.io/kubernetes/_output/bin/e2e.test", + "-ginkgo.focus", "Guestbook.application", + "-kubeconfig", self.config, "--provider", "local"] class K8sConformanceTest(K8sTesting): @@ -142,7 +132,6 @@ class K8sConformanceTest(K8sTesting): if "case_name" not in kwargs: kwargs.get("case_name", 'k8s_conformance') super(K8sConformanceTest, self).__init__(**kwargs) - self.check_envs() self.cmd = ['/src/k8s.io/kubernetes/_output/bin/e2e.test', '-ginkgo.focus', 'Conformance', - '-kubeconfig', self.config] + '-kubeconfig', self.config, "--provider", "local"] diff --git a/functest_kubernetes/test_k8stest.py b/functest_kubernetes/test_k8stest.py index c9faf35d..b03bb6dc 100644 --- a/functest_kubernetes/test_k8stest.py +++ b/functest_kubernetes/test_k8stest.py @@ -32,23 +32,6 @@ class K8sTests(unittest.TestCase): self.k8stesting = k8stest.K8sTesting() - def _test_no_env_var(self, var): - del os.environ[var] - with self.assertRaises(Exception): - k8stest.K8sTesting().check_envs() - - def test_no_deploy_scenario(self): - self._test_no_env_var("DEPLOY_SCENARIO") - - def test_no_kube_master_ip(self): - self._test_no_env_var("KUBE_MASTER_IP") - - def test_no_kube_master_url(self): - self._test_no_env_var("KUBE_MASTER_URL") - - def test_no_kubernetes_provider(self): - self._test_no_env_var("KUBERNETES_PROVIDER") - @mock.patch('functest_kubernetes.k8stest.os.path.isfile', return_value=False) def test_run_missing_config_file(self, mock_func): -- cgit 1.2.3-korg