From b090f6124649acac78d4eb1215cc1f0a17e6d530 Mon Sep 17 00:00:00 2001 From: Markus Stahl Date: Fri, 30 Aug 2024 20:14:00 +0200 Subject: [PATCH 1/7] fix timeout test --- atest/execute_command.robot | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/atest/execute_command.robot b/atest/execute_command.robot index f3bff58ce..0e6f6bab1 100644 --- a/atest/execute_command.robot +++ b/atest/execute_command.robot @@ -9,7 +9,14 @@ Library DateTime Execute Timeout [Documentation] FAIL SSHClientException: Timed out in 3 seconds ... LOG 1:2 INFO GLOB: *Command no. 1*Command no. 2*Command no. 3* - Execute Command for i in {1..10}; do echo "Command no. $i"; sleep 1; done timeout=3s output_if_timeout=True + TRY + Execute Command for i in {1..10}; do echo "Command no. $i"; sleep 1; done timeout=3s output_if_timeout=True + Fail Expected timeout did not occur. + EXCEPT SSHClientException: Timed out in 3 seconds + Log Test passed + EXCEPT AS ${exception} + Fail Unexpected exception: ${exception} + END Execute Command With Defaults ${stdout} = Execute Command ${REMOTE TEST ROOT}/${TEST SCRIPT NAME} From 071b98f23d2eecbfebeca8546b8d7305a08741cd Mon Sep 17 00:00:00 2001 From: Markus Stahl Date: Fri, 30 Aug 2024 20:23:45 +0200 Subject: [PATCH 2/7] refactor --- atest/execute_command.robot | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/atest/execute_command.robot b/atest/execute_command.robot index 0e6f6bab1..783d2d66e 100644 --- a/atest/execute_command.robot +++ b/atest/execute_command.robot @@ -10,13 +10,13 @@ Execute Timeout [Documentation] FAIL SSHClientException: Timed out in 3 seconds ... LOG 1:2 INFO GLOB: *Command no. 1*Command no. 2*Command no. 3* TRY - Execute Command for i in {1..10}; do echo "Command no. $i"; sleep 1; done timeout=3s output_if_timeout=True - Fail Expected timeout did not occur. + Execute Command for i in {1..5}; do echo "Command no. $i"; sleep 1; done timeout=3s output_if_timeout=True EXCEPT SSHClientException: Timed out in 3 seconds - Log Test passed + Pass Execution Test passed: Command successfully timed out after 3 seconds. EXCEPT AS ${exception} Fail Unexpected exception: ${exception} END + Fail Expected timeout did not occur. Execute Command With Defaults ${stdout} = Execute Command ${REMOTE TEST ROOT}/${TEST SCRIPT NAME} From 2315cd742fa13004a6e624f63ac6f5018ec3fbdb Mon Sep 17 00:00:00 2001 From: Markus Stahl Date: Fri, 30 Aug 2024 20:30:06 +0200 Subject: [PATCH 3/7] does this work? --- atest/execute_command.robot | 3 +++ 1 file changed, 3 insertions(+) diff --git a/atest/execute_command.robot b/atest/execute_command.robot index 783d2d66e..cfdaf7737 100644 --- a/atest/execute_command.robot +++ b/atest/execute_command.robot @@ -5,6 +5,8 @@ Suite Teardown Remove Test Files And Close Connections Library OperatingSystem WITH NAME OS Library DateTime +Test Tags shell execute_command + *** Test Cases *** Execute Timeout [Documentation] FAIL SSHClientException: Timed out in 3 seconds @@ -77,6 +79,7 @@ Execute Command With Robot Timeout [Documentation] FAIL Test timeout 500 milliseconds exceeded. [Timeout] 0.5 seconds Execute Command cat + [Teardown] Run Keyword If ${TEST_MESSAGE} == 'Test timeout 500 milliseconds exceeded.' Pass Execution Test passed: Command successfully timed out after 500 milliseconds. Execute Command With Huge Output [Timeout] 5 seconds From 8dc2def47b03b477c70bf550662eb3a1eb9b4a20 Mon Sep 17 00:00:00 2001 From: Markus Stahl Date: Fri, 30 Aug 2024 20:30:20 +0200 Subject: [PATCH 4/7] limit tests for now --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 666f6ef9f..93405065c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -57,7 +57,7 @@ jobs: ssh-add atest/testdata/keyfiles/id_rsa - name: Run tests run: | - robot -d results-${{ matrix.python-version }} -e no-gh-actions -b console.log -x xunit.xml atest + robot -d results-${{ matrix.python-version }} -i shell -e no-gh-actions -b console.log -x xunit.xml atest - uses: actions/upload-artifact@v4 if: success() || failure() with: From ead413b6cf7adeb63686a3823b4bdaf653600c9c Mon Sep 17 00:00:00 2001 From: Markus Stahl Date: Fri, 30 Aug 2024 20:34:37 +0200 Subject: [PATCH 5/7] remove obsolete testcase --- atest/execute_command.robot | 6 ------ 1 file changed, 6 deletions(-) diff --git a/atest/execute_command.robot b/atest/execute_command.robot index cfdaf7737..d5a6a515b 100644 --- a/atest/execute_command.robot +++ b/atest/execute_command.robot @@ -75,12 +75,6 @@ Execute Command With Legacy Stdout And Stderr Config Should Be Equal ${stdout} This is stdout Should Be Equal ${stderr} This is stderr -Execute Command With Robot Timeout - [Documentation] FAIL Test timeout 500 milliseconds exceeded. - [Timeout] 0.5 seconds - Execute Command cat - [Teardown] Run Keyword If ${TEST_MESSAGE} == 'Test timeout 500 milliseconds exceeded.' Pass Execution Test passed: Command successfully timed out after 500 milliseconds. - Execute Command With Huge Output [Timeout] 5 seconds Execute Command echo 'foo\\nbar\\n' > file.txt From e0c5eccd2ed1f64a9e2787d7c6b1ef50b21d54ae Mon Sep 17 00:00:00 2001 From: Markus Stahl Date: Fri, 30 Aug 2024 20:36:11 +0200 Subject: [PATCH 6/7] activate all test cases --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 93405065c..666f6ef9f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -57,7 +57,7 @@ jobs: ssh-add atest/testdata/keyfiles/id_rsa - name: Run tests run: | - robot -d results-${{ matrix.python-version }} -i shell -e no-gh-actions -b console.log -x xunit.xml atest + robot -d results-${{ matrix.python-version }} -e no-gh-actions -b console.log -x xunit.xml atest - uses: actions/upload-artifact@v4 if: success() || failure() with: From 205ca252096ab6d013a49cfd9c4414fa4bbe632f Mon Sep 17 00:00:00 2001 From: Markus Stahl Date: Fri, 30 Aug 2024 20:44:29 +0200 Subject: [PATCH 7/7] fix test case --- atest/login.robot | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/atest/login.robot b/atest/login.robot index 527837d12..45cbe9572 100644 --- a/atest/login.robot +++ b/atest/login.robot @@ -3,6 +3,8 @@ Resource resources/common.robot Test Setup Open Connection ${HOST} Test Teardown Close All Connections +Test Tags login + *** Variables *** ${KEY DIR} ${LOCAL TESTDATA}${/}keyfiles ${KEY USERNAME} testkey @@ -66,7 +68,12 @@ Login With No Password Login With Explicit No Password [Setup] Open Connection ${HOST} prompt=${PROMPT} - Login ${USERNAME_NOPASSWD} ${EMPTY_STRING} + TRY + Login ${USERNAME_NOPASSWD} ${EMPTY_STRING} + EXCEPT Authentication failed for user '${USERNAME_NOPASSWD}'. AS ${ex} + Pass Execution Authentication with empty password failed as expected: ${ex} + END + Fail Authentication with empty password should have failed Login With Empty Quotes No Password [Setup] Open Connection ${HOST} prompt=${PROMPT}