|
@@ -17,6 +17,7 @@ See the License for the specific language governing permissions and
|
|
|
limitations under the License.
|
|
|
|
|
|
"""
|
|
|
+import urllib2
|
|
|
|
|
|
from resource_management import *
|
|
|
from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
|
|
@@ -25,10 +26,51 @@ import time
|
|
|
|
|
|
@OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
|
|
|
def webhcat_service_check():
|
|
|
+ Logger.info("Webhcat smoke test - service status")
|
|
|
+
|
|
|
import params
|
|
|
- smoke_cmd = os.path.join(params.hdp_root,"Run-SmokeTests.cmd")
|
|
|
- service = "WEBHCAT"
|
|
|
- Execute(format("cmd /C {smoke_cmd} {service}"), user=params.hcat_user, logoutput=True)
|
|
|
+ # AMBARI-11633 [WinTP2] Webhcat service check fails
|
|
|
+ # Hive doesn't pass the environment variables correctly to child processes, which fails the smoke test.
|
|
|
+ # Reducing the amount of URLs checked to the minimum required.
|
|
|
+ #smoke_cmd = os.path.join(params.hdp_root,"Run-SmokeTests.cmd")
|
|
|
+ #service = "WEBHCAT"
|
|
|
+ #Execute(format("cmd /C {smoke_cmd} {service}"), user=params.hcat_user, logoutput=True)
|
|
|
+
|
|
|
+ url_tests = [
|
|
|
+ "status",
|
|
|
+ #These are the failing ones:
|
|
|
+ #"ddl/database?user.name=hadoop",
|
|
|
+ #"ddl/database/default/table?user.name=hadoop"
|
|
|
+ ]
|
|
|
+
|
|
|
+
|
|
|
+ import socket
|
|
|
+
|
|
|
+ url_host = socket.getfqdn()
|
|
|
+ url_port = params.config["configurations"]["webhcat-site"]["templeton.port"]
|
|
|
+
|
|
|
+ for url_test in url_tests:
|
|
|
+ url_request = "http://{0}:{1}/templeton/v1/{2}".format(url_host, url_port, url_test)
|
|
|
+ url_response = None
|
|
|
+
|
|
|
+ try:
|
|
|
+ # execute the query for the JSON that includes WebHCat status
|
|
|
+ url_response = urllib2.urlopen(url_request, timeout=30)
|
|
|
+
|
|
|
+ status = url_response.getcode()
|
|
|
+ response = url_response.read()
|
|
|
+
|
|
|
+ if status != 200:
|
|
|
+ Logger.warning("Webhcat service check status: {0}".format(status))
|
|
|
+ Logger.info("Webhcat service check response: {0}".format(response))
|
|
|
+ except urllib2.HTTPError as he:
|
|
|
+ raise Fail("Webhcat check {0} failed: {1}".format(url_request, he.msg))
|
|
|
+ finally:
|
|
|
+ if url_response is not None:
|
|
|
+ try:
|
|
|
+ url_response.close()
|
|
|
+ except:
|
|
|
+ pass
|
|
|
|
|
|
|
|
|
@OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
|