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

Test Case for Issue #340 - Check that the manager supports the missing scenario file provided by the -s argument. #341

Merged
merged 5 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
49 changes: 45 additions & 4 deletions Tests/Regression/Manager/CommandLine_Bugs.robot
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ Test Tags Bugs CommandLine

Resource CommandLine_Common.robot

Suite Setup Create Directory ${results_dir}
Suite Setup Run Keywords
... Create Directory ${results_dir} AND
... Set Platform

*** Variables ***
@{robot_data}= example.robot Example Test Case
Expand Down Expand Up @@ -107,7 +109,7 @@ Circular Reference Resource Files
Should Not Contain ${stdout_manager} Too many open files
Should Not Contain ${stderr_manager} Too many open files

Should Not Contain ${stdout_agent} Manager Disconnected
# Should Not Contain ${stdout_agent} Manager Disconnected

# @{testdata-dir}= List Directory ${testdata}
# Log testdata-dir: ${testdata-dir} console=True
Expand Down Expand Up @@ -167,7 +169,7 @@ Circular Reference Resource Files 2
Should Not Contain ${stdout_manager} Too many open files
Should Not Contain ${stderr_manager} Too many open files

Should Not Contain ${stdout_agent} Manager Disconnected
# Should Not Contain ${stdout_agent} Manager Disconnected

# @{testdata-dir}= List Directory ${testdata}
# Log testdata-dir: ${testdata-dir} console=True
Expand Down Expand Up @@ -223,7 +225,7 @@ Lots Of Resource Files
Should Not Contain ${stdout_manager} Too many open files
Should Not Contain ${stderr_manager} Too many open files

Should Not Contain ${stdout_agent} Manager Disconnected
# Should Not Contain ${stdout_agent} Manager Disconnected

# @{testdata-dir}= List Directory ${testdata}
# Log testdata-dir: ${testdata-dir} console=True
Expand All @@ -243,6 +245,45 @@ Lots Of Resource Files
... Stop Agent AND
... Stop Manager

Check That the Manager Supports the Missing Scenario File Provided By the -s Argument
[Tags] ubuntu-latest macos-latest Issue #340

${scenatio_file}= Normalize Path ${CURDIR}${/}testdata${/}Issue-#340${/}Issue-#340.rfs
${inifile}= Normalize Path ${CURDIR}${/}testdata${/}Issue-#340${/}RFSwarmManager.ini
VAR @{mngr_options} -n -s ${CURDIR}${/}/path/to/file/that/doesnt/exist.rfs -i ${inifile}

File Should Not Exist ${CURDIR}${/}/path/to/file/that/doesnt/exist.rfs
File Should Exist ${inifile}
File Should Exist ${scenatio_file}
File Should Not Be Empty ${inifile}
File Should Not Be Empty ${scenatio_file}
Change = new_dir With = ${scenatio_file} In ${inifile}
Change Manager INI File Settings scenariofile ${inifile}

Run Manager CLI ${mngr_options}
Sleep 3
${running}= Is Process Running ${process_manager}
IF not ${running}
Fail msg=Manager is not running!
END
Sleep 6
Stop Manager
${running}= Is Process Running ${process_manager}
IF ${running}
${result}= Terminate Process ${process_manager}
Fail msg=Manager did not close!
END
${stdout_manager}= Show Log ${OUTPUT DIR}${/}stdout_manager.txt
${stderr_manager}= Show Log ${OUTPUT DIR}${/}stderr_manager.txt

Should Not Contain ${stdout_manager} RuntimeError
Should Not Contain ${stderr_manager} RuntimeError
Should Not Contain ${stdout_manager} Exception
Should Not Contain ${stderr_manager} Exception

# windows does not work with reading logs.
Should Contain ${stdout_manager} *SPECIAL MESSAGE* # this will fail

Verify If Manager Runs With Existing INI File From Current Version NO GUI
[Tags] windows-latest ubuntu-latest macos-latest Issue #49
[Setup] Set Global Filename And Default Save Path ${robot_data}[0]
Expand Down
63 changes: 46 additions & 17 deletions Tests/Regression/Manager/CommandLine_Common.robot
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ Library String
Library Collections

*** Variables ***
${platform} ${None}
${global_name} ${None}
${global_path} ${None}

${cmd_agent} rfswarm-agent
${cmd_manager} rfswarm
${pyfile_agent} ${EXECDIR}${/}rfswarm_agent${/}rfswarm_agent.py
${pyfile_manager} ${EXECDIR}${/}rfswarm_manager${/}rfswarm.py
${process_agent} None
${process_manager} None
${process_agent} ${None}
${process_manager} ${None}

# datapath: /home/runner/work/rfswarm/rfswarm/rfswarm_manager/results/PreRun
# datapath: /opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/rfswarm_manager/results/PreRun -- let's control the output path rather than leaving it to chance
Expand Down Expand Up @@ -118,31 +122,49 @@ Check Agent Is Running
Should Be True ${result}

Stop Manager
${result}= Terminate Process ${process_manager}
# Should Be Equal As Integers ${result.rc} 0
${running}= Is Process Running ${process_manager}
IF ${running}
Sleep 3s
IF '${platform}' == 'windows' # Send Signal To Process keyword does not work on Windows
${result}= Terminate Process ${process_manager}
ELSE
Send Signal To Process SIGINT ${process_manager}
${result}= Wait For Process ${process_manager} timeout=30 on_timeout=kill
END

Copy File ${result.stdout_path} ${OUTPUT DIR}${/}${TEST NAME}${/}stdout_manager.txt
Copy File ${result.stderr_path} ${OUTPUT DIR}${/}${TEST NAME}${/}stderr_manager.txt

Log to console Terminate Manager Process returned: ${result.rc} console=True
Log to console Manager returned: ${result.rc}
Log stdout_path: ${result.stdout_path} console=True
Log stdout: ${result.stdout} console=True
Log stderr_path: ${result.stderr_path} console=True
Log stderr: ${result.stderr} console=True

END

Stop Agent
${result}= Terminate Process ${process_agent}
# Should Be Equal As Integers ${result.rc} 0
${running}= Is Process Running ${process_agent}
IF ${running}
Sleep 3s
IF '${platform}' == 'windows' # Send Signal To Process keyword does not work on Windows
${result} = Terminate Process ${process_agent}
ELSE
Send Signal To Process SIGINT ${process_agent}
${result}= Wait For Process ${process_agent} timeout=30 on_timeout=kill
END

Copy File ${result.stdout_path} ${OUTPUT DIR}${/}${TEST NAME}${/}stdout_agent.txt
Copy File ${result.stderr_path} ${OUTPUT DIR}${/}${TEST NAME}${/}stderr_agent.txt
Copy File ${result.stdout_path} ${OUTPUT DIR}${/}${TEST NAME}${/}stdout_agent.txt
Copy File ${result.stderr_path} ${OUTPUT DIR}${/}${TEST NAME}${/}stderr_agent.txt

Log Terminate Agent Process returned: ${result.rc} console=True
Log stdout_path: ${result.stdout_path} console=True
Log stdout: ${result.stdout} console=True
Log stderr_path: ${result.stderr_path} console=True
Log stderr: ${result.stderr} console=True
Show Dir Contents ${agent_dir}
Log to console Agent returned: ${result.rc}
Log stdout_path: ${result.stdout_path} console=True
Log stdout: ${result.stdout} console=True
Log stderr_path: ${result.stderr_path} console=True
Log stderr: ${result.stderr} console=True
Show Dir Contents ${agent_dir}

END

Set Global Filename And Default Save Path
[Documentation] Sets global default save path as Test Variable and file name for robot test.
Expand Down Expand Up @@ -191,9 +213,10 @@ Get Manager INI Data
EXCEPT
# --- temp fix:
@{mngr_options}= Create List -g 1
Open Manager GUI ${mngr_options}
Run Manager CLI ${mngr_options}
Sleep 5
# ---
Run Keyword Close Manager GUI ${platform}
Run Keyword Stop Manager
File Should Exist ${location}
File Should Not Be Empty ${location}
END
Expand Down Expand Up @@ -240,6 +263,12 @@ Change Manager INI File Settings
Log ${ini_content}
Append To File ${location} ${ini_content}

Change ${str1} With ${str2} In ${file}
${file_content} Get File ${file}
Remove File ${file}
${file_content} Replace String ${file_content} ${str1} ${str2}
Create File ${file} ${file_content}

Get Manager PIP Data
Run Process pip show rfswarm-manager alias=data
${pip_data} Get Process Result data
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions Tests/Regression/Manager/testdata/Issue-#340/Issue-#340.rfs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Scenario]
uploadmode = err
scriptcount = 1
graphlist =

[1]
robots = 10
delay = 0
rampup = 15
run = 30
test = Example Test Case
script = example.robot

20 changes: 20 additions & 0 deletions Tests/Regression/Manager/testdata/Issue-#340/RFSwarmManager.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[GUI]
win_width = 1280
win_height = 720
graph_list =

[Plan]
scriptdir =
scenariodir =
scenariofile = new_dir

[Run]
resultsdir =
display_index = False
display_iteration = False
display_sequence = False
display_percentile = 90

[Server]
bindip =
bindport = 8138
Loading