MCPcopy Create free account
hub / github.com/apache/solr / testSolrExample

Function testSolrExample

dev-tools/scripts/smokeTestRelease.py:717–764  ·  view source on GitHub ↗
(binaryDistPath, javaPath, isSlim)

Source from the content-addressed store, hash-verified

715
716
717def testSolrExample(binaryDistPath, javaPath, isSlim):
718 # test solr using some examples it comes with
719 port = find_available_port()
720 logFile = '%s/solr-example.log' % binaryDistPath
721 old_cwd = os.getcwd() # So we can back-track
722 os.chdir(binaryDistPath)
723
724 print(' start Solr instance on port %d (log=%s)...' % (port, logFile))
725 env = {}
726 env.update(os.environ)
727 env['JAVA_HOME'] = javaPath
728 env['PATH'] = '%s/bin:%s' % (javaPath, env['PATH'])
729
730 example = "techproducts"
731 if isSlim:
732 example = "films"
733
734 print(' Running %s example on port %d from %s' % (example, port, binaryDistPath))
735 try:
736 if not cygwin:
737 runExampleStatus = subprocess.call(['bin/solr','start','-e',example,'-p',str(port)])
738 else:
739 runExampleStatus = subprocess.call('env "PATH=`cygpath -S -w`:$PATH" bin/solr.cmd start -e %s -p %d' % (example, port), shell=True)
740
741 if runExampleStatus != 0:
742 raise RuntimeError('Failed to run the %s example, check log for previous errors.' % example)
743
744 os.chdir('example')
745 print(' run query...')
746 s = load('http://localhost:%d/solr/%s/select/?q=video' % (port, example))
747 if s.find('"numFound":%d,' % (8 if isSlim else 3)) == -1:
748 print('FAILED: response is:\n%s' % s)
749 raise RuntimeError('query on solr example instance failed')
750 s = load('http://localhost:%d/api/cores?wt=json' % port)
751 if s.find('"status":0,') == -1:
752 print('FAILED: response is:\n%s' % s)
753 raise RuntimeError('query api v2 on solr example instance failed')
754 finally:
755 # Stop server:
756 print(' stop server using: bin/solr stop -p %d' % port)
757 os.chdir(binaryDistPath)
758
759 if not cygwin:
760 subprocess.call(['bin/solr','stop','-p',str(port)])
761 else:
762 subprocess.call('env "PATH=`cygpath -S -w`:$PATH" bin/solr.cmd stop -p %d' % port, shell=True)
763
764 os.chdir(old_cwd)
765
766
767def checkMaven(baseURL, tmpDir, gitRevision, version, isSigned, keysFile):

Callers 2

_run_for_javaFunction · 0.85
verifyBinaryUnpackedFunction · 0.85

Calls 5

find_available_portFunction · 0.85
loadFunction · 0.70
updateMethod · 0.65
callMethod · 0.65
findMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…