|
@@ -17,6 +17,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
limitations under the License.
|
|
'''
|
|
'''
|
|
|
|
+import json
|
|
from mock.mock import MagicMock, patch
|
|
from mock.mock import MagicMock, patch
|
|
from stacks.utils.RMFTestCase import *
|
|
from stacks.utils.RMFTestCase import *
|
|
|
|
|
|
@@ -591,3 +592,38 @@ class TestHbaseRegionServer(RMFTestCase):
|
|
target = RMFTestCase.TARGET_COMMON_SERVICES
|
|
target = RMFTestCase.TARGET_COMMON_SERVICES
|
|
)
|
|
)
|
|
put_structured_out_mock.assert_called_with({"securityState": "UNSECURED"})
|
|
put_structured_out_mock.assert_called_with({"securityState": "UNSECURED"})
|
|
|
|
+
|
|
|
|
+ def test_pre_rolling_restart(self):
|
|
|
|
+ config_file = self.get_src_folder()+"/test/python/stacks/2.0.6/configs/default.json"
|
|
|
|
+ with open(config_file, "r") as f:
|
|
|
|
+ json_content = json.load(f)
|
|
|
|
+ version = '2.2.1.0-3242'
|
|
|
|
+ json_content['commandParams']['version'] = version
|
|
|
|
+ self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/hbase_regionserver.py",
|
|
|
|
+ classname = "HbaseRegionServer",
|
|
|
|
+ command = "pre_rolling_restart",
|
|
|
|
+ config_dict = json_content,
|
|
|
|
+ hdp_stack_version = self.STACK_VERSION,
|
|
|
|
+ target = RMFTestCase.TARGET_COMMON_SERVICES)
|
|
|
|
+ self.assertResourceCalled('Execute',
|
|
|
|
+ 'hdp-select set hbase-regionserver %s' % version,)
|
|
|
|
+ self.assertNoMoreResources()
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ def test_post_rolling_restart(self):
|
|
|
|
+ config_file = self.get_src_folder()+"/test/python/stacks/2.0.6/configs/default.json"
|
|
|
|
+ with open(config_file, "r") as f:
|
|
|
|
+ json_content = json.load(f)
|
|
|
|
+ version = '2.2.1.0-3242'
|
|
|
|
+ json_content['commandParams']['version'] = version
|
|
|
|
+ mocks_dict = {}
|
|
|
|
+ self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/hbase_regionserver.py",
|
|
|
|
+ classname = "HbaseRegionServer",
|
|
|
|
+ command = "post_rolling_restart",
|
|
|
|
+ config_dict = json_content,
|
|
|
|
+ hdp_stack_version = self.STACK_VERSION,
|
|
|
|
+ call_mocks = [(0, "Dummy output c6401.ambari.apache.org:")],
|
|
|
|
+ target = RMFTestCase.TARGET_COMMON_SERVICES,
|
|
|
|
+ mocks_dict = mocks_dict)
|
|
|
|
+ self.assertTrue(mocks_dict['call'].called)
|
|
|
|
+ self.assertNoMoreResources()
|