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
This commit is contained in:
parent
0048ac4536
commit
ba49c07740
|
@ -55,7 +55,6 @@ import json
|
||||||
import base64
|
import base64
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from prepare_release_candidate import run
|
|
||||||
from http.client import HTTPConnection
|
from http.client import HTTPConnection
|
||||||
|
|
||||||
DEFAULT_PLUGINS = ["analysis-icu",
|
DEFAULT_PLUGINS = ["analysis-icu",
|
||||||
|
@ -88,6 +87,18 @@ except KeyError:
|
||||||
Please set JAVA_HOME in the env before running release tool
|
Please set JAVA_HOME in the env before running release tool
|
||||||
On OSX use: export JAVA_HOME=`/usr/libexec/java_home -v '1.8*'`""")
|
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():
|
def java_exe():
|
||||||
path = JAVA_HOME
|
path = JAVA_HOME
|
||||||
return 'export JAVA_HOME="%s" PATH="%s/bin:$PATH" JAVACMD="%s/bin/java"' % (path, path, path)
|
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:
|
if ' version "%s.' % version not in s:
|
||||||
raise RuntimeError('got wrong version for java %s:\n%s' % (version, s))
|
raise RuntimeError('got wrong version for java %s:\n%s' % (version, s))
|
||||||
|
|
||||||
|
|
||||||
def sha1(file):
|
def sha1(file):
|
||||||
with open(file, 'rb') as f:
|
with open(file, 'rb') as f:
|
||||||
return hashlib.sha1(f.read()).hexdigest()
|
return hashlib.sha1(f.read()).hexdigest()
|
||||||
|
@ -106,7 +116,6 @@ def read_fully(file):
|
||||||
with open(file, encoding='utf-8') as f:
|
with open(file, encoding='utf-8') as f:
|
||||||
return f.read()
|
return f.read()
|
||||||
|
|
||||||
|
|
||||||
def wait_for_node_startup(es_dir, timeout=60, header={}):
|
def wait_for_node_startup(es_dir, timeout=60, header={}):
|
||||||
print(' Waiting until node becomes available for at most %s seconds' % timeout)
|
print(' Waiting until node becomes available for at most %s seconds' % timeout)
|
||||||
for _ in range(timeout):
|
for _ in range(timeout):
|
||||||
|
@ -225,7 +234,7 @@ def smoke_test_release(release, files, hash, plugins):
|
||||||
if version['build_snapshot']:
|
if version['build_snapshot']:
|
||||||
raise RuntimeError('Expected non snapshot version')
|
raise RuntimeError('Expected non snapshot version')
|
||||||
print(' Verify if plugins are listed in _nodes')
|
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()
|
res = conn.getresponse()
|
||||||
if res.status == 200:
|
if res.status == 200:
|
||||||
nodes = json.loads(res.read().decode("utf-8"))['nodes']
|
nodes = json.loads(res.read().decode("utf-8"))['nodes']
|
||||||
|
|
Loading…
Reference in New Issue