Skip to content

Apache Lucene open-source search software

LUCENE-6231: retry all downloads in smokeTestRelease.py

Steven Rowecc20881d28fb
diff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.py
index 64a10d2e48c..5e181f084c2 100644
--- a/dev-tools/scripts/smokeTestRelease.py
+++ b/dev-tools/scripts/smokeTestRelease.py
@@ -95,7 +95,7 @@ def getHREFs(urlString):
links = []
try:
- html = urllib.request.urlopen(urlString).read().decode('UTF-8')
+ html = load(urlString)
except:
print('\nFAILED to open url %s' % urlString)
traceback.print_exc()
@@ -146,7 +146,12 @@ def attemptDownload(urlString, fileName):
os.remove(fileName)
def load(urlString):
- return urllib.request.urlopen(urlString).read().decode('utf-8')
+ try:
+ content = urllib.request.urlopen(urlString).read().decode('utf-8')
+ except Exception as e:
+ print('Retrying download of url %s after exception: %s' % (urlString, e))
+ content = urllib.request.urlopen(urlString).read().decode('utf-8')
+ return content
def noJavaPackageClasses(desc, file):
with zipfile.ZipFile(file) as z2:
@@ -866,7 +871,7 @@ def testSolrExample(unpackPath, javaPath, isSrc):
print(' index example docs...')
run('java -Durl=http://localhost:8983/solr/techproducts/update -jar ./exampledocs/post.jar ./exampledocs/*.xml', 'post-example-docs.log')
print(' run query...')
- s = urllib.request.urlopen('http://localhost:8983/solr/techproducts/select/?q=video').read().decode('UTF-8')
+ s = load('http://localhost:8983/solr/techproducts/select/?q=video')
if s.find('<result name="response" numFound="3" start="0">') == -1:
print('FAILED: response is:\n%s' % s)
raise RuntimeError('query on solr example instance failed')
@@ -1337,7 +1342,7 @@ reVersion1 = re.compile(r'\>(\d+)\.(\d+)\.(\d+)(-alpha|-beta)?/\<', re.IGNORECAS
reVersion2 = re.compile(r'-(\d+)\.(\d+)\.(\d+)(-alpha|-beta)?\.', re.IGNORECASE)
def getAllLuceneReleases():
- s = urllib.request.urlopen('https://archive.apache.org/dist/lucene/java').read().decode('UTF-8')
+ s = load('https://archive.apache.org/dist/lucene/java')
releases = set()
for r in reVersion1, reVersion2: