Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed checking for valid arguments for python tests execution #44

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion default_test_environment.config
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"pairing_mode":"onnetwork",
"setup_code":"20202021",
"discriminator":"3840",
"endpoint_id":"0",
"chip_tool_use_paa_certs":false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

from app.schemas.test_environment_config import TestEnvironmentConfig
from app.test_engine.logger import PYTHON_TEST_LEVEL
from app.test_engine.logger import test_engine_logger as logger

# Command line params
RUNNER_CLASS_PATH = "/root/python_testing/test_harness_client.py"
Expand All @@ -32,31 +31,6 @@
def generate_command_arguments(
config: TestEnvironmentConfig, omit_commissioning_method: bool = False
) -> list:
# All valid arguments for python test
valid_args = [
"ble_interface_id",
"commissioning_method",
"controller_node_id",
"discriminator",
"endpoint",
"logs_path",
"PICS",
"paa_trust_store_path",
"timeout",
"trace_to",
"int_arg",
"float_arg",
"string_arg",
"json_arg",
"hex_arg",
"bool_arg",
"storage_path",
"passcode",
"dut_node_id",
"qr_code",
"manual_code",
]

dut_config = config.dut_config
test_parameters = config.test_parameters

Expand All @@ -76,13 +50,7 @@ def generate_command_arguments(
# Retrieve arguments from test_parameters
if test_parameters:
for name, value in test_parameters.items():
if name in valid_args:
if str(value) != "":
arguments.append(f"--{name.replace('_','-')} {str(value)}")
else:
arguments.append(f"--{name.replace('_','-')} " "")
else:
logger.warning(f"Argument {name} is not valid")
arguments.append(f"--{name} {str(value)}")

return arguments

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ async def test_generate_command_arguments_on_network() -> None:
# Mock config
mock_config = default_environment_config.copy(deep=True)

# Using attributes with both - and _ word separators in test_parameters
# Both must be considered as python test arguments the way it was configured
mock_config.test_parameters = {
"paa_trust_store_path": "/paa-root-certs",
"paa-trust-store-path": "/paa-root-certs",
"storage_path": "/root/admin_storage.json",
}

Expand All @@ -49,7 +51,7 @@ async def test_generate_command_arguments_on_network() -> None:
"--passcode 1234",
"--commissioning-method on-network",
"--paa-trust-store-path /paa-root-certs",
"--storage-path /root/admin_storage.json",
"--storage_path /root/admin_storage.json",
hiltonlima marked this conversation as resolved.
Show resolved Hide resolved
] == arguments


Expand All @@ -59,7 +61,7 @@ async def test_generate_command_arguments_ble_wifi() -> None:
mock_config = default_environment_config.copy(deep=True)

mock_config.test_parameters = {
"paa_trust_store_path": "/paa-root-certs",
"paa-trust-store-path": "/paa-root-certs",
"storage_path": "/root/admin_storage.json",
}

Expand All @@ -80,7 +82,7 @@ async def test_generate_command_arguments_ble_wifi() -> None:
"--passcode 357",
"--commissioning-method ble-wifi",
"--paa-trust-store-path /paa-root-certs",
"--storage-path /root/admin_storage.json",
"--storage_path /root/admin_storage.json",
] == arguments


Expand All @@ -90,7 +92,7 @@ async def test_generate_command_arguments_ble_thread() -> None:
mock_config = default_environment_config.copy(deep=True)

mock_config.test_parameters = {
"paa_trust_store_path": "/paa-root-certs",
"paa-trust-store-path": "/paa-root-certs",
"storage_path": "/root/admin_storage.json",
}

Expand All @@ -110,7 +112,7 @@ async def test_generate_command_arguments_ble_thread() -> None:
"--passcode 8765",
"--commissioning-method ble-thread",
"--paa-trust-store-path /paa-root-certs",
"--storage-path /root/admin_storage.json",
"--storage_path /root/admin_storage.json",
] == arguments


Expand Down
Loading