This repository has been archived by the owner on Apr 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 165
[1LP][RFR] CLI-Testing UI after restarting VMDB #9864
Merged
digitronik
merged 1 commit into
ManageIQ:master
from
dgaikwad:test_appliance_console_vmdb_httpd
Feb 11, 2020
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from cfme.utils.version import Version | ||
from cfme.utils.version import VersionPicker | ||
|
||
app_menu_v5_10 = { | ||
"config_net": "1", | ||
"set_timezone": "2", | ||
"set_date_time": "3", | ||
"create_db_bak": "4", | ||
"create_db_dump": "5", | ||
"restore_db_from_bak": "6", | ||
"config_db": "7", | ||
"config_db_rep": "8", | ||
"logfile_conf": "9", | ||
"config_app_db_failover_monitor": "10", | ||
"ext_temp_storage": "11", | ||
"config_external_auth": "12", | ||
"update_ext_auth_opt": "13", | ||
"gen_custom_encry_key": "14", | ||
"harden_app_scap_config": "15", | ||
"stop_evm": "16", | ||
"start_evm": "17", | ||
"restart_app": "18", | ||
"showdown_app": "19", | ||
"summary_info": "20", | ||
"quit": "21", | ||
} | ||
|
||
app_menu_v5_11 = { | ||
"config_net": "1", | ||
"create_db_bak": "2", | ||
"create_db_dump": "3", | ||
"restore_db_from_bak": "4", | ||
"config_db": "5", | ||
"config_db_rep": "6", | ||
"logfile_conf": "7", | ||
"config_app_db_failover_monitor": "8", | ||
"ext_temp_storage": "9", | ||
"config_external_auth": "10", | ||
"update_ext_auth_opt": "11", | ||
"gen_custom_encry_key": "12", | ||
"harden_app_scap_config": "13", | ||
"stop_evm": "14", | ||
"start_evm": "15", | ||
"restart_app": "16", | ||
"showdown_app": "17", | ||
"summary_info": "18", | ||
"quit": "19", | ||
} | ||
app_con_menu = VersionPicker({Version.lowest(): app_menu_v5_10, "5.11": app_menu_v5_11}).pick() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional: I think we should work on result class for
appliance_console
which will provideoutput
dict
of command and output.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@digitronik , Thank your suggestion but if we make output
dict
instead oflist
then here we are going to override result.Example:
commands = ("ap", "", "5", "2", "1", "2", "2")
In above example we will not able to store result separately for all 2 and 1 command and we will not get which command executed first due to its
dict
type.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using SSHExpect is a better option here, as its asserting along the way what the prompts are.
Further asserting the output content, we'll have to deal with the list of returned stdout strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mshriver , The code which I used I think that is more simple than SSHExpect due to below reason
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that you are doing something about making the answers better defined than just having a stream of numbers. Bad maintainability in case of renumbering was one of the reasons why I started with the SSHExpect thing. I though was aiming even higher -- defining something like a "menu tree model", but didn't get into finishing this.
I think it may be good to unify our approaches in one thing if possible. For this I would like need you to help me understand what should be improved.
About the expectations on stdout... well the question here is whether you want to check what menu question are you answering. Of course when you start checking more things, the test will produce negative (FAIL) results more often. This is not a bad thing every time. I think if the test should fail, it should fail as soon as possible. I think this improves its maintainability. The cost is that even slight change (like a typo correction or such) may cause test to fail while I would say this will be false negative. But I think the false negatives may be eliminated to a good extend a lot by having smart checks. I am not checking all the menu, but the last thing in the SSHExpect buffer (which is actually not too long, especially on PRT, and one should know about it.), which is I think every time, the relevant menu question.
About the timeout, I don't understand what is the problem
This will wait 20s for the prompt and when it sees it it will send an empty string that is AFAIR followed by some newline character.
will wait default timeout and then send pwd. I don't see what is hard here.