Skip to content

Commit

Permalink
Merge branch 'master' into canal-scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
arugal committed Oct 20, 2019
2 parents 9656c3d + c0acccf commit 23d9240
Show file tree
Hide file tree
Showing 14 changed files with 102 additions and 48 deletions.
34 changes: 26 additions & 8 deletions Jenkinsfile-E2E
Original file line number Diff line number Diff line change
Expand Up @@ -63,31 +63,49 @@ pipeline {
parallel {
stage('Group 1') {
stages {
stage('Single Node Tests') {
stage('Single Node Tests(JDK8)') {
steps {
sh 'bash -x test/e2e/run.sh e2e-single-service'
sh 'E2E_VERSION=jdk8-1.3 bash -x test/e2e/run.sh e2e-single-service'
}
}

stage('Agent Reboot Tests') {
stage('Single Node Tests(JDK9)') {
steps {
sh 'bash -x test/e2e/run.sh e2e-agent-reboot'
sh 'E2E_VERSION=jdk9-1.3 bash -x test/e2e/run.sh e2e-single-service'
}
}

stage('Single Node Tests(JDK11)') {
steps {
sh 'E2E_VERSION=jdk11-1.3 bash -x test/e2e/run.sh e2e-single-service'
}
}

stage('Single Node Tests(JDK12)') {
steps {
sh 'E2E_VERSION=jdk12-1.3 bash -x test/e2e/run.sh e2e-single-service'
}
}

stage('Agent Reboot Tests(JDK8)') {
steps {
sh 'E2E_VERSION=jdk8-1.3 bash -x test/e2e/run.sh e2e-agent-reboot'
}
}
}
}

stage('Group 2') {
stages {
stage('Cluster Tests (ES6/ZK)') {
stage('Cluster Tests (ES6/ZK/JDK8)') {
steps {
sh 'bash -x test/e2e/run.sh e2e-cluster/test-runner'
sh 'E2E_VERSION=jdk8-1.3 bash -x test/e2e/run.sh e2e-cluster/test-runner'
}
}

stage('TTL ES Tests') {
stage('TTL ES Tests(JDK8)') {
steps {
sh 'bash -x test/e2e/run.sh e2e-ttl/e2e-ttl-es'
sh 'E2E_VERSION=jdk8-1.3 bash -x test/e2e/run.sh e2e-ttl/e2e-ttl-es'
}
}
}
Expand Down
6 changes: 0 additions & 6 deletions apm-webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@
<artifactId>spring-boot-configuration-processor</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
Expand All @@ -100,7 +95,6 @@
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback-classic.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

Expand Down
7 changes: 3 additions & 4 deletions test/e2e/e2e-agent-reboot/src/docker/rc.d/rc0-prepare.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
# Licensed to the SkyAPM under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
Expand All @@ -14,19 +15,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#!/usr/bin/env bash

# in order to make it easier to restart the OAP (by executing the restart script) from outside (container),
# we'll expose a tcp port and whenever we receive a message on that port, we'll restart the OAP server,
# socat will help on this to execute the script when receiving a message on that port

apk update && apk add socat
apt-get update && apt-get -y install socat

# socat will execute the command in a new shell, thus won't catch the original functions' declarations
# so we'll put the restart command in a script file

echo '
ps -ef | grep -v grep | grep oap.logDir | awk '"'"'{print $1}'"'"' | xargs --no-run-if-empty kill -9
ps -ef | grep -v grep | grep oap.logDir | awk '"'"'{print $2}'"'"' | xargs --no-run-if-empty kill -9
rm -rf /tmp/oap/trace_buffer1
rm -rf /tmp/oap/mesh_buffer1
echo "restarting OAP server..." \
Expand Down
3 changes: 1 addition & 2 deletions test/e2e/e2e-agent-reboot/src/docker/rc.d/rc1-startup.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
# Licensed to the SkyAPM under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
Expand All @@ -14,8 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#!/usr/bin/env bash

# set up the tcp server to listen for the restart command

socat -u tcp-l:9091,fork system:'bash restart_oap' &
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
# Licensed to the SkyAPM under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
Expand All @@ -14,14 +15,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#!/usr/bin/env bash
apt-get update && apt-get install -y gawk

if test "${MODE}" = "cluster"; then
original_wd=$(pwd)

# substitute application.yml to be capable of cluster mode
cd ${SW_HOME}/config \
&& awk -f /clusterize.awk application.yml > clusterized_app.yml \
&& gawk -f /clusterize.awk application.yml > clusterized_app.yml \
&& mv clusterized_app.yml application.yml \
&& echo '
gateways:
Expand All @@ -35,7 +36,7 @@ gateways:
&& mv log4j2debuggable.xml log4j2.xml

cd ${SW_HOME}/webapp \
&& awk '/^\s+listOfServers:/ {gsub("listOfServers:.*", "listOfServers: 127.0.0.1:12800,127.0.0.1:12801", $0)} {print}' webapp.yml > clusterized_webapp.yml \
&& gawk '/^\s+listOfServers:/ {gsub("listOfServers:.*", "listOfServers: 127.0.0.1:12800,127.0.0.1:12801", $0)} {print}' webapp.yml > clusterized_webapp.yml \
&& mv clusterized_webapp.yml webapp.yml

cd ${original_wd}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
# Licensed to the SkyAPM under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
Expand All @@ -14,8 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#!/usr/bin/env bash

echo 'starting gateway service...' \
&& java -jar /home/gateway-1.0.0.jar 2>&1 > /tmp/gateway.log &

Expand Down
5 changes: 3 additions & 2 deletions test/e2e/e2e-single-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,14 @@
<INSTRUMENTED_SERVICE>${project.build.finalName}.jar</INSTRUMENTED_SERVICE>
</env>
<ports>
<port>+webapp.host:webapp.port:8080</port>
<port>+webapp.host:webapp.port:8081</port>
<port>+client.host:client.port:9090</port>
</ports>
<volumes>
<bind>
<volume>${sw.home}:/skywalking</volume>
<volume>${sw.home}:/sw</volume>
<volume>${project.build.directory}:/home</volume>
<volume>${project.basedir}/src/docker/rc.d:/rc.d:ro</volume>
</bind>
</volumes>
<wait>
Expand Down
40 changes: 40 additions & 0 deletions test/e2e/e2e-single-service/src/docker/rc.d/rc1-startup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
# Licensed to the SkyAPM under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

echo 'starting OAP server...' && start_oap 'init'

echo 'starting Web app...' && start_webapp '0.0.0.0' 8081

echo 'starting instrumented services...' && start_instrumented_services

check_tcp 127.0.0.1 \
9090 \
60 \
10 \
"waiting for the instrumented service to be ready"

if [[ $? -ne 0 ]]; then
echo "instrumented service 0 failed to start in 30 * 10 seconds: "
cat ${SERVICE_LOG}/*
exit 1
fi

echo "SkyWalking e2e container is ready for tests"

tail -f ${OAP_LOG_DIR}/* \
${WEBAPP_LOG_DIR}/* \
${SERVICE_LOG}/*
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public void verify() throws Exception {
user,
String.class
);
LOGGER.info("responseEntity: {}", responseEntity);
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK);
final List<Trace> traces = queryClient.traces(
new TracesQuery()
Expand Down Expand Up @@ -150,6 +151,7 @@ private void verifyTopo(LocalDateTime minutesAgo) throws Exception {
.start(minutesAgo.minusDays(1))
.end(now)
);
LOGGER.info("topoData: {}", topoData);

InputStream expectedInputStream =
new ClassPathResource("expected-data/org.apache.skywalking.e2e.SampleVerificationITCase.topo.yml").getInputStream();
Expand All @@ -166,6 +168,7 @@ private void verifyServices(LocalDateTime minutesAgo) throws Exception {
.start(minutesAgo)
.end(now)
);
LOGGER.info("services: {}", services);

InputStream expectedInputStream =
new ClassPathResource("expected-data/org.apache.skywalking.e2e.SampleVerificationITCase.services.yml").getInputStream();
Expand Down Expand Up @@ -197,6 +200,7 @@ private Instances verifyServiceInstances(LocalDateTime minutesAgo, LocalDateTime
.start(minutesAgo)
.end(now)
);
LOGGER.info("instances: {}", instances);
expectedInputStream =
new ClassPathResource("expected-data/org.apache.skywalking.e2e.SampleVerificationITCase.instances.yml").getInputStream();
final InstancesMatcher instancesMatcher = new Yaml().loadAs(expectedInputStream, InstancesMatcher.class);
Expand All @@ -209,6 +213,7 @@ private Endpoints verifyServiceEndpoints(LocalDateTime minutesAgo, LocalDateTime
Endpoints instances = queryClient.endpoints(
new EndpointQuery().serviceId(service.getKey())
);
LOGGER.info("instances: {}", instances);
InputStream expectedInputStream =
new ClassPathResource("expected-data/org.apache.skywalking.e2e.SampleVerificationITCase.endpoints.yml").getInputStream();
final EndpointsMatcher endpointsMatcher = new Yaml().loadAs(expectedInputStream, EndpointsMatcher.class);
Expand All @@ -226,6 +231,7 @@ private void verifyInstancesMetrics(Instances instances) throws Exception {
.metricsName(metricsName)
.id(instance.getKey())
);
LOGGER.info("instanceMetrics: {}", instanceMetrics);
AtLeastOneOfMetricsMatcher instanceRespTimeMatcher = new AtLeastOneOfMetricsMatcher();
MetricsValueMatcher greaterThanZero = new MetricsValueMatcher();
greaterThanZero.setValue("gt 0");
Expand All @@ -249,6 +255,7 @@ private void verifyEndpointsMetrics(Endpoints endpoints) throws Exception {
.metricsName(metricName)
.id(endpoint.getKey())
);
LOGGER.info("metrics: {}", metrics);
AtLeastOneOfMetricsMatcher instanceRespTimeMatcher = new AtLeastOneOfMetricsMatcher();
MetricsValueMatcher greaterThanZero = new MetricsValueMatcher();
greaterThanZero.setValue("gt 0");
Expand All @@ -268,6 +275,7 @@ private void verifyServiceMetrics(Service service) throws Exception {
.metricsName(metricName)
.id(service.getKey())
);
LOGGER.info("serviceMetrics: {}", serviceMetrics);
AtLeastOneOfMetricsMatcher instanceRespTimeMatcher = new AtLeastOneOfMetricsMatcher();
MetricsValueMatcher greaterThanZero = new MetricsValueMatcher();
greaterThanZero.setValue("gt 0");
Expand All @@ -286,6 +294,7 @@ private void verifyTraces(LocalDateTime minutesAgo) throws Exception {
.end(now)
.orderByDuration()
);
LOGGER.info("traces: {}", traces);

InputStream expectedInputStream =
new ClassPathResource("expected-data/org.apache.skywalking.e2e.SampleVerificationITCase.traces.yml").getInputStream();
Expand Down
5 changes: 3 additions & 2 deletions test/e2e/e2e-ttl/e2e-ttl-es/src/docker/rc.d/rc0-prepare.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
# Licensed to the SkyAPM under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
Expand All @@ -14,13 +15,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#!/usr/bin/env bash
apt-get update && apt-get install -y gawk

original_wd=$(pwd)

# substitute application.yml to be capable of es mode
cd ${SW_HOME}/config \
&& awk -f /es_storage.awk application.yml > es_storage_app.yml \
&& gawk -f /es_storage.awk application.yml > es_storage_app.yml \
&& mv es_storage_app.yml application.yml \
&& sed '/<Loggers>/a<logger name="org.apache.skywalking.oap.server.storage" level="DEBUG"/>' log4j2.xml > log4j2debuggable.xml \
&& mv log4j2debuggable.xml log4j2.xml
Expand Down
3 changes: 1 addition & 2 deletions test/e2e/e2e-ttl/e2e-ttl-es/src/docker/rc.d/rc1-startup.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
# Licensed to the SkyAPM under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
Expand All @@ -14,8 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#!/usr/bin/env bash

echo 'starting OAP server...' \
&& SW_STORAGE_ES_BULK_ACTIONS=1 \
SW_CORE_DATA_KEEPER_EXECUTE_PERIOD=1 \
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
-->
<build.id>local</build.id>

<e2e.container.version>1.0.0</e2e.container.version>
<e2e.container.version>jdk8-1.0</e2e.container.version>

<maven-failsafe-plugin.version>2.22.0</maven-failsafe-plugin.version>
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
Expand Down
Loading

0 comments on commit 23d9240

Please sign in to comment.