[BUILD] Allow smoke-testing other artifact but staging artifacts

This commit is contained in:
Simon Willnauer 2015-08-26 16:07:50 +02:00
parent a254b2da29
commit d4a9089253
1 changed files with 16 additions and 5 deletions

View File

@ -28,14 +28,18 @@
# #
# USAGE: # USAGE:
# #
# python3 -B ./dev-tools/smoke_tests_rc.py --version 2.0.0-beta1 --hash bfa3e47 # python3 -B ./dev-tools/smoke_test_rc.py --version 2.0.0-beta1 --hash bfa3e47
# #
# to also test other plugins try run # to also test other plugins try run
# #
# python3 -B ./dev-tools/smoke_tests_rc.py --version 2.0.0-beta1 --hash bfa3e47 --plugins license,shield,watcher # python3 -B ./dev-tools/smoke_test_rc.py --version 2.0.0-beta1 --hash bfa3e47 --plugins license,shield,watcher
# #
# Note: Ensure the script is run from the elasticsearch top level directory # Note: Ensure the script is run from the elasticsearch top level directory
# #
# For testing a release from sonatype try this:
#
# python3 -B dev-tools/smoke_test_rc.py --version 2.0.0-beta1 --hash bfa3e47 --fetch_url https://oss.sonatype.org/content/repositories/releases/
#
import argparse import argparse
import tempfile import tempfile
@ -111,8 +115,7 @@ def wait_for_node_startup(host='127.0.0.1', port=9200, timeout=60, header={}):
conn.close() conn.close()
return False return False
def download_and_verify(version, hash, files, base_url='http://download.elasticsearch.org/elasticsearch/staging', plugins=DEFAULT_PLUGINS, verbose=False): def download_and_verify(version, hash, files, base_url, plugins=DEFAULT_PLUGINS, verbose=False):
base_url = '%s/%s-%s' % (base_url, version, hash)
print('Downloading and verifying release %s from %s' % (version, base_url)) print('Downloading and verifying release %s from %s' % (version, base_url))
tmp_dir = tempfile.mkdtemp() tmp_dir = tempfile.mkdtemp()
try: try:
@ -249,15 +252,19 @@ if __name__ == "__main__":
help='A list of additional plugins to smoketest') help='A list of additional plugins to smoketest')
parser.add_argument('--verbose', '-b', dest='verbose', parser.add_argument('--verbose', '-b', dest='verbose',
help='Runs the script in verbose mode') help='Runs the script in verbose mode')
parser.add_argument('--fetch_url', '-u', dest='url', default=None,
help='Runs the script in verbose mode')
parser.set_defaults(hash=None) parser.set_defaults(hash=None)
parser.set_defaults(plugins=[]) parser.set_defaults(plugins=[])
parser.set_defaults(version=None) parser.set_defaults(version=None)
parser.set_defaults(verbose=False) parser.set_defaults(verbose=False)
parser.set_defaults(url=None)
args = parser.parse_args() args = parser.parse_args()
plugins = args.plugins plugins = args.plugins
version = args.version version = args.version
hash = args.hash hash = args.hash
verbose = args.verbose verbose = args.verbose
url = args.url
files = [ files = [
'org/elasticsearch/distribution/tar/elasticsearch/2.0.0-beta1/elasticsearch-2.0.0-beta1.tar.gz', 'org/elasticsearch/distribution/tar/elasticsearch/2.0.0-beta1/elasticsearch-2.0.0-beta1.tar.gz',
'org/elasticsearch/distribution/zip/elasticsearch/2.0.0-beta1/elasticsearch-2.0.0-beta1.zip', 'org/elasticsearch/distribution/zip/elasticsearch/2.0.0-beta1/elasticsearch-2.0.0-beta1.zip',
@ -265,7 +272,11 @@ if __name__ == "__main__":
'org/elasticsearch/distribution/rpm/elasticsearch/2.0.0-beta1/elasticsearch-2.0.0-beta1.rpm' 'org/elasticsearch/distribution/rpm/elasticsearch/2.0.0-beta1/elasticsearch-2.0.0-beta1.rpm'
] ]
verify_java_version('1.7') verify_java_version('1.7')
download_and_verify(version, hash, files, plugins= DEFAULT_PLUGINS + plugins, verbose=verbose) if url:
download_url = url
else:
download_url = '%s/%s-%s' % ('http://download.elasticsearch.org/elasticsearch/staging', version, hash)
download_and_verify(version, hash, files, download_url, plugins=DEFAULT_PLUGINS + plugins, verbose=verbose)