Skip to content

Commit

Permalink
Merge branch 'v2.11-beta3.1+fall2024' into 02_script_to_parsing_sdk_p…
Browse files Browse the repository at this point in the history
…ython_tests

* v2.11-beta3.1+fall2024:
  Fix data_model mapped volume
  [FIX] Force container removal at destroy (#143)
  [FIX] Handle Python test execution runtime errors (#145)

# Conflicts:
#	test_collections/matter/sdk_tests/support/python_testing/models/test_case.py
  • Loading branch information
hiltonlima committed Sep 19, 2024
2 parents ddfe5f5 + 9c1ef58 commit 0c6f9b1
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .version_information
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.11-beta3+fall2024
v2.11-beta3.1+fall2024
2 changes: 1 addition & 1 deletion app/container_manager/container_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async def create_container(
def destroy(self, container: Container) -> None:
if self.is_running(container):
container.kill()
container.remove()
container.remove(force=True)

def get_container(self, id_or_name: str) -> Optional[Container]:
try:
Expand Down
16 changes: 12 additions & 4 deletions test_collections/matter/sdk_tests/support/chip/chip_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,19 @@ async def stop(self) -> None:
if not self.__server_started:
return

self.sdk_container.send_command(
f'-SIGTERM -f "{self.__server_full_command}"', prefix="pkill"
)
try:
self.sdk_container.send_command(
f'-SIGTERM -f "{self.__server_full_command}"', prefix="pkill"
)
self.__wait_for_server_exit()
except Exception as e:
# Issue: https://github.com/project-chip/certification-tool/issues/414
self.logger.info(
"Could not get exit code after pkill command "
f"{self.__server_full_command}."
)
self.logger.debug(str(e))

self.__wait_for_server_exit()
self.__server_started = False

def trace_file_params(self, topic: str) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,22 @@ def get_test_info(script_path: str, class_name: str, config: MatterTestConfig):


def run_test(script_path: str, class_name: str, config: MatterTestConfig) -> None:
# For a script_path like 'custom/TC_XYZ' the module is 'custom.TC_XYZ'
module = importlib.import_module(script_path.replace("/", "."))
TestClassReference = getattr(module, class_name)

BaseManager.register(TestRunnerHooks.__name__)
manager = BaseManager(address=("0.0.0.0", 50000), authkey=b"abc")
manager.connect()
test_runner_hooks = manager.TestRunnerHooks() # shared object proxy # type: ignore

run_tests(TestClassReference, config, test_runner_hooks)
try:
# For a script_path like 'custom/TC_XYZ' the module is 'custom.TC_XYZ'
module = importlib.import_module(script_path.replace("/", "."))
TestClassReference = getattr(module, class_name)

run_tests(TestClassReference, config, test_runner_hooks)
except Exception as e:
test_runner_hooks.step_failure(
logger=None, logs=str(e), duration=0, request=None, received=None
)
test_runner_hooks.stop(duration=0)


def commission(config: MatterTestConfig) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ def step_success(self, logger: Any, logs: str, duration: int, request: Any) -> N
def step_failure(
self, logger: Any, logs: str, duration: int, request: Any, received: Any
) -> None:
self.mark_step_failure("Python test step failure")
failure_msg = "Python test step failure"
if logs:
failure_msg += f": {logs}"

self.mark_step_failure(failure_msg)
self.skip_to_last_step()

def step_unknown(self) -> None:
Expand Down
9 changes: 9 additions & 0 deletions test_collections/matter/sdk_tests/support/sdk_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
)
DOCKER_PYTHON_TESTING_PATH = "/root/python_testing"

MAPPED_DATA_MODEL_VOLUME = "mapped_data_model_volume"
DOCKER_DATA_MODEL_PATH = DOCKER_PYTHON_TESTING_PATH + "/data_model"



# RPC Client Running on SDK Container

Check failure on line 60 in test_collections/matter/sdk_tests/support/sdk_container.py

View workflow job for this annotation

GitHub Actions / Flake8

test_collections/matter/sdk_tests/support/sdk_container.py#L60

Too many blank lines (3) (E303)
LOCAL_RPC_PYTHON_TESTING_PATH = Path(
LOCAL_TEST_COLLECTIONS_PATH + "/sdk_tests/support/python_testing/models/rpc_client/"
Expand Down Expand Up @@ -108,6 +113,10 @@ class SDKContainer(metaclass=Singleton):
"bind": DOCKER_PYTHON_TESTING_PATH,
"mode": "rw",
},
MAPPED_DATA_MODEL_VOLUME: {
"bind": DOCKER_DATA_MODEL_PATH,
"mode": "rw",
},
LOCAL_RPC_PYTHON_TESTING_PATH: {
"bind": DOCKER_RPC_PYTHON_TESTING_PATH,
"mode": "rw",
Expand Down

0 comments on commit 0c6f9b1

Please sign in to comment.