make plugin test more stable on docker-compose (#3642)
This commit is contained in:
parent
6af2c08204
commit
f1fa738658
|
|
@ -33,7 +33,7 @@ function healthCheck() {
|
|||
HEALTH_CHECK_URL=$1
|
||||
STATUS_CODE="-1"
|
||||
|
||||
for ((i=1; i<=30; i++));
|
||||
for ((i=1; i<=150; i++));
|
||||
do
|
||||
STATUS_CODE="$(curl -Is ${HEALTH_CHECK_URL} | head -n 1)"
|
||||
if [[ $STATUS_CODE == *"200"* ]]; then
|
||||
|
|
@ -72,10 +72,8 @@ export agent_opts="-javaagent:${SCENARIO_HOME}/agent/skywalking-agent.jar
|
|||
-Dskywalking.logging.dir=/usr/local/skywalking/scenario/logs
|
||||
-Xms256m -Xmx256m ${agent_opts}"
|
||||
exec /var/run/${SCENARIO_NAME}/${SCENARIO_START_SCRIPT} 1>/dev/null &
|
||||
for HEALTH_CHECK_URL in ${SCENARIO_HEALTH_CHECK_URL};
|
||||
do
|
||||
healthCheck $HEALTH_CHECK_URL
|
||||
done
|
||||
|
||||
healthCheck ${SCENARIO_HEALTH_CHECK_URL}
|
||||
|
||||
echo "To visit entry service"
|
||||
curl -s ${SCENARIO_ENTRY_SERVICE}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ function exitAndClean() {
|
|||
function healthCheck() {
|
||||
HEALTH_CHECK_URL=$1
|
||||
|
||||
for ((i=1; i<=30; i++));
|
||||
for ((i=1; i<=150; i++));
|
||||
do
|
||||
STATUS_CODE="$(curl -Is ${HEALTH_CHECK_URL} | head -n 1)"
|
||||
if [[ $STATUS_CODE == *"200"* ]]; then
|
||||
|
|
|
|||
|
|
@ -21,30 +21,12 @@ registryItems:
|
|||
operationNames:
|
||||
- solrj-7.x-scenario: [/solrj-scenario/case/solrj, solrJ/mycore/update/COMMIT, solrJ/mycore/update/DELETE_BY_IDS,
|
||||
solrJ/mycore/select, solrJ/mycore/update/DELETE_BY_QUERY, solrJ/mycore/get,
|
||||
/solrj-scenario/case/healthcheck, solrJ/mycore/update/OPTIMIZE, solrJ/mycore/update/ADD]
|
||||
solrJ/mycore/update/OPTIMIZE, solrJ/mycore/update/ADD]
|
||||
heartbeat: []
|
||||
segmentItems:
|
||||
- applicationCode: solrj-7.x-scenario
|
||||
segmentSize: 2
|
||||
segmentSize: gt 1
|
||||
segments:
|
||||
- segmentId: not null
|
||||
spans:
|
||||
- operationName: /solrj-scenario/case/healthcheck
|
||||
operationId: 0
|
||||
parentSpanId: -1
|
||||
spanId: 0
|
||||
spanLayer: Http
|
||||
startTime: gt 0
|
||||
endTime: gt 0
|
||||
componentId: 1
|
||||
componentName: ''
|
||||
isError: false
|
||||
spanType: Entry
|
||||
peer: ''
|
||||
peerId: 0
|
||||
tags:
|
||||
- {key: url, value: 'http://localhost:8080/solrj-scenario/case/healthcheck'}
|
||||
- {key: http.method, value: HEAD}
|
||||
- segmentId: not null
|
||||
spans:
|
||||
- operationName: solrJ/mycore/update/ADD
|
||||
|
|
|
|||
|
|
@ -15,11 +15,13 @@
|
|||
|
||||
type: jvm
|
||||
entryService: http://localhost:8080/solrj-scenario/case/solrj
|
||||
healthCheck: "http://solr-server:8983/solr/mycore/select http://localhost:8080/solrj-scenario/case/healthcheck"
|
||||
healthCheck: http://localhost:8080/solrj-scenario/case/healthcheck
|
||||
startScript: ./bin/startup.sh
|
||||
framework: solrj
|
||||
environment:
|
||||
- SOLR_SERVER=solr-server:8983
|
||||
depends_on:
|
||||
- solr-server
|
||||
dependencies:
|
||||
solr-server:
|
||||
image: solr:${CASE_SERVER_IMAGE_VERSION}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/solrj-scenario/case")
|
||||
|
|
@ -48,7 +49,20 @@ public class CaseController {
|
|||
|
||||
@GetMapping("/healthcheck")
|
||||
public String healthcheck() throws Exception {
|
||||
return "Success";
|
||||
ModifiableSolrParams params = new ModifiableSolrParams();
|
||||
params.set(CommonParams.Q, "*:*");
|
||||
params.set(CommonParams.OMIT_HEADER, true);
|
||||
|
||||
HttpSolrClient client = getClient();
|
||||
try {
|
||||
QueryResponse response = client.query(collection, params);
|
||||
if (response.getStatus() == 0) {
|
||||
return "Success";
|
||||
}
|
||||
throw new Exception(response.toString());
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue