diff --git a/test/plugin/containers/jvm-container/docker/run.sh b/test/plugin/containers/jvm-container/docker/run.sh index e9f45a43c..b8f32fef9 100644 --- a/test/plugin/containers/jvm-container/docker/run.sh +++ b/test/plugin/containers/jvm-container/docker/run.sh @@ -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} diff --git a/test/plugin/containers/tomcat-container/docker/run.sh b/test/plugin/containers/tomcat-container/docker/run.sh index 644864325..b1b82e295 100644 --- a/test/plugin/containers/tomcat-container/docker/run.sh +++ b/test/plugin/containers/tomcat-container/docker/run.sh @@ -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 diff --git a/test/plugin/scenarios/solrj-7.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/solrj-7.x-scenario/config/expectedData.yaml index 85e9086dc..ed3a2dab9 100644 --- a/test/plugin/scenarios/solrj-7.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/solrj-7.x-scenario/config/expectedData.yaml @@ -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 @@ -178,4 +160,4 @@ segmentItems: peerId: 0 tags: - {key: url, value: 'http://localhost:8080/solrj-scenario/case/solrj'} - - {key: http.method, value: GET} \ No newline at end of file + - {key: http.method, value: GET} diff --git a/test/plugin/scenarios/solrj-7.x-scenario/configuration.yml b/test/plugin/scenarios/solrj-7.x-scenario/configuration.yml index 40693177a..b6cc327cb 100644 --- a/test/plugin/scenarios/solrj-7.x-scenario/configuration.yml +++ b/test/plugin/scenarios/solrj-7.x-scenario/configuration.yml @@ -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} diff --git a/test/plugin/scenarios/solrj-7.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/solrj/controller/CaseController.java b/test/plugin/scenarios/solrj-7.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/solrj/controller/CaseController.java index a8d895890..f9ac40419 100644 --- a/test/plugin/scenarios/solrj-7.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/solrj/controller/CaseController.java +++ b/test/plugin/scenarios/solrj-7.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/solrj/controller/CaseController.java @@ -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; + } }