From 1b93f719566bdaad263d4e6e5ed107c7311541c9 Mon Sep 17 00:00:00 2001 From: vamahaja Date: Tue, 24 Mar 2020 17:04:42 +0530 Subject: [LibFix] Fix 'g.rpyc_get_connection' library issue 'g.rpyc_get_connection' library fails to set connection. Instead of using 'g.rpyc_get_connection' libray for modifying file remotely, create file locally and upload to remote location using 'g.upload' library. Change-Id: I85564ee5b7c28a9d866be033d18bd018f648cd5b Signed-off-by: vamahaja --- tests/functional/heketi/test_volume_multi_req.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'tests/functional/heketi/test_volume_multi_req.py') diff --git a/tests/functional/heketi/test_volume_multi_req.py b/tests/functional/heketi/test_volume_multi_req.py index 0c1b42ac..3fdc4381 100644 --- a/tests/functional/heketi/test_volume_multi_req.py +++ b/tests/functional/heketi/test_volume_multi_req.py @@ -3,6 +3,7 @@ import contextlib import random +import tempfile import threading import time @@ -94,15 +95,12 @@ def temp_config(ocp_node, cfg): Returns: str: A path to a temporary file. """ - conn = g.rpyc_get_connection(ocp_node, user="root") - tmp = conn.modules.tempfile.NamedTemporaryFile() - try: - tmp.write(yaml.safe_dump(cfg)) + with tempfile.NamedTemporaryFile() as tmp: + tmp.write(yaml.safe_dump(cfg).encode()) tmp.flush() filename = tmp.name + g.upload(ocp_node, filename, filename) yield filename - finally: - tmp.close() def wait_for_claim(ocp_node, pvc_name, timeout=60, interval=2): -- cgit