Skip to content

Commit

Permalink
LUCENE-9485: Check early if Solr port 8983 is available (apache#1792)
Browse files Browse the repository at this point in the history
  • Loading branch information
janhoy authored Aug 28, 2020
1 parent eb9f59f commit 18e5f21
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion dev-tools/scripts/smokeTestRelease.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,12 @@ def readSolrOutput(p, startupEvent, failureEvent, logFile):
startupEvent.set()
finally:
f.close()


def is_port_in_use(port):
import socket
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
return s.connect_ex(('localhost', port)) == 0

def testSolrExample(unpackPath, javaPath, isSrc):
# test solr using some examples it comes with
logFile = '%s/solr-example.log' % unpackPath
Expand Down Expand Up @@ -1456,6 +1461,9 @@ def smokeTest(java, baseURL, gitRevision, version, tmpDir, isSigned, local_keys,
download('KEYS', keysFileURL, tmpDir, force_clean=FORCE_CLEAN)
keysFile = '%s/KEYS' % (tmpDir)

if is_port_in_use(8983):
raise RuntimeError('Port 8983 is already in use. The smoketester needs it to test Solr')

print()
print('Test Lucene...')
checkSigs('lucene', lucenePath, version, tmpDir, isSigned, keysFile)
Expand Down

0 comments on commit 18e5f21

Please sign in to comment.