diff options
-rw-r--r-- | functest_kubernetes/cnf_conformance/conformance.py | 3 | ||||
-rw-r--r-- | functest_kubernetes/ims/ims.py | 6 | ||||
-rw-r--r-- | functest_kubernetes/k8stest.py | 6 | ||||
-rw-r--r-- | functest_kubernetes/rally/rally_kubernetes.py | 7 | ||||
-rw-r--r-- | functest_kubernetes/security/security.py | 3 |
5 files changed, 16 insertions, 9 deletions
diff --git a/functest_kubernetes/cnf_conformance/conformance.py b/functest_kubernetes/cnf_conformance/conformance.py index fa174f1a..2cf4baa9 100644 --- a/functest_kubernetes/cnf_conformance/conformance.py +++ b/functest_kubernetes/cnf_conformance/conformance.py @@ -76,7 +76,8 @@ class CNFConformance(testcase.TestCase): lfiles = glob.glob(os.path.join( self.src_dir, 'results', 'cnf-testsuite-results-*.yml')) results = max(lfiles, key=os.path.getmtime) - with open(os.path.join(self.src_dir, 'results', results)) as yfile: + with open(os.path.join( + self.src_dir, 'results', results), encoding='utf-8') as yfile: self.details = yaml.safe_load(yfile) msg = prettytable.PrettyTable( header_style='upper', padding_width=5, diff --git a/functest_kubernetes/ims/ims.py b/functest_kubernetes/ims/ims.py index 18e8c0de..1feeafab 100644 --- a/functest_kubernetes/ims/ims.py +++ b/functest_kubernetes/ims/ims.py @@ -220,7 +220,8 @@ class K8sVims(Vims): for deployment in self.deployment_list: with open(pkg_resources.resource_filename( 'functest_kubernetes', - 'ims/{}-depl.yaml'.format(deployment))) as yfile: + 'ims/{}-depl.yaml'.format(deployment)), + encoding='utf-8') as yfile: template = Template(yfile.read()) body = yaml.safe_load(template.render( dockerhub_repo=os.getenv( @@ -235,7 +236,8 @@ class K8sVims(Vims): for service in self.deployment_list: with open(pkg_resources.resource_filename( 'functest_kubernetes', - 'ims/{}-svc.yaml'.format(service))) as yfile: + 'ims/{}-svc.yaml'.format(service)), + encoding='utf-8') as yfile: body = yaml.safe_load(yfile) resp = self.corev1.create_namespaced_service( body=body, namespace=self.namespace) diff --git a/functest_kubernetes/k8stest.py b/functest_kubernetes/k8stest.py index b450dac4..34c8ab94 100644 --- a/functest_kubernetes/k8stest.py +++ b/functest_kubernetes/k8stest.py @@ -78,7 +78,8 @@ class E2ETesting(testcase.TestCase): cmd_line, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env) as process: boutput = process.stdout.read() - with open(os.path.join(self.res_dir, 'e2e.log'), 'wb') as foutput: + with open(os.path.join( + self.res_dir, 'e2e.log'), 'w', encoding='utf-8') as foutput: foutput.write(boutput) grp = re.search( r'^(FAIL|SUCCESS)!.* ([0-9]+) Passed \| ([0-9]+) Failed \|' @@ -145,5 +146,6 @@ class E2ETesting(testcase.TestCase): "GcrReleaseRegistry": "{}/gke-release".format(gcr_repo), "MicrosoftRegistry": "mcr.microsoft.com", } - with open("{}/repositories.yml".format(self.res_dir), 'w') as file: + with open("{}/repositories.yml".format( + self.res_dir), 'w', encoding='utf-8') as file: yaml.dump(repo_list, file) diff --git a/functest_kubernetes/rally/rally_kubernetes.py b/functest_kubernetes/rally/rally_kubernetes.py index 3543fa99..ef7949ef 100644 --- a/functest_kubernetes/rally/rally_kubernetes.py +++ b/functest_kubernetes/rally/rally_kubernetes.py @@ -65,7 +65,8 @@ class RallyKubernetes(testcase.TestCase): result['existing@kubernetes']['message']) return with open(pkg_resources.resource_filename( - 'functest_kubernetes', 'rally/all-in-one.yaml')) as file: + 'functest_kubernetes', 'rally/all-in-one.yaml'), + encoding='utf-8') as file: template = Template(file.read()) task = yaml.safe_load(template.render( concurrency=kwargs.get("concurrency", self.concurrency), @@ -90,7 +91,7 @@ class RallyKubernetes(testcase.TestCase): self.res_dir, "{}.html".format(self.case_name))) if "files" in result: for path in result["files"]: - with open(path, "w+") as output: + with open(path, "w+", encoding='utf-8') as output: output.write(result["files"][path]) result = rapi.task.export( [task_instance["uuid"]], "junit-xml", @@ -98,6 +99,6 @@ class RallyKubernetes(testcase.TestCase): self.res_dir, "{}.xml".format(self.case_name))) if "files" in result: for path in result["files"]: - with open(path, "w+") as output: + with open(path, "w+", encoding='utf-8') as output: output.write(result["files"][path]) self.stop_time = time.time() diff --git a/functest_kubernetes/security/security.py b/functest_kubernetes/security/security.py index b6f19c75..3d36679f 100644 --- a/functest_kubernetes/security/security.py +++ b/functest_kubernetes/security/security.py @@ -66,7 +66,8 @@ class SecurityTesting(testcase.TestCase): self.__logger.debug("create_namespace: %s", api_response) with open(pkg_resources.resource_filename( "functest_kubernetes", - "security/{}.yaml".format(self.job_name))) as yfile: + "security/{}.yaml".format(self.job_name)), + encoding='utf-8') as yfile: template = Template(yfile.read()) body = yaml.safe_load(template.render( dockerhub_repo=os.getenv("DOCKERHUB_REPO", |