mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-19 19:35:02 +00:00
Testing: Fix smoke tester
Original commit: elastic/x-pack-elasticsearch@929a45aa27
This commit is contained in:
parent
9ea1786596
commit
b6e909658e
@ -5,7 +5,6 @@
|
|||||||
# 4. Starts one node for zip package and checks:
|
# 4. Starts one node for zip package and checks:
|
||||||
# -- if x-pack plugin is loaded
|
# -- if x-pack plugin is loaded
|
||||||
# -- checks xpack info page, if response returns correct version and feature set info
|
# -- checks xpack info page, if response returns correct version and feature set info
|
||||||
# -- puts the local basic license to make sure that x-pack was put with the correct license
|
|
||||||
#
|
#
|
||||||
# USAGE:
|
# USAGE:
|
||||||
#
|
#
|
||||||
@ -126,7 +125,7 @@ def smoke_test_release(release, files, release_hash):
|
|||||||
conn = HTTPConnection(host, timeout=20)
|
conn = HTTPConnection(host, timeout=20)
|
||||||
|
|
||||||
# check if plugin is loaded
|
# check if plugin is loaded
|
||||||
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']
|
||||||
@ -138,28 +137,17 @@ def smoke_test_release(release, files, release_hash):
|
|||||||
else:
|
else:
|
||||||
raise RuntimeError('Expected HTTP 200 but got %s' % res.status)
|
raise RuntimeError('Expected HTTP 200 but got %s' % res.status)
|
||||||
|
|
||||||
# put the supplied license to ensure that system was built with
|
# check if license is the default one
|
||||||
license = read_fully(os.path.join(os.path.dirname(__file__), 'license.json'))
|
# also sleep for few more seconds, as the initial license generation might take some time
|
||||||
conn.request('PUT', '/_xpack/license?acknowledge=true', license, headers=headers)
|
time.sleep(5)
|
||||||
res = conn.getresponse()
|
conn.request('GET', '/_xpack', headers=headers)
|
||||||
# reading the result, so we can execute the next request on the same connection
|
|
||||||
license_resp = json.loads(res.read().decode('utf-8'))
|
|
||||||
if res.status != 200:
|
|
||||||
raise RuntimeError('Could not PUT _xpack/license, got status %s' % res.status)
|
|
||||||
if license_resp['license_status'] != 'valid':
|
|
||||||
raise RuntimeError('Expected license to be valid, but was %s' % license_resp['license_status'])
|
|
||||||
|
|
||||||
# check if license is the one we just PUT
|
|
||||||
#print('SLEEEEPING')
|
|
||||||
#time.sleep(300)
|
|
||||||
conn.request('GET', '/_xpack?pretty', headers=headers)
|
|
||||||
res = conn.getresponse()
|
res = conn.getresponse()
|
||||||
if res.status == 200:
|
if res.status == 200:
|
||||||
xpack = json.loads(res.read().decode("utf-8"))
|
xpack = json.loads(res.read().decode("utf-8"))
|
||||||
if xpack['license']['type'] != 'basic':
|
if xpack['license']['type'] != 'trial':
|
||||||
raise RuntimeError('expected license type to be basic, was %s' % xpack['license']['type'])
|
raise RuntimeError('expected license type to be trial, was %s' % xpack['license']['type'])
|
||||||
if xpack['license']['mode'] != 'basic':
|
if xpack['license']['mode'] != 'trial':
|
||||||
raise RuntimeError('expected license mode to be basic, was %s' % xpack['license']['mode'])
|
raise RuntimeError('expected license mode to be trial, was %s' % xpack['license']['mode'])
|
||||||
if xpack['license']['status'] != 'active':
|
if xpack['license']['status'] != 'active':
|
||||||
raise RuntimeError('expected license status to be active, was %s' % xpack['license']['active'])
|
raise RuntimeError('expected license status to be active, was %s' % xpack['license']['active'])
|
||||||
else:
|
else:
|
||||||
@ -179,7 +167,6 @@ def smoke_test_release(release, files, release_hash):
|
|||||||
# console colors
|
# console colors
|
||||||
COLOR_OK = '\033[92m'
|
COLOR_OK = '\033[92m'
|
||||||
COLOR_END = '\033[0m'
|
COLOR_END = '\033[0m'
|
||||||
COLOR_FAIL = '\033[91m'
|
|
||||||
|
|
||||||
def run(command, env_vars=None):
|
def run(command, env_vars=None):
|
||||||
if env_vars:
|
if env_vars:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user