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

AMBARI-23536. Fix TestCustomServiceOrchestrator.py and TestRegistration #966

Merged
merged 6 commits into from Apr 16, 2018

Conversation

aonishuk
Copy link
Contributor

No description provided.

@aonishuk aonishuk self-assigned this Apr 11, 2018
@@ -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()
Copy link
Contributor

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

Copy link
Contributor Author

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):
Copy link
Contributor

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

Copy link
Contributor Author

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where?

Copy link
Contributor Author

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.

@asfgit
Copy link

asfgit commented Apr 11, 2018

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/Ambari-Github-PullRequest-Builder/1763/
Test FAILed.
Test FAILured.

@asfgit
Copy link

asfgit commented Apr 11, 2018

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/Ambari-Github-PullRequest-Builder/1766/
Test FAILed.
Test FAILured.

@aonishuk
Copy link
Contributor Author

Agent tests suceeded in jenkins the failure is not related.

@@ -45,7 +45,7 @@

CLUSTER_ID = '0'

class TestActionQueue:#(TestCase):
class TestActionQueue(TestCase):
Copy link
Contributor

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)

Copy link
Contributor Author

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
Copy link
Contributor

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.

Copy link
Contributor Author

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()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks. Removed.

@adoroszlai
Copy link
Contributor

TestCustomServiceOrchestrator is fine if run in itself, but 5 tests are consistently failing locally if all tests are run.

retest this please

@asfgit
Copy link

asfgit commented Apr 11, 2018

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/Ambari-Github-PullRequest-Builder/1768/
Test FAILed.
Test FAILured.

@adoroszlai
Copy link
Contributor

@aonishuk Thanks for the changes, TestRegistration and TestActionQueue are fine now. Please see my previous comment about TestCustomServiceOrchestrator: it's still failing when all tests are run. Would it be possible to keep that test disabled if it cannot be fixed now?

@asfgit
Copy link

asfgit commented Apr 12, 2018

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/Ambari-Github-PullRequest-Builder/1800/
Test FAILed.
Test FAILured.

@asfgit
Copy link

asfgit commented Apr 13, 2018

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/Ambari-Github-PullRequest-Builder/1829/
Test FAILed.
Test FAILured.

@adoroszlai
Copy link
Contributor

Traceback (most recent call last):
  File "ambari-common/src/test/python/mock/mock.py", line 1199, in patched
    return func(*args, **keywargs)
  File "ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py", line 340, in test_cancel_command
    raise Exception(ret)
Exception: {'status': 'FAILED', 'structuredOut': '', 'exitcode': 13, 'stderr': 'stderr', 'stdout': 'out\n\nCommand failed after 1 tries\n'}

@aonishuk
Copy link
Contributor Author

retest this please

@aonishuk
Copy link
Contributor Author

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.
@asfgit
Copy link

asfgit commented Apr 13, 2018

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/Ambari-Github-PullRequest-Builder/1831/
Test FAILed.
Test FAILured.

@asfgit
Copy link

asfgit commented Apr 13, 2018

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/Ambari-Github-PullRequest-Builder/1833/
Test PASSed.

@aonishuk aonishuk merged commit 589bc8b into apache:trunk Apr 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants