Apache Solr open-source search software
SOLR-17556: Fix smokeTest to use films as example for slim distribution
Houston Putman80dfe11fe4c8
diff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.pyindex acfa109f2fc..4deb80f8bf4 100755--- a/dev-tools/scripts/smokeTestRelease.py+++ b/dev-tools/scripts/smokeTestRelease.py@@ -690,7 +690,7 @@ def verifyUnpacked(java, artifact, unpackPath, gitRevision, version, testArgs):shutil.copytree(unpackPath, java11UnpackPath)os.chdir(java11UnpackPath)print(' test solr example w/ Java 11...')- testSolrExample(java11UnpackPath, java.java11_home)+ testSolrExample(java11UnpackPath, java.java11_home, isSlim)if java.run_java17:print(' copying unpacked distribution for Java 17 ...')@@ -700,7 +700,7 @@ def verifyUnpacked(java, artifact, unpackPath, gitRevision, version, testArgs):shutil.copytree(unpackPath, java17UnpackPath)os.chdir(java17UnpackPath)print(' test solr example w/ Java 17...')- testSolrExample(java17UnpackPath, java.java17_home)+ testSolrExample(java17UnpackPath, java.java17_home, isSlim)os.chdir(unpackPath)@@ -742,7 +742,7 @@ def is_port_in_use(port):with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:return s.connect_ex(('localhost', port)) == 0-def testSolrExample(binaryDistPath, javaPath):+def testSolrExample(binaryDistPath, javaPath, isSlim):# test solr using some examples it comes withlogFile = '%s/solr-example.log' % binaryDistPathold_cwd = os.getcwd() # So we can back-track@@ -754,6 +754,10 @@ def testSolrExample(binaryDistPath, javaPath):env['JAVA_HOME'] = javaPathenv['PATH'] = '%s/bin:%s' % (javaPath, env['PATH'])+ example = "techproducts"+ if isSlim:+ example = "films"+# Stop Solr running on port 8983 (in case a previous run didn't shutdown cleanly)try:if not cygwin:@@ -763,20 +767,20 @@ def testSolrExample(binaryDistPath, javaPath):except:print(' Stop failed due to: '+sys.exc_info()[0])- print(' Running techproducts example on port 8983 from %s' % binaryDistPath)+ print(' Running %s example on port 8983 from %s' % (example, binaryDistPath))try:if not cygwin:- runExampleStatus = subprocess.call(['bin/solr','start','-e','techproducts'])+ runExampleStatus = subprocess.call(['bin/solr','start','-e',example])else:- runExampleStatus = subprocess.call('env "PATH=`cygpath -S -w`:$PATH" bin/solr.cmd -e techproducts', shell=True)+ runExampleStatus = subprocess.call('env "PATH=`cygpath -S -w`:$PATH" bin/solr.cmd -e ' + example, shell=True)if runExampleStatus != 0:- raise RuntimeError('Failed to run the techproducts example, check log for previous errors.')+ raise RuntimeError('Failed to run the %s example, check log for previous errors.' % example)os.chdir('example')print(' run query...')- s = load('http://localhost:8983/solr/techproducts/select/?q=video')- if s.find('"numFound":3,') == -1:+ s = load('http://localhost:8983/solr/%s/select/?q=video' % example)+ if s.find('"numFound":%d,' % (8 if isSlim else 3)) == -1:print('FAILED: response is:\n%s' % s)raise RuntimeError('query on solr example instance failed')s = load('http://localhost:8983/api/cores')diff --git a/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java b/solr/core/src/java/org/apache/solr/cli/RunExampleTool.javaindex a3e1cc39f71..b0d02b9f997 100644--- a/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java+++ b/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java@@ -382,7 +382,8 @@ public class RunExampleTool extends ToolBase {+ " }\n"+ " }");- echo("Adding name, initial_release_date, and film_vector fields to films schema");+ echo(+ "Adding name, genre, directed_by, initial_release_date, and film_vector fields to films schema");SolrCLI.postJsonToSolr(solrClient,"/" + collectionName + "/schema",@@ -394,6 +395,18 @@ public class RunExampleTool extends ToolBase {+ " \"stored\":true\n"+ " },\n"+ " \"add-field\" : {\n"+ + " \"name\":\"genre\",\n"+ + " \"type\":\"text_general\",\n"+ + " \"multiValued\":true,\n"+ + " \"stored\":true\n"+ + " },\n"+ + " \"add-field\" : {\n"+ + " \"name\":\"directed_by\",\n"+ + " \"type\":\"text_general\",\n"+ + " \"multiValued\":true,\n"+ + " \"stored\":true\n"+ + " },\n"+ + " \"add-field\" : {\n"+ " \"name\":\"initial_release_date\",\n"+ " \"type\":\"pdate\",\n"+ " \"stored\":true\n"@@ -403,6 +416,18 @@ public class RunExampleTool extends ToolBase {+ " \"type\":\"knn_vector_10\",\n"+ " \"indexed\":true\n"+ " \"stored\":true\n"+ + " },\n"+ + " \"add-copy-field\" : {\n"+ + " \"source\":\"genre\",\n"+ + " \"dest\":\"_text_\"\n"+ + " },\n"+ + " \"add-copy-field\" : {\n"+ + " \"source\":\"name\",\n"+ + " \"dest\":\"_text_\"\n"+ + " },\n"+ + " \"add-copy-field\" : {\n"+ + " \"source\":\"directed_by\",\n"+ + " \"dest\":\"_text_\"\n"+ " }\n"+ " }");