aboutsummaryrefslogtreecommitdiffstats
path: root/functest_kubernetes/ims
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2021-11-15 15:13:46 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2021-11-15 15:14:11 +0100
commite3c09959d8639b6e798759bb74e98a752b98b7f4 (patch)
tree587a31b2b9f88b2935ffb26ebdbd1f1511d329f0 /functest_kubernetes/ims
parentb100b1254e06719bf1c779b9d53d0ac2da67fca4 (diff)
Update linters and fix all new issues
It mostly adds encoding in open calls and leverages f-strings. It removes ansible-lint as it now asks for ansible, roles and collections. Change-Id: I3ef729f44b2c721b14d19df27805938298aa2c67 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest_kubernetes/ims')
-rw-r--r--functest_kubernetes/ims/ims.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/functest_kubernetes/ims/ims.py b/functest_kubernetes/ims/ims.py
index 1feeafab..9a7c6485 100644
--- a/functest_kubernetes/ims/ims.py
+++ b/functest_kubernetes/ims/ims.py
@@ -71,7 +71,7 @@ class Vims(testcase.TestCase): # pylint: disable=too-many-instance-attributes
generate_name=self.ns_generate_name)))
self.namespace = api_response.metadata.name
self.__logger.debug("create_namespace: %s", api_response)
- self.zone = '{}.svc.cluster.local'.format(self.namespace)
+ self.zone = f'{self.namespace}.svc.cluster.local'
metadata = client.V1ObjectMeta(
name=self.metadata_name, namespace=self.namespace)
body = client.V1ConfigMap(
@@ -127,9 +127,9 @@ class Vims(testcase.TestCase): # pylint: disable=too-many-instance-attributes
assert self.zone
container = client.V1Container(
name=self.test_container_name, image=self.test_image_name,
- command=["rake", "test[{}]".format(self.zone),
- "PROXY=bono.{}".format(self.zone),
- "ELLIS=ellis.{}".format(self.zone),
+ command=["rake", f"test[{self.zone}]",
+ f"PROXY=bono.{self.zone}",
+ f"ELLIS=ellis.{self.zone}",
"SIGNUP_CODE=secret", "--trace"])
spec = client.V1PodSpec(containers=[container], restart_policy="Never")
metadata = client.V1ObjectMeta(name=self.test_container_name)
@@ -141,8 +141,7 @@ class Vims(testcase.TestCase): # pylint: disable=too-many-instance-attributes
namespace=self.namespace, timeout_seconds=self.watch_timeout):
self.__logger.debug(event)
if event["object"].metadata.name == self.test_container_name:
- if (event["object"].status.phase == 'Succeeded'
- or event["object"].status.phase == 'Failed'):
+ if event["object"].status.phase in ('Succeeded', 'Failed'):
watch_deployment.stop()
api_response = self.corev1.read_namespaced_pod_log(
name=self.test_container_name, namespace=self.namespace)
@@ -220,7 +219,7 @@ class K8sVims(Vims):
for deployment in self.deployment_list:
with open(pkg_resources.resource_filename(
'functest_kubernetes',
- 'ims/{}-depl.yaml'.format(deployment)),
+ f'ims/{deployment}-depl.yaml'),
encoding='utf-8') as yfile:
template = Template(yfile.read())
body = yaml.safe_load(template.render(
@@ -235,8 +234,7 @@ class K8sVims(Vims):
"create_namespaced_deployment: %s", resp)
for service in self.deployment_list:
with open(pkg_resources.resource_filename(
- 'functest_kubernetes',
- 'ims/{}-svc.yaml'.format(service)),
+ 'functest_kubernetes', f'ims/{service}-svc.yaml'),
encoding='utf-8') as yfile:
body = yaml.safe_load(yfile)
resp = self.corev1.create_namespaced_service(
@@ -284,7 +282,7 @@ class HelmVims(Vims):
quay_repo = os.getenv("QUAY_REPO", self.quay_repo)
cmd = [
"helm", "install", "clearwater", "--set",
- "repo.dockerHub={},repo.quay={}".format(dockerhub_repo, quay_repo),
+ f"repo.dockerHub={dockerhub_repo},repo.quay={quay_repo}",
pkg_resources.resource_filename("functest_kubernetes", "ims/helm"),
"-n", self.namespace]
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)