diff --git a/tests/functional/nfs_feature/test_nfs_feature_enable_for_ODF_clusters.py b/tests/functional/nfs_feature/test_nfs_feature_enable_for_ODF_clusters.py index 37d52f91ea0b..60d2312e935e 100644 --- a/tests/functional/nfs_feature/test_nfs_feature_enable_for_ODF_clusters.py +++ b/tests/functional/nfs_feature/test_nfs_feature_enable_for_ODF_clusters.py @@ -120,7 +120,6 @@ def setup_teardown(self, request): 6:- Delete ocs nfs Service """ - self.__nfs_client_connection = None self = request.node.cls log.info("-----Setup-----") self.namespace = "openshift-storage" @@ -207,7 +206,9 @@ def con(self): or not self.__nfs_client_connection ): try: - self.__nfs_client_connection = self.get_nfs_client_connection() + self.__nfs_client_connection = self.get_nfs_client_connection( + re_try=False + ) except (TimeoutError, socket.gaierror): nfs_client_vm_cloud = config.ENV_DATA.get("nfs_client_vm_cloud") nfs_client_vm_name = config.ENV_DATA.get("nfs_client_vm_name") @@ -218,17 +219,22 @@ def con(self): self.__nfs_client_connection = self.get_nfs_client_connection() return self.__nfs_client_connection - @retry((TimeoutError, socket.gaierror), tries=10, delay=60, backoff=1) - def get_nfs_client_connection(self): + def get_nfs_client_connection(self, re_try=True): """ Create connection to NFS Client VM. """ - log.info("Login to test vm") - return Connection( - self.nfs_client_ip, - self.nfs_client_user, - private_key=self.nfs_client_private_key, - ) + log.info("Connecting to nfs client test VM") + tries = 3 if re_try else 1 + + @retry((TimeoutError, socket.gaierror), tries=tries, delay=60, backoff=1) + def __make_connection(): + return Connection( + self.nfs_client_ip, + self.nfs_client_user, + private_key=self.nfs_client_private_key, + ) + + return __make_connection() @tier1 @polarion_id("OCS-4269")