提交 f1fa7386 编写于 作者: D Daming 提交者: wu-sheng

make plugin test more stable on docker-compose (#3642)

上级 6af2c082
...@@ -33,7 +33,7 @@ function healthCheck() { ...@@ -33,7 +33,7 @@ function healthCheck() {
HEALTH_CHECK_URL=$1 HEALTH_CHECK_URL=$1
STATUS_CODE="-1" STATUS_CODE="-1"
for ((i=1; i<=30; i++)); for ((i=1; i<=150; i++));
do do
STATUS_CODE="$(curl -Is ${HEALTH_CHECK_URL} | head -n 1)" STATUS_CODE="$(curl -Is ${HEALTH_CHECK_URL} | head -n 1)"
if [[ $STATUS_CODE == *"200"* ]]; then if [[ $STATUS_CODE == *"200"* ]]; then
...@@ -72,10 +72,8 @@ export agent_opts="-javaagent:${SCENARIO_HOME}/agent/skywalking-agent.jar ...@@ -72,10 +72,8 @@ export agent_opts="-javaagent:${SCENARIO_HOME}/agent/skywalking-agent.jar
-Dskywalking.logging.dir=/usr/local/skywalking/scenario/logs -Dskywalking.logging.dir=/usr/local/skywalking/scenario/logs
-Xms256m -Xmx256m ${agent_opts}" -Xms256m -Xmx256m ${agent_opts}"
exec /var/run/${SCENARIO_NAME}/${SCENARIO_START_SCRIPT} 1>/dev/null & exec /var/run/${SCENARIO_NAME}/${SCENARIO_START_SCRIPT} 1>/dev/null &
for HEALTH_CHECK_URL in ${SCENARIO_HEALTH_CHECK_URL};
do healthCheck ${SCENARIO_HEALTH_CHECK_URL}
healthCheck $HEALTH_CHECK_URL
done
echo "To visit entry service" echo "To visit entry service"
curl -s ${SCENARIO_ENTRY_SERVICE} curl -s ${SCENARIO_ENTRY_SERVICE}
......
...@@ -30,7 +30,7 @@ function exitAndClean() { ...@@ -30,7 +30,7 @@ function exitAndClean() {
function healthCheck() { function healthCheck() {
HEALTH_CHECK_URL=$1 HEALTH_CHECK_URL=$1
for ((i=1; i<=30; i++)); for ((i=1; i<=150; i++));
do do
STATUS_CODE="$(curl -Is ${HEALTH_CHECK_URL} | head -n 1)" STATUS_CODE="$(curl -Is ${HEALTH_CHECK_URL} | head -n 1)"
if [[ $STATUS_CODE == *"200"* ]]; then if [[ $STATUS_CODE == *"200"* ]]; then
......
...@@ -21,30 +21,12 @@ registryItems: ...@@ -21,30 +21,12 @@ registryItems:
operationNames: operationNames:
- solrj-7.x-scenario: [/solrj-scenario/case/solrj, solrJ/mycore/update/COMMIT, solrJ/mycore/update/DELETE_BY_IDS, - 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/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: [] heartbeat: []
segmentItems: segmentItems:
- applicationCode: solrj-7.x-scenario - applicationCode: solrj-7.x-scenario
segmentSize: 2 segmentSize: gt 1
segments: 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 - segmentId: not null
spans: spans:
- operationName: solrJ/mycore/update/ADD - operationName: solrJ/mycore/update/ADD
...@@ -178,4 +160,4 @@ segmentItems: ...@@ -178,4 +160,4 @@ segmentItems:
peerId: 0 peerId: 0
tags: tags:
- {key: url, value: 'http://localhost:8080/solrj-scenario/case/solrj'} - {key: url, value: 'http://localhost:8080/solrj-scenario/case/solrj'}
- {key: http.method, value: GET} - {key: http.method, value: GET}
\ No newline at end of file
...@@ -15,11 +15,13 @@ ...@@ -15,11 +15,13 @@
type: jvm type: jvm
entryService: http://localhost:8080/solrj-scenario/case/solrj 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 startScript: ./bin/startup.sh
framework: solrj framework: solrj
environment: environment:
- SOLR_SERVER=solr-server:8983 - SOLR_SERVER=solr-server:8983
depends_on:
- solr-server
dependencies: dependencies:
solr-server: solr-server:
image: solr:${CASE_SERVER_IMAGE_VERSION} image: solr:${CASE_SERVER_IMAGE_VERSION}
......
...@@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
@RestController @RestController
@RequestMapping("/solrj-scenario/case") @RequestMapping("/solrj-scenario/case")
...@@ -48,7 +49,20 @@ public class CaseController { ...@@ -48,7 +49,20 @@ public class CaseController {
@GetMapping("/healthcheck") @GetMapping("/healthcheck")
public String healthcheck() throws Exception { 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;
}
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册