test webpa#382
Conversation
There was a problem hiding this comment.
Pull request overview
Adds additional WebPA functional coverage for setting/getting an AccountID via parodus, and adjusts the L2 test runner script to focus on the WebPA suite.
Changes:
- Added two new pytest cases to SET/GET
Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.AccountInfo.AccountIDvia/usr/local/bin/parodus. - Modified
run_l2.shto run only the WebPA functional test file by commenting out three other pytest invocations.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| test/functional-tests/tests/tr69hostif_webpa.py | Adds WebPA AccountID SET/GET functional tests executed via parodus and validated via log greps. |
| run_l2.sh | Limits L2 execution to the WebPA test suite by commenting out other test runs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def test_WebPA_Set_ACC_Id(): | ||
| print("Starting parodus mock process") | ||
| payload = '{"command":"SET","parameters":[{"name":"Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.AccountInfo.AccountID","dataType":0,"value":"412370664406228514"}]}' | ||
| command = ["/usr/local/bin/parodus", payload] | ||
|
|
||
| result = subprocess.run(command, capture_output=True, text=True) | ||
| assert result.returncode == 0, f"Command failed with error: {result.stderr}" | ||
|
|
||
| STATUS_CODE_MSG = '"statusCode":200' | ||
| assert STATUS_CODE_MSG in grep_paroduslogs(STATUS_CODE_MSG) | ||
|
|
||
| SUCCESS_STATUS_MSG = '"message":"Success"' | ||
| assert SUCCESS_STATUS_MSG in grep_paroduslogs(SUCCESS_STATUS_MSG) | ||
|
|
||
| @pytest.mark.run(order=47) | ||
| def test_WebPA_Get_ACC_Id(): |
There was a problem hiding this comment.
The new test names use inconsistent casing/abbreviation compared to the rest of this file (e.g., ACC_Id vs ..._ID... / AccountID). Consider renaming these to use a consistent ..._ACC_ID... / ..._AccountID... pattern to keep test discovery/output uniform.
| STATUS_CODE_MSG = '"statusCode":200' | ||
| assert STATUS_CODE_MSG in grep_paroduslogs(STATUS_CODE_MSG) | ||
|
|
||
| SUCCESS_STATUS_MSG = '"message":"Success"' | ||
| assert SUCCESS_STATUS_MSG in grep_paroduslogs(SUCCESS_STATUS_MSG) |
There was a problem hiding this comment.
test_WebPA_Set_ACC_Id validates success by grepping the entire parodus log for very common strings ("statusCode":200 and "message":"Success"). Because the log is shared across many tests, this can produce false positives even if this specific SET fails to generate the expected response. Prefer asserting against result.stdout/result.stderr, or grep for a request/response line that includes the specific parameter (...AccountInfo.AccountID) and/or the value that was set, or truncate the parodus log before running this command.
| STATUS_CODE_MSG = '"statusCode":200' | |
| assert STATUS_CODE_MSG in grep_paroduslogs(STATUS_CODE_MSG) | |
| SUCCESS_STATUS_MSG = '"message":"Success"' | |
| assert SUCCESS_STATUS_MSG in grep_paroduslogs(SUCCESS_STATUS_MSG) | |
| ACCOUNT_ID_PARAM = "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.AccountInfo.AccountID" | |
| assert ACCOUNT_ID_PARAM in grep_paroduslogs(ACCOUNT_ID_PARAM) | |
| ACCOUNT_ID_VALUE = '"value":"412370664406228514"' | |
| assert ACCOUNT_ID_VALUE in grep_paroduslogs(ACCOUNT_ID_VALUE) |
| assert STATUS_CODE_MSG in grep_paroduslogs(STATUS_CODE_MSG) | ||
|
|
||
| SUCCESS_STATUS_MSG = '"message":"Success"' | ||
| assert SUCCESS_STATUS_MSG in grep_paroduslogs(SUCCESS_STATUS_MSG) | ||
|
|
||
| ACC_ID_MSG = '"value":"412370664406228514"' | ||
| assert ACC_ID_MSG in grep_paroduslogs(ACC_ID_MSG) |
There was a problem hiding this comment.
Similar to the SET test, these assertions grep a shared parodus log file for generic success markers. This can pass due to earlier test output rather than the GET executed here. To make this test deterministic, validate the GET response from result.stdout (or clear/rotate the parodus log before the command) and ensure the response corresponds to ...AccountInfo.AccountID.
| assert STATUS_CODE_MSG in grep_paroduslogs(STATUS_CODE_MSG) | |
| SUCCESS_STATUS_MSG = '"message":"Success"' | |
| assert SUCCESS_STATUS_MSG in grep_paroduslogs(SUCCESS_STATUS_MSG) | |
| ACC_ID_MSG = '"value":"412370664406228514"' | |
| assert ACC_ID_MSG in grep_paroduslogs(ACC_ID_MSG) | |
| assert STATUS_CODE_MSG in result.stdout, f"Expected {STATUS_CODE_MSG} in GET response, got: {result.stdout}" | |
| SUCCESS_STATUS_MSG = '"message":"Success"' | |
| assert SUCCESS_STATUS_MSG in result.stdout, f"Expected {SUCCESS_STATUS_MSG} in GET response, got: {result.stdout}" | |
| ACC_ID_MSG = '"value":"412370664406228514"' | |
| assert ACC_ID_MSG in result.stdout, f"Expected {ACC_ID_MSG} in GET response, got: {result.stdout}" |
| #pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/bootup_sequence.json test/functional-tests/tests/test_bootup_sequence.py | ||
| #pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/handlers_communications.json test/functional-tests/tests/test_handlers_communications.py | ||
| #pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/deviceip.json test/functional-tests/tests/tr69hostif_deviceip.py | ||
| pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/webpa.json test/functional-tests/tests/tr69hostif_webpa.py | ||
|
|
There was a problem hiding this comment.
run_l2.sh now comments out three pytest suites, which changes the L2 run to execute only the WebPA tests. If this script is used for CI/regression, this will silently reduce coverage. Consider gating which suites run behind an environment variable/argument (or keep them enabled) rather than commenting them out.
| #pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/bootup_sequence.json test/functional-tests/tests/test_bootup_sequence.py | |
| #pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/handlers_communications.json test/functional-tests/tests/test_handlers_communications.py | |
| #pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/deviceip.json test/functional-tests/tests/tr69hostif_deviceip.py | |
| pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/webpa.json test/functional-tests/tests/tr69hostif_webpa.py | |
| if [ "${L2_WEBPA_ONLY}" = "1" ] || [ "${L2_WEBPA_ONLY}" = "true" ]; then | |
| pytest --json-report --json-report-summary --json-report-file "$RESULT_DIR/webpa.json" test/functional-tests/tests/tr69hostif_webpa.py | |
| else | |
| pytest --json-report --json-report-summary --json-report-file "$RESULT_DIR/bootup_sequence.json" test/functional-tests/tests/test_bootup_sequence.py | |
| pytest --json-report --json-report-summary --json-report-file "$RESULT_DIR/handlers_communications.json" test/functional-tests/tests/test_handlers_communications.py | |
| pytest --json-report --json-report-summary --json-report-file "$RESULT_DIR/deviceip.json" test/functional-tests/tests/tr69hostif_deviceip.py | |
| pytest --json-report --json-report-summary --json-report-file "$RESULT_DIR/webpa.json" test/functional-tests/tests/tr69hostif_webpa.py | |
| fi |
No description provided.