From 553316e40fcb5b139048b5e0c9bf52b0df9a41eb Mon Sep 17 00:00:00 2001 From: yatin Date: Mon, 8 Jan 2018 11:16:26 +0530 Subject: [PATCH] Fix: functional CI Jobs After [1] jobs are return false(SUCCESS) status due to wrong EXIT_CODE. After [2] kubernetes client is updated to v4.0.0 and no longer contains ConfiugrationObject so we need create instance of Configuration class. Also don't use local to create variable as local can only be used in a function. [1] https://review.openstack.org/#/c/526618/ [2] https://review.openstack.org/#/c/528406 Change-Id: Ida5aac40b234a358b2a13b2e51a41d0242031ebb --- magnum/conductor/k8s_api.py | 4 ++-- magnum/tests/contrib/post_test_hook.sh | 20 +++++++++++++------ magnum/tests/functional/python_client_base.py | 8 ++++---- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/magnum/conductor/k8s_api.py b/magnum/conductor/k8s_api.py index f78ee5788e..496a3f1924 100755 --- a/magnum/conductor/k8s_api.py +++ b/magnum/conductor/k8s_api.py @@ -50,14 +50,14 @@ class K8sAPI(core_v1_api.CoreV1Api): (self.ca_file, self.key_file, self.cert_file) = create_client_files(cluster, context) - config = k8s_config.ConfigurationObject() + config = k8s_config.Configuration() config.host = cluster.api_address config.ssl_ca_cert = self.ca_file.name config.cert_file = self.cert_file.name config.key_file = self.key_file.name # build a connection with Kubernetes master - client = api_client.ApiClient(config=config) + client = api_client.ApiClient(configuration=config) super(K8sAPI, self).__init__(client) diff --git a/magnum/tests/contrib/post_test_hook.sh b/magnum/tests/contrib/post_test_hook.sh index e0b1a000a3..7331a84280 100755 --- a/magnum/tests/contrib/post_test_hook.sh +++ b/magnum/tests/contrib/post_test_hook.sh @@ -178,7 +178,8 @@ popd create_test_data $coe $special -local _magnum_tests="" +_magnum_tests="" +target="${coe}${special}" if [[ "api" == "$coe" ]]; then sudo chown -R $USER:stack $BASE/new/tempest @@ -194,6 +195,9 @@ if [[ "api" == "$coe" ]]; then # show tempest config with magnum cat $TEMPEST_CONFIG + # tempest tox env is looking for /etc/tempest/tempest.conf + sudo mkdir -p /etc/tempest + sudo cp $TEMPEST_CONFIG /etc/tempest/tempest.conf # strigazi: don't run test_create_list_sign_delete_clusters because # it is very unstable in the CI @@ -208,13 +212,17 @@ if [[ "api" == "$coe" ]]; then _magnum_tests="$_magnum_tests magnum_tempest_plugin.tests.api.v1.test_cluster.ClusterTest.test_create_cluster_with_zero_masters" _magnum_tests="$_magnum_tests magnum_tempest_plugin.tests.api.v1.test_cluster.ClusterTest.test_delete_cluster_for_nonexisting_cluster" _magnum_tests="$_magnum_tests magnum_tempest_plugin.tests.api.v1.test_cluster.ClusterTest.test_update_cluster_for_nonexisting_cluster" + + pushd $BASE/new/magnum-tempest-plugin + sudo cp $CREDS_FILE . + sudo -E -H -u $USER tox -e functional-"$target" $_magnum_tests -- --concurrency=1 + EXIT_CODE=$? + popd +else + sudo -E -H -u $USER tox -e functional-"$target" $_magnum_tests -- --concurrency=1 + EXIT_CODE=$? fi -target="${coe}${special}" -pushd $BASE/new/magnum-tempest-plugin -sudo -E -H -u $USER tox -e functional-"$target" $_magnum_tests -- --concurrency=1 -popd -EXIT_CODE=$? # Delete the keypair used in the functional test. echo_summary "Running keypair-delete" diff --git a/magnum/tests/functional/python_client_base.py b/magnum/tests/functional/python_client_base.py index 5277cebd82..5163c0daf9 100755 --- a/magnum/tests/functional/python_client_base.py +++ b/magnum/tests/functional/python_client_base.py @@ -440,23 +440,23 @@ class BaseK8sTest(ClusterTest): def setUpClass(cls): super(BaseK8sTest, cls).setUpClass() cls.kube_api_url = cls.cs.clusters.get(cls.cluster.uuid).api_address - config = k8s_config.ConfigurationObject() + config = k8s_config.Configuration() config.host = cls.kube_api_url config.ssl_ca_cert = cls.ca_file config.cert_file = cls.cert_file config.key_file = cls.key_file - k8s_client = api_client.ApiClient(config=config) + k8s_client = api_client.ApiClient(configuration=config) cls.k8s_api = core_v1_api.CoreV1Api(k8s_client) def setUp(self): super(BaseK8sTest, self).setUp() self.kube_api_url = self.cs.clusters.get(self.cluster.uuid).api_address - config = k8s_config.ConfigurationObject() + config = k8s_config.Configuration() config.host = self.kube_api_url config.ssl_ca_cert = self.ca_file config.cert_file = self.cert_file config.key_file = self.key_file - k8s_client = api_client.ApiClient(config=config) + k8s_client = api_client.ApiClient(configuration=config) self.k8s_api = core_v1_api.CoreV1Api(k8s_client) # TODO(coreypobrien) https://bugs.launchpad.net/magnum/+bug/1551824 utils.wait_for_condition(self._is_api_ready, 5, 600)