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
AMBARI-23536. Fix TestCustomServiceOrchestrator.py and TestRegistration #966
Conversation
…on.py on branch-3.0-perf (aonishuk)
@@ -50,17 +50,15 @@ def test_registration_build(self, get_os_version_mock, get_os_type_mock, run_os_ | |||
run_os_cmd_mock.return_value = (3, "", "") | |||
register = Register(config) | |||
reference_version = '2.1.0' | |||
data = register.build(reference_version, 1) | |||
data = register.build() |
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.
This gives error on Mac.
File "ambari-agent/src/main/python/ambari_agent/HostInfo.py", line 86, in checkLiveServices
if "ntpd" in service and is_redhat7_or_higher:
TypeError: argument of type 'NoneType' is not iterable
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.
@adoroszlai can you please provide reproduce of this?
@patch.object(CustomServiceOrchestrator, "get_py_executor") | ||
@patch("ambari_commons.shell.kill_process_with_children") | ||
@patch.object(FileCache, "__init__") | ||
@patch.object(CustomServiceOrchestrator, "resolve_script_path") | ||
@patch.object(CustomServiceOrchestrator, "resolve_hook_script_path") | ||
def test_cancel_backgound_command(self, resolve_hook_script_path_mock, | ||
resolve_script_path_mock, FileCache_mock, kill_process_with_children_mock, | ||
get_py_executor_mock): | ||
get_py_executor_mock, get_configuration_mock): |
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.
test_cancel_background_command
fails for me with:
File "ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py", line 409, in test_cancel_backgound_command
self.assertTrue(kill_process_with_children_mock.called)
AssertionError: False is not true
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.
@adoroszlai can you please provide reproduce of this?
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.
fixed
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.
Where?
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 don't remember the exact place. But it is fixed you can re-run it for yourself manually.
Refer to this link for build results (access rights to CI server needed): |
…on.py on branch-3.0-perf (aonishuk)
Refer to this link for build results (access rights to CI server needed): |
Agent tests suceeded in jenkins the failure is not related. |
@@ -45,7 +45,7 @@ | |||
|
|||
CLUSTER_ID = '0' | |||
|
|||
class TestActionQueue:#(TestCase): | |||
class TestActionQueue(TestCase): |
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.
Can you please remove or fix the test cases with @not_for_platform(PLATFORM_LINUX)
? The following ones are erroring:
test_execute_retryable_command
test_execute_retryable_command_fail_and_succeed
test_execute_retryable_command_succeed
due to:
actionQueue = ActionQueue(AmbariConfig(), dummy_controller)
TypeError: __init__() takes exactly 2 arguments (3 given)
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.
removed the tests
get_os_type_mock.return_value = "suse" | ||
get_os_version_mock.return_value = "11" | ||
run_os_cmd_mock.return_value = (3, "", "") | ||
from ambari_agent.Register import Register |
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.
Unfortunately this fix works only if TestRegistration
is run by itself. If all tests are run, then it still fails with the same error.
So I think it's best to return ("ntpd",)
for other platforms from get_ntp_service
.
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.
done
@@ -491,6 +494,8 @@ def test_do_not_log_execution_commands(self, command_status_dict_mock, | |||
[call("out\n\nCommand completed successfully!\n", "9"), call("stderr", "9")], any_order=True) | |||
self.assertEqual(len(reports), 1) | |||
self.assertEqual(expected, reports[0]) | |||
import threading | |||
print threading.enumerate() |
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.
Is this needed?
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.
thanks. Removed.
retest this please |
Refer to this link for build results (access rights to CI server needed): |
…on.py on branch-3.0-perf (aonishuk)
@aonishuk Thanks for the changes, |
Refer to this link for build results (access rights to CI server needed): |
…on.py on branch-3.0-perf (aonishuk)
Refer to this link for build results (access rights to CI server needed): |
|
retest this please |
I cannot reproduce these failures in CustomServiceOrch. And debug logging I added doesn't show anything intersting. I will commit these two tests with disabled CustomServiceOrch. @adoroszlai if you want you can investigate the failures (I see you can repro them) and create a fix for that separately. |
…gistration.py on branch-3.0-perf (aonishuk)" This reverts commit 2f2e6dd.
…on.py on branch-3.0-perf (aonishuk)
Refer to this link for build results (access rights to CI server needed): |
Refer to this link for build results (access rights to CI server needed): |
No description provided.