|
@@ -25,12 +25,16 @@ import os
|
|
|
|
|
|
|
|
|
class TestFlumeHandler(RMFTestCase):
|
|
|
-
|
|
|
+ COMMON_SERVICES_PACKAGE_DIR = "FLUME/1.4.0.2.0/package"
|
|
|
+ STACK_VERSION = "2.0.6"
|
|
|
+
|
|
|
def test_configure_default(self):
|
|
|
- self.executeScript("2.0.6/services/FLUME/package/scripts/flume_handler.py",
|
|
|
+ self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/flume_handler.py",
|
|
|
classname = "FlumeHandler",
|
|
|
command = "configure",
|
|
|
- config_file="default.json")
|
|
|
+ config_file="default.json",
|
|
|
+ hdp_stack_version = self.STACK_VERSION,
|
|
|
+ target = RMFTestCase.TARGET_COMMON_SERVICES)
|
|
|
|
|
|
self.assert_configure_default()
|
|
|
self.assertNoMoreResources()
|
|
@@ -44,9 +48,12 @@ class TestFlumeHandler(RMFTestCase):
|
|
|
os_path_isfile_mock.side_effect = [True, False]
|
|
|
cmd_target_names_mock.return_value = ["a1"]
|
|
|
|
|
|
- self.executeScript("2.0.6/services/FLUME/package/scripts/flume_handler.py",
|
|
|
- classname = "FlumeHandler", command = "start",
|
|
|
- config_file="default.json")
|
|
|
+ self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/flume_handler.py",
|
|
|
+ classname = "FlumeHandler",
|
|
|
+ command = "start",
|
|
|
+ config_file="default.json",
|
|
|
+ hdp_stack_version = self.STACK_VERSION,
|
|
|
+ target = RMFTestCase.TARGET_COMMON_SERVICES)
|
|
|
|
|
|
self.assert_configure_default()
|
|
|
|
|
@@ -70,10 +77,12 @@ class TestFlumeHandler(RMFTestCase):
|
|
|
def test_stop_default(self, set_desired_mock, glob_mock):
|
|
|
glob_mock.side_effect = [['/var/run/flume/a1/pid'], ['/etc/flume/conf/a1/ambari-meta.json']]
|
|
|
|
|
|
- self.executeScript("2.0.6/services/FLUME/package/scripts/flume_handler.py",
|
|
|
+ self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/flume_handler.py",
|
|
|
classname = "FlumeHandler",
|
|
|
command = "stop",
|
|
|
- config_file="default.json")
|
|
|
+ config_file="default.json",
|
|
|
+ hdp_stack_version = self.STACK_VERSION,
|
|
|
+ target = RMFTestCase.TARGET_COMMON_SERVICES)
|
|
|
|
|
|
self.assertTrue(glob_mock.called)
|
|
|
|
|
@@ -92,10 +101,12 @@ class TestFlumeHandler(RMFTestCase):
|
|
|
def test_status_default(self, sys_exit_mock, structured_out_mock):
|
|
|
|
|
|
try:
|
|
|
- self.executeScript("2.0.6/services/FLUME/package/scripts/flume_handler.py",
|
|
|
+ self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/flume_handler.py",
|
|
|
classname = "FlumeHandler",
|
|
|
command = "status",
|
|
|
- config_file="default.json")
|
|
|
+ config_file="default.json",
|
|
|
+ hdp_stack_version = self.STACK_VERSION,
|
|
|
+ target = RMFTestCase.TARGET_COMMON_SERVICES)
|
|
|
except:
|
|
|
# expected since ComponentIsNotRunning gets raised
|
|
|
pass
|
|
@@ -112,10 +123,12 @@ class TestFlumeHandler(RMFTestCase):
|
|
|
glob_mock.return_value = ['/etc/flume/conf/a1/ambari-meta.json']
|
|
|
|
|
|
try:
|
|
|
- self.executeScript("2.0.6/services/FLUME/package/scripts/flume_handler.py",
|
|
|
+ self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/flume_handler.py",
|
|
|
classname = "FlumeHandler",
|
|
|
command = "status",
|
|
|
- config_file="default.json")
|
|
|
+ config_file="default.json",
|
|
|
+ hdp_stack_version = self.STACK_VERSION,
|
|
|
+ target = RMFTestCase.TARGET_COMMON_SERVICES)
|
|
|
except:
|
|
|
# expected since ComponentIsNotRunning gets raised
|
|
|
pass
|
|
@@ -135,10 +148,12 @@ class TestFlumeHandler(RMFTestCase):
|
|
|
glob_mock.return_value = []
|
|
|
|
|
|
try:
|
|
|
- self.executeScript("2.0.6/services/FLUME/package/scripts/flume_handler.py",
|
|
|
+ self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/flume_handler.py",
|
|
|
classname = "FlumeHandler",
|
|
|
command = "status",
|
|
|
- config_file="default.json")
|
|
|
+ config_file="default.json",
|
|
|
+ hdp_stack_version = self.STACK_VERSION,
|
|
|
+ target = RMFTestCase.TARGET_COMMON_SERVICES)
|
|
|
except:
|
|
|
# expected since ComponentIsNotRunning gets raised
|
|
|
pass
|
|
@@ -230,10 +245,12 @@ class TestFlumeHandler(RMFTestCase):
|
|
|
# 2nd call is to check if the process is live - that should be False
|
|
|
os_path_isfile_mock.side_effect = [True, False]
|
|
|
|
|
|
- self.executeScript("2.0.6/services/FLUME/package/scripts/flume_handler.py",
|
|
|
+ self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/flume_handler.py",
|
|
|
classname = "FlumeHandler",
|
|
|
command = "start",
|
|
|
- config_file="flume_target.json")
|
|
|
+ config_file="flume_target.json",
|
|
|
+ hdp_stack_version = self.STACK_VERSION,
|
|
|
+ target = RMFTestCase.TARGET_COMMON_SERVICES)
|
|
|
|
|
|
self.assert_configure_many()
|
|
|
|
|
@@ -258,10 +275,12 @@ class TestFlumeHandler(RMFTestCase):
|
|
|
# 2nd call is to check if the process is live - that should be False
|
|
|
os_path_isfile_mock.side_effect = [True, False]
|
|
|
|
|
|
- self.executeScript("2.0.6/services/FLUME/package/scripts/flume_handler.py",
|
|
|
+ self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/flume_handler.py",
|
|
|
classname = "FlumeHandler",
|
|
|
command = "start",
|
|
|
- config_file="flume_target.json")
|
|
|
+ config_file="flume_target.json",
|
|
|
+ hdp_stack_version = self.STACK_VERSION,
|
|
|
+ target = RMFTestCase.TARGET_COMMON_SERVICES)
|
|
|
|
|
|
self.assert_configure_many()
|
|
|
|
|
@@ -282,10 +301,12 @@ class TestFlumeHandler(RMFTestCase):
|
|
|
def test_stop_single(self, glob_mock):
|
|
|
glob_mock.return_value = ['/var/run/flume/b1.pid']
|
|
|
|
|
|
- self.executeScript("2.0.6/services/FLUME/package/scripts/flume_handler.py",
|
|
|
+ self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/flume_handler.py",
|
|
|
classname = "FlumeHandler",
|
|
|
command = "stop",
|
|
|
- config_file="flume_target.json")
|
|
|
+ config_file="flume_target.json",
|
|
|
+ hdp_stack_version = self.STACK_VERSION,
|
|
|
+ target = RMFTestCase.TARGET_COMMON_SERVICES)
|
|
|
|
|
|
self.assertTrue(glob_mock.called)
|
|
|
|
|
@@ -301,10 +322,12 @@ class TestFlumeHandler(RMFTestCase):
|
|
|
def test_configure_with_existing(self, os_unlink_mock, expected_names_mock):
|
|
|
expected_names_mock.return_value = ["x1"]
|
|
|
|
|
|
- self.executeScript("2.0.6/services/FLUME/package/scripts/flume_handler.py",
|
|
|
+ self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/flume_handler.py",
|
|
|
classname = "FlumeHandler",
|
|
|
command = "configure",
|
|
|
- config_file="default.json")
|
|
|
+ config_file="default.json",
|
|
|
+ hdp_stack_version = self.STACK_VERSION,
|
|
|
+ target = RMFTestCase.TARGET_COMMON_SERVICES)
|
|
|
|
|
|
self.assertTrue(os_unlink_mock.called)
|
|
|
os_unlink_mock.assert_called_with('/etc/flume/conf/x1/ambari-meta.json')
|
|
@@ -314,10 +337,12 @@ class TestFlumeHandler(RMFTestCase):
|
|
|
|
|
|
|
|
|
def test_flume_env_not_22(self):
|
|
|
- self.executeScript("2.0.6/services/FLUME/package/scripts/flume_handler.py",
|
|
|
+ self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/flume_handler.py",
|
|
|
classname = "FlumeHandler",
|
|
|
command = "configure",
|
|
|
- config_file="default.json")
|
|
|
+ config_file="default.json",
|
|
|
+ hdp_stack_version = self.STACK_VERSION,
|
|
|
+ target = RMFTestCase.TARGET_COMMON_SERVICES)
|
|
|
|
|
|
self.assertResourceCalled('Directory', '/etc/flume/conf', recursive=True)
|
|
|
|
|
@@ -349,10 +374,12 @@ class TestFlumeHandler(RMFTestCase):
|
|
|
content=content)
|
|
|
|
|
|
def test_flume_env_with_22(self):
|
|
|
- self.executeScript("2.0.6/services/FLUME/package/scripts/flume_handler.py",
|
|
|
+ self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/flume_handler.py",
|
|
|
classname = "FlumeHandler",
|
|
|
command = "configure",
|
|
|
- config_file="flume_22.json")
|
|
|
+ config_file="flume_22.json",
|
|
|
+ hdp_stack_version = self.STACK_VERSION,
|
|
|
+ target = RMFTestCase.TARGET_COMMON_SERVICES)
|
|
|
|
|
|
self.assertResourceCalled('Directory', '/etc/flume/conf', recursive=True)
|
|
|
|