-
Notifications
You must be signed in to change notification settings - Fork 23
Fix Support Assist Defect #193
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
Merged
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 hidden or 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
This file contains hidden or 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 |
---|---|---|
|
@@ -103,6 +103,40 @@ class MockSupportAssistApi: | |
} | ||
} | ||
|
||
GET_SUPPORT_ASSIST_RESPONSE_DIRECT_MODE = { | ||
"connection": { | ||
"gateway_endpoints": [], | ||
"mode": "direct", | ||
"network_pools": [ | ||
{ | ||
"pool": "pool1", | ||
"subnet": "subnet0" | ||
} | ||
] | ||
}, | ||
"connection_state": "disabled", | ||
"contact": { | ||
"primary": { | ||
"email": "[email protected]", | ||
"first_name": "Eric", | ||
"last_name": "Nam", | ||
"phone": "1234567890" | ||
}, | ||
"secondary": { | ||
"email": "[email protected]", | ||
"first_name": "Daniel", | ||
"last_name": "Kang", | ||
"phone": "1234567891" | ||
} | ||
}, | ||
"telemetry": { | ||
"offline_collection_period": 60, | ||
"telemetry_enabled": True, | ||
"telemetry_persist": True, | ||
"telemetry_threads": 10 | ||
} | ||
} | ||
|
||
@staticmethod | ||
def get_support_assist_settings_exception_response(response_type): | ||
if response_type == 'get_details_exception': | ||
|
This file contains hidden or 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 |
---|---|---|
|
@@ -232,7 +232,69 @@ def test_modify_support_assist_exception(self, powerscale_module_mock): | |
MockSupportAssistApi.get_support_assist_settings_exception_response('update_exception'), | ||
SupportAssistHandler) | ||
|
||
def test_empty_gateway_endpoints_exception(self, powerscale_module_mock): | ||
def test_modify_mode_from_gateway_to_direct(self, powerscale_module_mock): | ||
self.support_assist_args.update( | ||
{ | ||
"connection": { | ||
"mode": "direct" | ||
} | ||
}) | ||
self.set_module_params(self.support_assist_args, {}) | ||
powerscale_module_mock.get_support_assist_details = MagicMock( | ||
return_value=MockSupportAssistApi.GET_SUPPORT_ASSIST_RESPONSE) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you revise the method name of the two test_modify_mode_to_direct, so it is obvious to know the purpose? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, updated |
||
SupportAssistHandler().handle(powerscale_module_mock, | ||
powerscale_module_mock.module.params) | ||
assert powerscale_module_mock.module.exit_json.call_args[1]['changed'] is True | ||
|
||
def test_modify_mode_from_direct_to_direct(self, powerscale_module_mock): | ||
self.support_assist_args.update( | ||
{ | ||
"connection": { | ||
"mode": "direct" | ||
} | ||
}) | ||
self.set_module_params(self.support_assist_args, {}) | ||
powerscale_module_mock.get_support_assist_details = MagicMock( | ||
return_value=MockSupportAssistApi.GET_SUPPORT_ASSIST_RESPONSE_DIRECT_MODE) | ||
SupportAssistHandler().handle(powerscale_module_mock, | ||
powerscale_module_mock.module.params) | ||
assert powerscale_module_mock.module.exit_json.call_args[1]['changed'] is True | ||
|
||
def test_add_gateway_endpoints_from_gateway_to_direct(self, powerscale_module_mock): | ||
self.support_assist_args.update( | ||
{ | ||
"connection": { | ||
"gateway_endpoints": [ | ||
{ | ||
"enabled": True, | ||
"gateway_host": "XX.XX.XX.XX", | ||
"gateway_port": 9443, | ||
"priority": 2, | ||
"use_proxy": False, | ||
"validate_ssl": False, | ||
"state": "present" | ||
}, | ||
{ | ||
"enabled": True, | ||
"gateway_host": "XX.XX.XX.XY", | ||
"gateway_port": 9443, | ||
"priority": 2, | ||
"use_proxy": False, | ||
"validate_ssl": False, | ||
"state": "present" | ||
} | ||
], | ||
"mode": "gateway" | ||
} | ||
}) | ||
self.set_module_params(self.support_assist_args, {}) | ||
powerscale_module_mock.get_support_assist_details = MagicMock( | ||
return_value=MockSupportAssistApi.GET_SUPPORT_ASSIST_RESPONSE_DIRECT_MODE) | ||
SupportAssistHandler().handle(powerscale_module_mock, | ||
powerscale_module_mock.module.params) | ||
assert powerscale_module_mock.module.exit_json.call_args[1]['changed'] is True | ||
|
||
def test_empty_gateway_endpoints_exception_1(self, powerscale_module_mock): | ||
self.support_assist_args.update( | ||
{ | ||
"connection": { | ||
|
@@ -256,6 +318,20 @@ def test_empty_gateway_endpoints_exception(self, powerscale_module_mock): | |
MockSupportAssistApi.get_support_assist_settings_exception_response('empty_gateway_exception'), | ||
SupportAssistHandler) | ||
|
||
def test_empty_gateway_endpoints_exception_2(self, powerscale_module_mock): | ||
self.support_assist_args.update( | ||
{ | ||
"connection": { | ||
"mode": "gateway" | ||
} | ||
}) | ||
self.set_module_params(self.support_assist_args, {}) | ||
powerscale_module_mock.get_support_assist_details = MagicMock( | ||
return_value=MockSupportAssistApi.GET_SUPPORT_ASSIST_RESPONSE_DIRECT_MODE) | ||
self.capture_fail_json_call( | ||
MockSupportAssistApi.get_support_assist_settings_exception_response('empty_gateway_exception'), | ||
SupportAssistHandler) | ||
|
||
def test_empty_network_pools_exception(self, powerscale_module_mock): | ||
self.support_assist_args.update( | ||
{ | ||
|
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.
What about setting
connection_dict['mode'] = settings_params['connection']['mode']
regardless of the difference, so we will not struggle with checking if 'mode' in connection_dict`Another question, is it possible to omit
mode
in playbook?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.
As discussed, connection_dict reflects what has been modified to determine if changed flag need to be set to true. Updating it would affect the changed flag. For now, I suggest we keep this design and come up with a better way to detect the diff in the future.