Browse Source

Testing: Fix smoke tester (#21018)

Fixes two minor issues

* An import from an already removed file was used.
* The strict URL & parameter parsing hit one of the API calls
Alexander Reelsen 9 years ago
parent
commit
ba49c07740
1 changed files with 13 additions and 4 deletions
  1. 13 4
      dev-tools/smoke_test_rc.py

+ 13 - 4
dev-tools/smoke_test_rc.py

@@ -55,7 +55,6 @@ import json
 import base64
 from urllib.parse import urlparse
 
-from prepare_release_candidate import run
 from http.client import HTTPConnection
 
 DEFAULT_PLUGINS = ["analysis-icu",
@@ -88,6 +87,18 @@ except KeyError:
   Please set JAVA_HOME in the env before running release tool
   On OSX use: export JAVA_HOME=`/usr/libexec/java_home -v '1.8*'`""")
 
+# console colors
+COLOR_OK = '\033[92m'
+COLOR_END = '\033[0m'
+
+def run(command, env_vars=None):
+  if env_vars:
+    for key, value in env_vars.items():
+      os.putenv(key, value)
+  print('*** Running: %s%s%s' % (COLOR_OK, command, COLOR_END))
+  if os.system(command):
+    raise RuntimeError('    FAILED: %s' % (command))
+
 def java_exe():
   path = JAVA_HOME
   return 'export JAVA_HOME="%s" PATH="%s/bin:$PATH" JAVACMD="%s/bin/java"' % (path, path, path)
@@ -97,7 +108,6 @@ def verify_java_version(version):
   if ' version "%s.' % version not in s:
     raise RuntimeError('got wrong version for java %s:\n%s' % (version, s))
 
-
 def sha1(file):
   with open(file, 'rb') as f:
     return hashlib.sha1(f.read()).hexdigest()
@@ -106,7 +116,6 @@ def read_fully(file):
   with open(file, encoding='utf-8') as f:
      return f.read()
 
-
 def wait_for_node_startup(es_dir, timeout=60, header={}):
   print('     Waiting until node becomes available for at most %s seconds' % timeout)
   for _ in range(timeout):
@@ -225,7 +234,7 @@ def smoke_test_release(release, files, hash, plugins):
           if version['build_snapshot']:
             raise RuntimeError('Expected non snapshot version')
           print('  Verify if plugins are listed in _nodes')
-          conn.request('GET', '/_nodes?plugin=true&pretty=true', headers=headers)
+          conn.request('GET', '/_nodes/plugins?pretty=true', headers=headers)
           res = conn.getresponse()
           if res.status == 200:
             nodes = json.loads(res.read().decode("utf-8"))['nodes']