Просмотр исходного кода

Merge pull request #6569 from AttilaVamos/HPCC-12447-fix

HPCC-12447 Regression suite error message poor

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 10 лет назад
Родитель
Сommit
c229c1ae4d

+ 7 - 1
testing/regress/ecl-test

@@ -28,7 +28,7 @@ import glob
 from hpcc.util import argparse
 from hpcc.regression.regress import Regression
 from hpcc.util.ecl.file import ECLFile
-from hpcc.util.util import checkPqParam, getVersionNumbers, checkXParam, convertPath, getRealIPAddress, parentPath, checkClusters
+from hpcc.util.util import checkPqParam, getVersionNumbers, checkXParam, convertPath, getRealIPAddress, parentPath, checkClusters, checkHpccStatus
 from hpcc.common.error import Error
 
 # For coverage
@@ -123,6 +123,11 @@ class RegressMain:
                 self.regress.runSuite(cluster, self.regress.suites[cluster])
 
     def main(self):
+        try:
+            checkHpccStatus()
+        except Error as e:
+            exit(e.getErrorCode());
+
         prog = "ecl-test"
         description = 'HPCC Platform Regression suite'
         pythonVer = getVersionNumbers()
@@ -203,6 +208,7 @@ class RegressMain:
 
         self.args = parser.parse_args()
         try:
+            self.regress = None
             if self.args.X[0]== "5000":
                 self.regress = None
                 raise Error(self.args.X[0])

+ 5 - 1
testing/regress/hpcc/common/error.py

@@ -28,7 +28,11 @@ ERROR = {
     "3001": "Return diff does not match.",
     "4000": "Unknown cluster!",
     "4001": "No ECl file!",
-    "5000": "Missing argument of -X parameter!\nIt should be 'name=val[,name2=val2..]'"
+    "5000": "Missing argument of -X parameter!\nIt should be 'name=val[,name2=val2..]'",
+    "6000": "HPCC System not istalled!",
+    "6001": "HPCC System doesn't run!",
+    "6002": "OS error when try to call ecl command!",
+    "6003": "Parameter error when try to call ecl command!",
 }
 
 

+ 43 - 0
testing/regress/hpcc/util/util.py

@@ -21,6 +21,7 @@ import argparse
 import platform
 import logging
 import os
+import subprocess
 
 from ..common.error import Error
 from ..common.shell import Shell
@@ -174,3 +175,45 @@ def checkClusters(clusters,  targetSet):
                 raise Error("4000")
 
     return  targetClusters
+
+def checkHpccStatus():
+    status='OK'
+    try:
+        myProc = subprocess.Popen(["ecl --version"],  shell=True,  bufsize=8192,  stdout=subprocess.PIPE,  stderr=subprocess.PIPE)
+        result = myProc.stdout.read() + myProc.stderr.read()
+        results = result.split('\n')
+        for line in results:
+            if 'not found' in line:
+                err = Error("6000")
+                logging.error("%s. %s:'%s'" % (1,  err,  line))
+                raise  err
+                break
+
+        myProc = subprocess.Popen("ecl getname --wuid 'W*'",  shell=True,  bufsize=8192,  stdout=subprocess.PIPE,  stderr=subprocess.PIPE)
+        result  = myProc.stdout.read() + myProc.stderr.read()
+        results = result.split('\n')
+        for line in results:
+            if "Error connecting" in line:
+                err = Error("6001")
+                logging.error("%s. %s:'%s'" % (1,  err,  line))
+                raise (err)
+                break
+
+            if "command not found" in line:
+                err = Error("6002")
+                logging.error("%s. %s:'%s'" % (1,  err,  line))
+                raise (err)
+                break
+
+    except  OSError:
+        err = Error("6002")
+        logging.error("%s. checkHpccStatus error:%s!" % (1,  err))
+        raise Error(err)
+
+    except ValueError:
+        err = Error("6003")
+        logging.error("%s. checkHpccStatus error:%s!" % (1,  err))
+        raise Error(err)
+
+    finally:
+        pass