|
@@ -17,11 +17,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
See the License for the specific language governing permissions and
|
|
|
limitations under the License.
|
|
|
'''
|
|
|
+import json
|
|
|
import os
|
|
|
from mock.mock import MagicMock, call, patch
|
|
|
from stacks.utils.RMFTestCase import *
|
|
|
import datetime, sys, socket
|
|
|
-import resource_management.libraries.functions
|
|
|
+import resource_management.libraries.functions
|
|
|
+
|
|
|
@patch.object(resource_management.libraries.functions, "get_unique_id_and_date", new = MagicMock(return_value=''))
|
|
|
@patch("socket.socket")
|
|
|
@patch("time.time", new=MagicMock(return_value=1431110511.43))
|
|
@@ -246,3 +248,35 @@ class TestServiceCheck(RMFTestCase):
|
|
|
try_sleep = 5,
|
|
|
)
|
|
|
self.assertNoMoreResources()
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ def test_service_check_during_upgrade(self, socket_mock):
|
|
|
+ config_file = self.get_src_folder() + "/test/python/stacks/2.2/configs/hive-upgrade.json"
|
|
|
+ with open(config_file, 'r') as f:
|
|
|
+ json_content = json.load(f)
|
|
|
+
|
|
|
+ json_content['commandParams']['version'] = "2.3.0.0-1234"
|
|
|
+
|
|
|
+ self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/service_check.py",
|
|
|
+ classname="HiveServiceCheck",
|
|
|
+ command="service_check",
|
|
|
+ config_dict = json_content,
|
|
|
+ hdp_stack_version = self.STACK_VERSION,
|
|
|
+ target = RMFTestCase.TARGET_COMMON_SERVICES)
|
|
|
+
|
|
|
+ self.assertResourceCalled('Execute', "! beeline -u 'jdbc:hive2://c6402.ambari.apache.org:10010/;transportMode=binary' -e '' 2>&1| awk '{print}'|grep -i -e 'Connection refused' -e 'Invalid URL'",
|
|
|
+ path = ['/bin/', '/usr/bin/', '/usr/lib/hive/bin/', '/usr/sbin/'],
|
|
|
+ timeout = 30,
|
|
|
+ user = 'ambari-qa')
|
|
|
+
|
|
|
+ self.assertResourceCalled('File', '/tmp/hcatSmoke.sh',
|
|
|
+ content = StaticFile('hcatSmoke.sh'),
|
|
|
+ mode = 0755)
|
|
|
+
|
|
|
+ self.assertResourceCalled('Execute', "env JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /tmp/hcatSmoke.sh hcatsmoke prepare",
|
|
|
+ logoutput = True,
|
|
|
+ path = ['/usr/sbin','/usr/local/bin','/bin','/usr/bin', '/bin:/usr/hdp/current/hadoop-client/bin:/usr/hdp/2.3.0.0-1234/hive/bin'],
|
|
|
+ tries = 3,
|
|
|
+ user = 'ambari-qa',
|
|
|
+ try_sleep = 5)
|