Move linux command and wait method to common tools
Signed-off-by: Katarzyna Treder <katarzyna.treder@h-partners.com>
This commit is contained in:
		| @@ -14,7 +14,7 @@ from core.test_run import TestRun | ||||
| from storage_devices.device import Device | ||||
| from test_tools import disk_utils, fs_utils, nvme_cli | ||||
| from test_utils import disk_finder | ||||
| from test_utils.os_utils import wait | ||||
| from test_tools.common.wait import wait | ||||
| from connection.utils.output import Output | ||||
| from types.size import Unit | ||||
|  | ||||
|   | ||||
							
								
								
									
										0
									
								
								test_tools/common/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								test_tools/common/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										20
									
								
								test_tools/common/wait.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								test_tools/common/wait.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| # | ||||
| # Copyright(c) 2019-2022 Intel Corporation | ||||
| # Copyright(c) 2024 Huawei Technologies Co., Ltd. | ||||
| # SPDX-License-Identifier: BSD-3-Clause | ||||
| # | ||||
|  | ||||
| import time | ||||
| from datetime import timedelta, datetime | ||||
|  | ||||
|  | ||||
| def wait(predicate, timeout: timedelta, interval: timedelta = None): | ||||
|     start_time = datetime.now() | ||||
|     result = False | ||||
|     while start_time + timeout > datetime.now(): | ||||
|         result = predicate() | ||||
|         if result: | ||||
|             break | ||||
|         if interval is not None: | ||||
|             time.sleep(interval.total_seconds()) | ||||
|     return result | ||||
| @@ -3,7 +3,7 @@ | ||||
| # SPDX-License-Identifier: BSD-3-Clause | ||||
| # | ||||
|  | ||||
| import test_utils.linux_command as linux_comm | ||||
| import test_tools.common.linux_command as linux_comm | ||||
| import types.size as size | ||||
| from core.test_run import TestRun | ||||
|  | ||||
|   | ||||
| @@ -3,7 +3,7 @@ | ||||
| # SPDX-License-Identifier: BSD-3-Clause | ||||
| # | ||||
|  | ||||
| import test_utils.linux_command as linux_comm | ||||
| import test_tools.common.linux_command as linux_comm | ||||
| import types.size as size | ||||
| from core.test_run import TestRun | ||||
|  | ||||
|   | ||||
| @@ -8,7 +8,7 @@ from enum import Enum | ||||
|  | ||||
| from core.test_run import TestRun | ||||
| from storage_devices.device import Device | ||||
| from test_utils.linux_command import LinuxCommand | ||||
| from test_tools.common.linux_command import LinuxCommand | ||||
| from types.size import Size, Unit | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -13,7 +13,7 @@ from connection.base_executor import BaseExecutor | ||||
| from core.test_run import TestRun | ||||
| from storage_devices.device import Device | ||||
| from test_tools.fio.fio_result import FioResult | ||||
| from test_utils.linux_command import LinuxCommand | ||||
| from test_tools.common.linux_command import LinuxCommand | ||||
| from types.size import Size | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -9,7 +9,7 @@ import posixpath | ||||
| import re | ||||
| import time | ||||
|  | ||||
| from datetime import timedelta, datetime | ||||
| from datetime import timedelta | ||||
| from enum import IntFlag, Enum, IntEnum, StrEnum | ||||
| from packaging import version | ||||
| from typing import List | ||||
| @@ -422,18 +422,6 @@ def kill_all_io(graceful=True): | ||||
|         raise Exception(f"Failed to stop vdbench!") | ||||
|  | ||||
|  | ||||
| def wait(predicate, timeout: timedelta, interval: timedelta = None): | ||||
|     start_time = datetime.now() | ||||
|     result = False | ||||
|     while start_time + timeout > datetime.now(): | ||||
|         result = predicate() | ||||
|         if result: | ||||
|             break | ||||
|         if interval is not None: | ||||
|             time.sleep(interval.total_seconds()) | ||||
|     return result | ||||
|  | ||||
|  | ||||
| def sync(): | ||||
|     TestRun.executor.run_expect_success("sync") | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Katarzyna Treder
					Katarzyna Treder