blob: a731b5a85324c302a5c3fe300bfd5b3208deb1c5 [file] [log] [blame]
koder aka kdanilov70227062016-11-26 23:23:21 +02001from typing import List, Callable, Any, Dict, Optional, Set
koder aka kdanilov22d134e2016-11-08 11:33:19 +02002from concurrent.futures import ThreadPoolExecutor
3
4
5from .timeseries import SensorDatastore
koder aka kdanilov73084622016-11-16 21:51:08 +02006from .node_interfaces import NodeInfo, IRPCNode
koder aka kdanilov39e449e2016-12-17 15:15:26 +02007from .openstack_api import OSCreds, OSConnection
koder aka kdanilov3d2bc4f2016-11-12 18:31:18 +02008from .storage import Storage
koder aka kdanilov22d134e2016-11-08 11:33:19 +02009from .config import Config
koder aka kdanilov70227062016-11-26 23:23:21 +020010from .fuel_rest_api import Connection
koder aka kdanilov22d134e2016-11-08 11:33:19 +020011
12
koder aka kdanilov3b4da8b2016-10-17 00:17:53 +030013class TestRun:
14 """Test run information"""
koder aka kdanilov70227062016-11-26 23:23:21 +020015 def __init__(self, config: Config, storage: Storage) -> None:
koder aka kdanilov3b4da8b2016-10-17 00:17:53 +030016 # NodesInfo list
koder aka kdanilov3d2bc4f2016-11-12 18:31:18 +020017 self.nodes_info = [] # type: List[NodeInfo]
koder aka kdanilov3b4da8b2016-10-17 00:17:53 +030018
19 # Nodes list
koder aka kdanilov3d2bc4f2016-11-12 18:31:18 +020020 self.nodes = [] # type: List[IRPCNode]
koder aka kdanilov3b4da8b2016-10-17 00:17:53 +030021
koder aka kdanilov22d134e2016-11-08 11:33:19 +020022 self.build_meta = {} # type: Dict[str,Any]
23 self.clear_calls_stack = [] # type: List[Callable[['TestRun'], None]]
koder aka kdanilov3b4da8b2016-10-17 00:17:53 +030024
25 # openstack credentials
koder aka kdanilov22d134e2016-11-08 11:33:19 +020026 self.fuel_openstack_creds = None # type: Optional[OSCreds]
koder aka kdanilov39e449e2016-12-17 15:15:26 +020027 self.fuel_version = None # type: Optional[List[int]]
koder aka kdanilov3d2bc4f2016-11-12 18:31:18 +020028 self.os_creds = None # type: Optional[OSCreds]
koder aka kdanilov73084622016-11-16 21:51:08 +020029 self.os_connection = None # type: Optional[OSConnection]
koder aka kdanilov70227062016-11-26 23:23:21 +020030 self.fuel_conn = None # type: Optional[Connection]
31 self.rpc_code = None # type: bytes
koder aka kdanilove7e1a4d2016-12-17 20:29:52 +020032 self.default_rpc_plugins = None # type: Dict[str, bytes]
koder aka kdanilov3b4da8b2016-10-17 00:17:53 +030033
koder aka kdanilov22d134e2016-11-08 11:33:19 +020034 self.storage = storage
35 self.config = config
36 self.sensors_data = SensorDatastore()
koder aka kdanilov70227062016-11-26 23:23:21 +020037 self.sensors_run_on = set() # type: Set[str]
koder aka kdanilov39e449e2016-12-17 15:15:26 +020038 self.os_spawned_nodes_ids = None # type: List[int]
koder aka kdanilov22d134e2016-11-08 11:33:19 +020039
40 def get_pool(self):
41 return ThreadPoolExecutor(self.config.get('worker_pool_sz', 32))
koder aka kdanilov3b4da8b2016-10-17 00:17:53 +030042