Browse Source

Fix CI failure

Correct params for the following functions when using kubernetes=9.0.0:
- delete_namespaced_pod
- delete_namespaced_service
- create_namespaced_deployment

Incease the timeout when waiting for the runtime created.

Change-Id: I74fd74a5a02811442c9eaff3f25fc03ee9312100
Story: #2006225
Task: #35824
changes/90/671190/6
Lingxian Kong 1 year ago
parent
commit
49830445c9
3 changed files with 14 additions and 16 deletions
  1. +5
    -9
      qinling/orchestrator/kubernetes/manager.py
  2. +8
    -6
      qinling/tests/unit/orchestrator/kubernetes/test_manager.py
  3. +1
    -1
      qinling_tempest_plugin/tests/base.py

+ 5
- 9
qinling/orchestrator/kubernetes/manager.py View File

@ -18,7 +18,6 @@ import os
import time
import jinja2
from kubernetes.client import V1DeleteOptions
from oslo_log import log as logging
import requests
import tenacity
@ -149,7 +148,8 @@ class KubernetesManager(base.OrchestratorBase):
self.v1extension.create_namespaced_deployment(
body=yaml.safe_load(deployment_body),
namespace=self.conf.kubernetes.namespace
namespace=self.conf.kubernetes.namespace,
async_req=False
)
self._wait_deployment_available(name)
@ -176,8 +176,7 @@ class KubernetesManager(base.OrchestratorBase):
for svc_name in names:
self.v1.delete_namespaced_service(
svc_name,
self.conf.kubernetes.namespace,
V1DeleteOptions(),
self.conf.kubernetes.namespace
)
LOG.info("Services in deployment %s deleted.", name)
@ -521,8 +520,7 @@ class KubernetesManager(base.OrchestratorBase):
self.v1.delete_namespaced_pod(
identifier,
self.conf.kubernetes.namespace,
{}
self.conf.kubernetes.namespace
)
LOG.debug('Pod %s deleted.', identifier)
@ -560,8 +558,7 @@ class KubernetesManager(base.OrchestratorBase):
for svc_name in names:
self.v1.delete_namespaced_service(
svc_name,
self.conf.kubernetes.namespace,
V1DeleteOptions(),
self.conf.kubernetes.namespace
)
self.v1.delete_collection_namespaced_pod(
@ -592,5 +589,4 @@ class KubernetesManager(base.OrchestratorBase):
self.v1.delete_namespaced_pod(
pod_name,
self.conf.kubernetes.namespace,
{}
)

+ 8
- 6
qinling/tests/unit/orchestrator/kubernetes/test_manager.py View File

@ -158,7 +158,8 @@ class TestKubernetesManager(base.DbTestCase):
)
self.k8s_v1_ext.create_namespaced_deployment.assert_called_once_with(
body=yaml.safe_load(deployment_body),
namespace=self.fake_namespace)
namespace=self.fake_namespace,
async_req=False)
self.k8s_v1_ext.read_namespaced_deployment.assert_called_once_with(
fake_deployment_name, self.fake_namespace)
@ -219,8 +220,8 @@ class TestKubernetesManager(base.DbTestCase):
self.fake_namespace,
label_selector='runtime_id=%s' % fake_deployment_name)
delete_service_calls = [
mock.call(svc1_name, self.fake_namespace, mock.ANY),
mock.call(svc2_name, self.fake_namespace, mock.ANY),
mock.call(svc1_name, self.fake_namespace),
mock.call(svc2_name, self.fake_namespace),
]
self.k8s_v1_api.delete_namespaced_service.assert_has_calls(
delete_service_calls)
@ -742,8 +743,8 @@ class TestKubernetesManager(base.DbTestCase):
)
delete_service_calls = [
mock.call(svc1_name, self.fake_namespace, mock.ANY),
mock.call(svc2_name, self.fake_namespace, mock.ANY)
mock.call(svc1_name, self.fake_namespace),
mock.call(svc2_name, self.fake_namespace)
]
self.k8s_v1_api.delete_namespaced_service.assert_has_calls(
delete_service_calls)
@ -920,4 +921,5 @@ class TestKubernetesManager(base.DbTestCase):
self.manager.delete_worker(pod_name)
self.k8s_v1_api.delete_namespaced_pod.assert_called_once_with(
pod_name, self.fake_namespace, {})
pod_name, self.fake_namespace
)

+ 1
- 1
qinling_tempest_plugin/tests/base.py View File

@ -66,7 +66,7 @@ class BaseQinlingTest(test.BaseTestCase):
@tenacity.retry(
wait=tenacity.wait_fixed(3),
stop=tenacity.stop_after_attempt(10),
stop=tenacity.stop_after_attempt(20),
retry=tenacity.retry_if_exception_type(AssertionError)
)
def wait_runtime_available(self, id):


Loading…
Cancel
Save