|
10 | 10 | # |
11 | 11 | # SPDX-License-Identifier: Apache-2.0 |
12 | 12 | # ******************************************************************************* |
13 | | -from itf.plugins.com.ssh import execute_command |
| 13 | +from itf.plugins.com.ping import ping |
| 14 | +from itf.plugins.com.ssh import execute_command_output |
14 | 15 |
|
15 | 16 |
|
16 | 17 | def test_ssh_with_default_user(target_fixture): |
17 | 18 | with target_fixture.sut.ssh() as ssh: |
18 | | - execute_command(ssh, "echo 'Username:' $USER && uname -a") |
| 19 | + exit_code, stdout, stderr = execute_command_output( |
| 20 | + ssh, "echo 'Username:' $USER && uname -a" |
| 21 | + ) |
| 22 | + assert exit_code == 0, "SSH command failed" |
| 23 | + assert "Username: root" in stdout[0], "Expected username not found in output" |
| 24 | + assert "QNX Qnx_S-core 8.0.0" in stdout[1], ( |
| 25 | + "Expected QNX kernel information not found in output" |
| 26 | + ) |
| 27 | + assert stderr == [], "Expected no error output" |
19 | 28 |
|
20 | 29 |
|
21 | 30 | def test_ssh_with_qnx_user(target_fixture): |
22 | | - with target_fixture.sut.ssh(username="qnxuser") as ssh: |
23 | | - execute_command(ssh, "echo 'Username:' $USER && uname -a") |
| 31 | + user = "qnxuser" |
| 32 | + with target_fixture.sut.ssh(username=user) as ssh: |
| 33 | + exit_code, stdout, stderr = execute_command_output( |
| 34 | + ssh, "echo 'Username:' $USER && uname -a" |
| 35 | + ) |
| 36 | + assert exit_code == 0, "SSH command failed" |
| 37 | + assert f"Username: {user}" in stdout[0], "Expected username not found in output" |
| 38 | + assert "QNX Qnx_S-core 8.0.0" in stdout[1], ( |
| 39 | + "Expected QNX kernel information not found in output" |
| 40 | + ) |
| 41 | + assert stderr == [], "Expected no error output" |
| 42 | + |
| 43 | + |
| 44 | +def test_ping_ok(target_fixture): |
| 45 | + is_reachable = ping(target_fixture.sut.ip_address) |
| 46 | + assert is_reachable, "QNX Target is not reachable via ping" |
0 commit comments