diff --git a/Jenkinsfile-Agent-Test b/Jenkinsfile-Agent-Test index 69df4c499..cdaa3d522 100755 --- a/Jenkinsfile-Agent-Test +++ b/Jenkinsfile-Agent-Test @@ -104,12 +104,6 @@ pipeline { sh 'bash test/plugin/run.sh --build_id=wl1_${BUILD_ID} spring-async-scenario' } } - - stage('netty-socketio 1.x (4)') { - steps { - sh 'bash test/plugin/run.sh --build_id=wl1_${BUILD_ID} netty-socketio-scenario' - } - } } } stage('Group2') { @@ -131,4 +125,4 @@ pipeline { deleteDir() } } -} \ No newline at end of file +} diff --git a/test/plugin/containers/jvm-container/docker/run.sh b/test/plugin/containers/jvm-container/docker/run.sh index de7e5fd50..d2d5cd956 100644 --- a/test/plugin/containers/jvm-container/docker/run.sh +++ b/test/plugin/containers/jvm-container/docker/run.sh @@ -31,10 +31,10 @@ function exitAndClean() { function healthCheck() { HEALTH_CHECK_URL=$1 STATUS_CODE="-1" - - for ((i=1; i<=150; i++)); + TIMES=${TIMES:-150} + for ((i=1; i<=${TIMES}; i++)); do - STATUS_CODE="$(curl -Is ${HEALTH_CHECK_URL} | head -n 1)" + STATUS_CODE="$(curl --max-time 3 -Is ${HEALTH_CHECK_URL} | head -n 1)" if [[ $STATUS_CODE == *"200"* ]]; then echo "${HEALTH_CHECK_URL}: ${STATUS_CODE}" return 0 @@ -72,14 +72,15 @@ export agent_opts="-javaagent:${SCENARIO_HOME}/agent/skywalking-agent.jar -Xms256m -Xmx256m ${agent_opts}" exec /var/run/${SCENARIO_NAME}/${SCENARIO_START_SCRIPT} 1>/dev/null & +healthCheck http://localhost:12800/status healthCheck ${SCENARIO_HEALTH_CHECK_URL} echo "To visit entry service" -curl -s ${SCENARIO_ENTRY_SERVICE} +curl -s --max-time 3 ${SCENARIO_ENTRY_SERVICE} sleep 5 echo "To receive actual data" -curl -s http://localhost:12800/receiveData > ${SCENARIO_HOME}/data/actualData.yaml +curl -s --max-time 3 http://localhost:12800/receiveData > ${SCENARIO_HOME}/data/actualData.yaml [[ ! -f ${SCENARIO_HOME}/data/actualData.yaml ]] && exitOnError "${SCENARIO_NAME}-${SCENARIO_VERSION}, 'actualData.yaml' Not Found!" echo "To validate" diff --git a/test/plugin/containers/tomcat-container/docker/run.sh b/test/plugin/containers/tomcat-container/docker/run.sh index f4d8b452f..c864fc3ac 100644 --- a/test/plugin/containers/tomcat-container/docker/run.sh +++ b/test/plugin/containers/tomcat-container/docker/run.sh @@ -30,9 +30,10 @@ function exitAndClean() { function healthCheck() { HEALTH_CHECK_URL=$1 - for ((i=1; i<=150; i++)); + TIMES=${TIMES:-150} + for ((i=1; i<=${TIMES}; i++)); do - STATUS_CODE="$(curl -Is ${HEALTH_CHECK_URL} | head -n 1)" + STATUS_CODE="$(curl --max-time 3 -Is ${HEALTH_CHECK_URL} | head -n 1)" if [[ $STATUS_CODE == *"200"* ]]; then echo "${HEALTH_CHECK_URL}: ${STATUS_CODE}" return 0 @@ -60,14 +61,16 @@ healthCheck http://localhost:12800/receiveData echo "To start tomcat" /usr/local/tomcat/bin/catalina.sh start 1>/dev/null & + +healthCheck http://localhost:12800/status 10 healthCheck ${SCENARIO_HEALTH_CHECK_URL} echo "To visit entry service" -curl -s ${SCENARIO_ENTRY_SERVICE} +curl -s --max-time 3 ${SCENARIO_ENTRY_SERVICE} sleep 5 echo "To receive actual data" -curl -s http://localhost:12800/receiveData > ${SCENARIO_HOME}/data/actualData.yaml +curl -s --max-time 3 http://localhost:12800/receiveData > ${SCENARIO_HOME}/data/actualData.yaml [[ ! -f ${SCENARIO_HOME}/data/actualData.yaml ]] && exitOnError "${SCENARIO_NAME}-${SCENARIO_VERSION}, 'actualData.yaml' Not Found!" echo "To validate" diff --git a/test/plugin/mock-collector/src/main/java/org/apache/skywalking/plugin/test/mockcollector/Main.java b/test/plugin/mock-collector/src/main/java/org/apache/skywalking/plugin/test/mockcollector/Main.java index 419348443..a49b5478a 100644 --- a/test/plugin/mock-collector/src/main/java/org/apache/skywalking/plugin/test/mockcollector/Main.java +++ b/test/plugin/mock-collector/src/main/java/org/apache/skywalking/plugin/test/mockcollector/Main.java @@ -19,11 +19,19 @@ package org.apache.skywalking.plugin.test.mockcollector; import io.grpc.netty.NettyServerBuilder; import io.netty.channel.local.LocalAddress; +import java.io.IOException; import java.net.InetSocketAddress; +import org.apache.skywalking.plugin.test.mockcollector.entity.ValidateData; import org.apache.skywalking.plugin.test.mockcollector.service.*; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.servlet.ServletHolder; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; public class Main { public static void main(String[] args) throws Exception { @@ -47,6 +55,18 @@ public class Main { String contextPath = "/"; ServletContextHandler servletContextHandler = new ServletContextHandler(ServletContextHandler.NO_SESSIONS); servletContextHandler.setContextPath(contextPath); + servletContextHandler.addServlet(new ServletHolder(new HttpServlet() { + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + if (ValidateData.INSTANCE.getRegistryItem().getApplications().isEmpty()) { + resp.setStatus(500); + return; + } + resp.setStatus(200); + resp.getWriter().write("Success"); + resp.getWriter().flush(); + } + }), "/status"); servletContextHandler.addServlet(GrpcAddressHttpService.class, GrpcAddressHttpService.SERVLET_PATH); servletContextHandler.addServlet(ReceiveDataService.class, ReceiveDataService.SERVLET_PATH); servletContextHandler.addServlet(ClearReceiveDataService.class, ClearReceiveDataService.SERVLET_PATH); diff --git a/test/plugin/mock-collector/src/main/java/org/apache/skywalking/plugin/test/mockcollector/entity/RegistryItem.java b/test/plugin/mock-collector/src/main/java/org/apache/skywalking/plugin/test/mockcollector/entity/RegistryItem.java index 5dec61819..18a0dbaa7 100644 --- a/test/plugin/mock-collector/src/main/java/org/apache/skywalking/plugin/test/mockcollector/entity/RegistryItem.java +++ b/test/plugin/mock-collector/src/main/java/org/apache/skywalking/plugin/test/mockcollector/entity/RegistryItem.java @@ -22,6 +22,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import org.apache.skywalking.apm.network.language.agent.SpanType; @@ -44,10 +45,10 @@ public class RegistryItem { private final Map heartBeats; public RegistryItem() { - applications = new HashMap<>(); - operationNames = new HashMap<>(); - instanceMapping = new HashMap<>(); - heartBeats = new HashMap<>(); + applications = new ConcurrentHashMap<>(); + operationNames = new ConcurrentHashMap<>(); + instanceMapping = new ConcurrentHashMap<>(); + heartBeats = new ConcurrentHashMap<>(); } public void registryApplication(Application application) { diff --git a/test/plugin/mock-collector/src/main/java/org/apache/skywalking/plugin/test/mockcollector/service/MockCLRMetricReportService.java b/test/plugin/mock-collector/src/main/java/org/apache/skywalking/plugin/test/mockcollector/service/MockCLRMetricReportService.java index 95b57c34f..55f564935 100644 --- a/test/plugin/mock-collector/src/main/java/org/apache/skywalking/plugin/test/mockcollector/service/MockCLRMetricReportService.java +++ b/test/plugin/mock-collector/src/main/java/org/apache/skywalking/plugin/test/mockcollector/service/MockCLRMetricReportService.java @@ -16,6 +16,9 @@ */ package org.apache.skywalking.plugin.test.mockcollector.service; +import io.grpc.stub.StreamObserver; +import org.apache.skywalking.apm.network.common.Commands; +import org.apache.skywalking.apm.network.language.agent.v2.CLRMetricCollection; import org.apache.skywalking.apm.network.language.agent.v2.CLRMetricReportServiceGrpc; /** @@ -24,4 +27,9 @@ import org.apache.skywalking.apm.network.language.agent.v2.CLRMetricReportServic **/ public class MockCLRMetricReportService extends CLRMetricReportServiceGrpc.CLRMetricReportServiceImplBase { + @Override + public void collect(CLRMetricCollection request, StreamObserver responseObserver) { + responseObserver.onNext(Commands.newBuilder().build()); + responseObserver.onCompleted(); + } } diff --git a/test/plugin/mock-collector/src/main/java/org/apache/skywalking/plugin/test/mockcollector/service/MockJVMMetricReportService.java b/test/plugin/mock-collector/src/main/java/org/apache/skywalking/plugin/test/mockcollector/service/MockJVMMetricReportService.java index dbc8826cb..64f6545e0 100644 --- a/test/plugin/mock-collector/src/main/java/org/apache/skywalking/plugin/test/mockcollector/service/MockJVMMetricReportService.java +++ b/test/plugin/mock-collector/src/main/java/org/apache/skywalking/plugin/test/mockcollector/service/MockJVMMetricReportService.java @@ -16,6 +16,9 @@ */ package org.apache.skywalking.plugin.test.mockcollector.service; +import io.grpc.stub.StreamObserver; +import org.apache.skywalking.apm.network.common.Commands; +import org.apache.skywalking.apm.network.language.agent.v2.JVMMetricCollection; import org.apache.skywalking.apm.network.language.agent.v2.JVMMetricReportServiceGrpc; /** @@ -24,4 +27,9 @@ import org.apache.skywalking.apm.network.language.agent.v2.JVMMetricReportServic **/ public class MockJVMMetricReportService extends JVMMetricReportServiceGrpc.JVMMetricReportServiceImplBase { + @Override + public void collect(JVMMetricCollection request, StreamObserver responseObserver) { + responseObserver.onNext(Commands.newBuilder().build()); + responseObserver.onCompleted(); + } } diff --git a/test/plugin/scenarios/dubbo-2.5.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/dubbo-2.5.x-scenario/config/expectedData.yaml index 1969a5831..763c7721a 100644 --- a/test/plugin/scenarios/dubbo-2.5.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/dubbo-2.5.x-scenario/config/expectedData.yaml @@ -23,7 +23,7 @@ registryItems: heartbeat: [] segmentItems: - applicationCode: dubbo-2.5.x-scenario - segmentSize: 3 + segmentSize: ge 3 segments: - segmentId: not null spans: diff --git a/test/plugin/scenarios/dubbo-2.7.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/dubbo-2.7.x-scenario/config/expectedData.yaml index 747f02723..bd29f26c4 100644 --- a/test/plugin/scenarios/dubbo-2.7.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/dubbo-2.7.x-scenario/config/expectedData.yaml @@ -25,7 +25,7 @@ registryItems: heartbeat: [] segmentItems: - applicationCode: dubbo-2.7.x-scenario - segmentSize: 3 + segmentSize: ge 3 segments: - segmentId: not null spans: diff --git a/test/plugin/scenarios/ehcache-2.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/ehcache-2.x-scenario/config/expectedData.yaml index 0562b9ab7..489f1f910 100644 --- a/test/plugin/scenarios/ehcache-2.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/ehcache-2.x-scenario/config/expectedData.yaml @@ -23,26 +23,8 @@ registryItems: heartbeat: [] segmentItems: - applicationCode: ehcache-2.x-scenario - segmentSize: 2 + segmentSize: ge 2 segments: - - segmentId: not null - spans: - - operationName: /ehcache-2.x-scenario/healthCheck - operationId: 0 - parentSpanId: -1 - spanId: 0 - spanLayer: Http - startTime: nq 0 - endTime: nq 0 - componentId: 1 - componentName: '' - isError: false - spanType: Entry - peer: '' - peerId: 0 - tags: - - {key: url, value: 'http://localhost:8080/ehcache-2.x-scenario/healthCheck'} - - {key: http.method, value: HEAD} - segmentId: not null spans: - operationName: Ehcache/put/testCache diff --git a/test/plugin/scenarios/httpclient-4.3.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/httpclient-4.3.x-scenario/config/expectedData.yaml index 74d170ee3..6ffec1b23 100644 --- a/test/plugin/scenarios/httpclient-4.3.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/httpclient-4.3.x-scenario/config/expectedData.yaml @@ -25,26 +25,8 @@ registryItems: heartbeat: [] segmentItems: - applicationCode: httpclient-4.3.x-scenario - segmentSize: 3 + segmentSize: ge 3 segments: - - segmentId: not null - spans: - - operationName: /httpclient-4.3.x-scenario/healthCheck - operationId: 0 - parentSpanId: -1 - spanId: 0 - spanLayer: Http - startTime: nq 0 - endTime: nq 0 - componentId: 1 - componentName: '' - isError: false - spanType: Entry - peer: '' - peerId: 0 - tags: - - {key: url, value: 'http://localhost:8080/httpclient-4.3.x-scenario/healthCheck'} - - {key: http.method, value: HEAD} - segmentId: not null spans: - operationName: /httpclient-4.3.x-scenario/case/context-propagate diff --git a/test/plugin/scenarios/spring-3.0.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/spring-3.0.x-scenario/config/expectedData.yaml index 22ed29b2d..6390235ed 100644 --- a/test/plugin/scenarios/spring-3.0.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/spring-3.0.x-scenario/config/expectedData.yaml @@ -23,7 +23,7 @@ registryItems: heartbeat: [] segmentItems: - applicationCode: spring-3.0.x-scenario - segmentSize: 2 + segmentSize: ge 2 segments: - segmentId: not null spans: diff --git a/test/plugin/scenarios/spring-3.1.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/spring-3.1.x-scenario/config/expectedData.yaml index fdba07915..b9444923c 100644 --- a/test/plugin/scenarios/spring-3.1.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/spring-3.1.x-scenario/config/expectedData.yaml @@ -26,7 +26,7 @@ registryItems: heartbeat: [] segmentItems: - applicationCode: spring-3.1.x-scenario - segmentSize: 7 + segmentSize: ge 7 segments: - segmentId: not null spans: diff --git a/test/plugin/scenarios/spring-4.1.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/spring-4.1.x-scenario/config/expectedData.yaml index b73b99ed8..33757eead 100644 --- a/test/plugin/scenarios/spring-4.1.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/spring-4.1.x-scenario/config/expectedData.yaml @@ -26,7 +26,7 @@ registryItems: heartbeat: [] segmentItems: - applicationCode: spring-4.1.x-scenario - segmentSize: 7 + segmentSize: ge 7 segments: - segmentId: not null spans: diff --git a/test/plugin/scenarios/spring-4.3.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/spring-4.3.x-scenario/config/expectedData.yaml index dfe78d4a2..73c8f7abd 100644 --- a/test/plugin/scenarios/spring-4.3.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/spring-4.3.x-scenario/config/expectedData.yaml @@ -27,7 +27,7 @@ registryItems: heartbeat: [] segmentItems: - applicationCode: spring-4.3.x-scenario - segmentSize: 8 + segmentSize: ge 8 segments: - segmentId: not null spans: diff --git a/test/plugin/scenarios/spring-async-scenario/config/expectedData.yaml b/test/plugin/scenarios/spring-async-scenario/config/expectedData.yaml index f546ea011..4bb71b0e3 100644 --- a/test/plugin/scenarios/spring-async-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/spring-async-scenario/config/expectedData.yaml @@ -24,7 +24,7 @@ registryItems: heartbeat: [] segmentItems: - applicationCode: spring-async-scenario - segmentSize: 4 + segmentSize: ge 4 segments: - segmentId: not null spans: