diff --git a/tests/test_cli.py b/tests/test_cli.py index ae3059634..14f65b847 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -47,6 +47,7 @@ def gateway(config): with GatewayServer(config) as gateway: # Start gateway + gateway.set_group_id(0) gateway.serve() # Bind the client and Gateway diff --git a/tests/test_grpc.py b/tests/test_grpc.py index 428965d7e..95b6e9754 100644 --- a/tests/test_grpc.py +++ b/tests/test_grpc.py @@ -31,6 +31,7 @@ def check_resource_by_index(i, caplog): @pytest.mark.filterwarnings("error::pytest.PytestUnhandledThreadExceptionWarning") def test_create_get_subsys(caplog, config): with GatewayServer(config) as gateway: + gateway.set_group_id(0) gateway.serve() for i in range(created_resource_count): @@ -66,6 +67,7 @@ def test_create_get_subsys(caplog, config): # restart the gateway here with GatewayServer(config) as gateway: + gateway.set_group_id(0) gateway.serve() for i in range(subsys_list_count): diff --git a/tests/test_log_files.py b/tests/test_log_files.py index b84204997..1b8f0cb95 100644 --- a/tests/test_log_files.py +++ b/tests/test_log_files.py @@ -47,6 +47,7 @@ def gateway(config, request): with GatewayServer(config) as gateway: # Start gateway + gateway.set_group_id(0) gateway.serve() # Bind the client and Gateway diff --git a/tests/test_multi_gateway.py b/tests/test_multi_gateway.py index 1a6692d5a..b8bf8a505 100644 --- a/tests/test_multi_gateway.py +++ b/tests/test_multi_gateway.py @@ -19,18 +19,14 @@ def conn(config): configA.config["gateway"]["name"] = "GatewayA" configA.config["gateway"]["group"] = "Group1" configA.config["gateway"]["state_update_notify"] = str(update_notify) - configA.config["gateway"]["min_controller_id"] = "1" - configA.config["gateway"]["max_controller_id"] = "20000" configA.config["gateway"]["enable_spdk_discovery_controller"] = "True" configA.config["spdk"]["rpc_socket_name"] = "spdk_GatewayA.sock" configB = copy.deepcopy(configA) addr = configA.get("gateway", "addr") portA = configA.getint("gateway", "port") - portB = portA + 1 + portB = portA + 2 configB.config["gateway"]["name"] = "GatewayB" configB.config["gateway"]["port"] = str(portB) - configA.config["gateway"]["min_controller_id"] = "20001" - configA.config["gateway"]["max_controller_id"] = "40000" configB.config["gateway"]["state_update_interval_sec"] = str( update_interval_sec) configB.config["spdk"]["rpc_socket_name"] = "spdk_GatewayB.sock" @@ -41,10 +37,12 @@ def conn(config): GatewayServer(configA) as gatewayA, GatewayServer(configB) as gatewayB, ): + gatewayA.set_group_id(0) gatewayA.serve() # Delete existing OMAP state gatewayA.gateway_rpc.gateway_state.delete_state() # Create new + gatewayB.set_group_id(1) gatewayB.serve() # Bind the client and Gateways A & B diff --git a/tests/test_namespaces.py b/tests/test_namespaces.py index 53bd1bca2..ed388c7ea 100644 --- a/tests/test_namespaces.py +++ b/tests/test_namespaces.py @@ -26,18 +26,14 @@ def conn(config): configA.config["gateway"]["name"] = "GatewayA" configA.config["gateway"]["group"] = "Group1" configA.config["gateway"]["state_update_notify"] = str(update_notify) - configA.config["gateway"]["min_controller_id"] = "1" - configA.config["gateway"]["max_controller_id"] = "20000" configA.config["gateway"]["enable_spdk_discovery_controller"] = "True" configA.config["spdk"]["rpc_socket_name"] = "spdk_GatewayA.sock" configB = copy.deepcopy(configA) addr = configA.get("gateway", "addr") portA = configA.getint("gateway", "port") - portB = portA + 1 + portB = portA + 2 configB.config["gateway"]["name"] = "GatewayB" configB.config["gateway"]["port"] = str(portB) - configA.config["gateway"]["min_controller_id"] = "20001" - configA.config["gateway"]["max_controller_id"] = "40000" configB.config["gateway"]["state_update_interval_sec"] = str( update_interval_sec) configB.config["spdk"]["rpc_socket_name"] = "spdk_GatewayB.sock" @@ -48,10 +44,12 @@ def conn(config): GatewayServer(configA) as gatewayA, GatewayServer(configB) as gatewayB, ): + gatewayA.set_group_id(0) gatewayA.serve() # Delete existing OMAP state gatewayA.gateway_rpc.gateway_state.delete_state() # Create new + gatewayB.set_group_id(1) gatewayB.serve() # Bind the client and Gateways A & B diff --git a/tests/test_nsid.py b/tests/test_nsid.py index 39c629eaf..c0d19402c 100644 --- a/tests/test_nsid.py +++ b/tests/test_nsid.py @@ -30,7 +30,7 @@ def setup_config(config, gw1_name, gw2_name, gw_group, update_notify, update_int configB = copy.deepcopy(configA) portA = configA.getint("gateway", "port") configA.config["gateway"]["port"] = str(portA) - portB = portA + 1 + portB = portA + 2 configB.config["gateway"]["name"] = gw2_name configB.config["gateway"]["port"] = str(portB) configB.config["spdk"]["rpc_socket_name"] = sock2_name @@ -39,10 +39,12 @@ def setup_config(config, gw1_name, gw2_name, gw_group, update_notify, update_int return configA, configB def start_servers(gatewayA, gatewayB, addr, portA, portB): + gatewayA.set_group_id(0) gatewayA.serve() # Delete existing OMAP state gatewayA.gateway_rpc.gateway_state.delete_state() # Create new + gatewayB.set_group_id(1) gatewayB.serve() gatewayB.gateway_rpc.gateway_state.delete_state() @@ -142,6 +144,7 @@ def test_multi_gateway_namespace_ids(config, image, caplog): assert False gatewayB.__exit__(None, None, None) gatewayB = GatewayServer(configB) + gatewayB.set_group_id(1) gatewayB.serve() channelB = grpc.insecure_channel(f"{addr}:{portB}") stubB = pb2_grpc.GatewayStub(channelB) diff --git a/tests/test_old_omap.py b/tests/test_old_omap.py index 8d21bf3c9..e55f7ac9f 100644 --- a/tests/test_old_omap.py +++ b/tests/test_old_omap.py @@ -5,11 +5,13 @@ def test_old_omap(caplog, config): with GatewayServer(config) as gateway: + gateway.set_group_id(0) gateway.serve() gateway.gateway_rpc.gateway_state.omap._add_key("bdev_dummy", "dummy") caplog.clear() with GatewayServer(config) as gateway: with pytest.raises(Exception) as ex: + gateway.set_group_id(0) gateway.serve() assert f"Old OMAP file format, still contains bdevs, please remove file and try again" in str(ex.value) diff --git a/tests/test_omap_lock.py b/tests/test_omap_lock.py index d4d3e634d..10a032124 100644 --- a/tests/test_omap_lock.py +++ b/tests/test_omap_lock.py @@ -40,10 +40,12 @@ def setup_config(config, gw1_name, gw2_name, gw_group, update_notify ,update_int return configA, configB def start_servers(gatewayA, gatewayB, addr, portA, portB): + gatewayA.set_group_id(0) gatewayA.serve() # Delete existing OMAP state gatewayA.gateway_rpc.gateway_state.delete_state() # Create new + gatewayB.set_group_id(1) gatewayB.serve() gatewayB.gateway_rpc.gateway_state.delete_state() diff --git a/tests/test_server.py b/tests/test_server.py index cd1997499..e10cdb47d 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -34,12 +34,14 @@ def test_spdk_exception(self): with self.assertRaises(SystemExit) as cm: with GatewayServer(config_spdk_exception) as gateway: + gateway.set_group_id(0) gateway.serve() self.validate_exception(cm.exception) def test_spdk_abort(self): """Tests spdk sub process dumps core on during normal shutdown.""" with GatewayServer(copy.deepcopy(self.config)) as gateway: + gateway.set_group_id(0) gateway.serve() time.sleep(10) # exited context, spdk process should be aborted here by __exit__() @@ -64,7 +66,9 @@ def test_spdk_multi_gateway_exception(self): GatewayServer(configA) as gatewayA, GatewayServer(configB) as gatewayB, ): + gatewayA.set_group_id(0) gatewayA.serve() + gatewayB.set_group_id(1) gatewayB.serve() self.validate_exception(cm.exception)