This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new 85cc9c3  fix agent auth e2e not activated. (#4428)
85cc9c3 is described below

commit 85cc9c36ac40dc3a28788d90cc51d7e74c8acf0e
Author: Jared Tan <[email protected]>
AuthorDate: Sat Feb 29 22:20:43 2020 +0800

    fix agent auth e2e not activated. (#4428)
    
    * fix e2e miss.
---
 .github/workflows/e2e.yaml                         |  2 +
 test/e2e/e2e-agent-auth/pom.xml                    | 14 ++++--
 .../e2e-agent-auth/src/docker/rc.d/rc0-prepare.sh  | 42 -----------------
 .../e2e-agent-auth/src/docker/rc.d/rc1-startup.sh  |  8 ----
 .../skywalking/e2e/SampleVerificationITCase.java   | 53 ++++++++++++++--------
 5 files changed, 44 insertions(+), 75 deletions(-)

diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml
index 06d5fba..e19c1de 100644
--- a/.github/workflows/e2e.yaml
+++ b/.github/workflows/e2e.yaml
@@ -56,6 +56,8 @@ jobs:
         run: export E2E_VERSION=jdk12-1.5 && bash -x test/e2e/run.sh 
e2e-single-service
       - name: Agent Reboot Tests(JDK8)
         run: export E2E_VERSION=jdk8-1.5 && bash -x test/e2e/run.sh 
e2e-agent-reboot
+      - name: Agent Auth Tests(JDK8)
+        run: export E2E_VERSION=jdk8-1.5 && bash -x test/e2e/run.sh 
e2e-agent-auth
 
   Cluster:
     runs-on: ubuntu-latest
diff --git a/test/e2e/e2e-agent-auth/pom.xml b/test/e2e/e2e-agent-auth/pom.xml
index 55e329a..31ff172 100755
--- a/test/e2e/e2e-agent-auth/pom.xml
+++ b/test/e2e/e2e-agent-auth/pom.xml
@@ -83,14 +83,12 @@
                             <alias>${e2e.container.name.prefix}</alias>
                             <run>
                                 <env>
+                                    
<SW_AGENT_AUTHENTICATION>test-token</SW_AGENT_AUTHENTICATION>
                                     
<INSTRUMENTED_SERVICE>${project.build.finalName}.jar</INSTRUMENTED_SERVICE>
-                                    
<INSTRUMENTED_SERVICE_OPTS>-Dskywalking.agent.cool_down_threshold=1
-                                    </INSTRUMENTED_SERVICE_OPTS>
                                 </env>
                                 <ports>
                                     <port>+webapp.host:webapp.port:8080</port>
                                     <port>+client.host:client.port:9090</port>
-                                    <port>+reboot.host:reboot.port:9091</port>
                                 </ports>
                                 <volumes>
                                     <bind>
@@ -100,8 +98,14 @@
                                     </bind>
                                 </volumes>
                                 <wait>
-                                    <log>SkyWalking e2e container is ready for 
tests</log>
-                                    <time>2400000</time>
+                                    <http>
+                                        <url>
+                                            
http://${docker.host.address}:${client.port}/e2e/health-check
+                                        </url>
+                                        <method>GET</method>
+                                        <status>200</status>
+                                    </http>
+                                    <time>300000</time>
                                 </wait>
                             </run>
                         </image>
diff --git a/test/e2e/e2e-agent-auth/src/docker/rc.d/rc0-prepare.sh 
b/test/e2e/e2e-agent-auth/src/docker/rc.d/rc0-prepare.sh
deleted file mode 100755
index 5f771bd..0000000
--- a/test/e2e/e2e-agent-auth/src/docker/rc.d/rc0-prepare.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/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.
-
-# 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
-
-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 $2}'"'"' | xargs 
--no-run-if-empty kill -9
-    rm -rf /tmp/oap/trace_buffer1
-    rm -rf /tmp/oap/mesh_buffer1
-    echo "restarting OAP server..." \
-        && SW_RECEIVER_BUFFER_PATH=/tmp/oap/trace_buffer1 \
-        && SW_SERVICE_MESH_BUFFER_PATH=/tmp/oap/mesh_buffer1 \
-        && cd /sw \
-        && bash bin/oapService.sh > /dev/null 2>&1 &
-' > /usr/bin/restart_oap
-
-sync
-
-chmod +x /usr/bin/restart_oap
-
-sync
diff --git a/test/e2e/e2e-agent-auth/src/docker/rc.d/rc1-startup.sh 
b/test/e2e/e2e-agent-auth/src/docker/rc.d/rc1-startup.sh
index 3b1388c..a19df36 100755
--- a/test/e2e/e2e-agent-auth/src/docker/rc.d/rc1-startup.sh
+++ b/test/e2e/e2e-agent-auth/src/docker/rc.d/rc1-startup.sh
@@ -15,15 +15,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# set up the tcp server to listen for the restart command
-
-socat -u tcp-l:9091,fork system:'bash restart_oap' &
-
 echo 'starting OAP server...' \
-    && SW_STORAGE_ES_BULK_ACTIONS=1 \
-    && SW_STORAGE_ES_FLUSH_INTERVAL=1 \
-    && SW_RECEIVER_BUFFER_PATH=/tmp/oap/trace_buffer1 \
-    && SW_SERVICE_MESH_BUFFER_PATH=/tmp/oap/mesh_buffer1 \
     && SW_AUTHENTICATION="test-token" \
     && start_oap 'init'
 
diff --git 
a/test/e2e/e2e-agent-auth/src/test/java/org/apache/skywalking/e2e/SampleVerificationITCase.java
 
b/test/e2e/e2e-agent-auth/src/test/java/org/apache/skywalking/e2e/SampleVerificationITCase.java
index 0d290bd..ec73288 100644
--- 
a/test/e2e/e2e-agent-auth/src/test/java/org/apache/skywalking/e2e/SampleVerificationITCase.java
+++ 
b/test/e2e/e2e-agent-auth/src/test/java/org/apache/skywalking/e2e/SampleVerificationITCase.java
@@ -101,7 +101,8 @@ public class SampleVerificationITCase {
             try {
                 final Map<String, String> user = new HashMap<>();
                 user.put("name", "SkyWalking");
-                final ResponseEntity<String> responseEntity = 
restTemplate.postForEntity(instrumentedServiceUrl + "/e2e/users", user, 
String.class);
+                final ResponseEntity<String> responseEntity = 
restTemplate.postForEntity(
+                    instrumentedServiceUrl + "/e2e/users", user, String.class);
                 LOGGER.info("responseEntity: {}", responseEntity);
                 
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK);
                 final List<Trace> traces = queryClient.traces(new 
TracesQuery().start(minutesAgo)
@@ -156,7 +157,8 @@ public class SampleVerificationITCase {
                                                                   .end(now));
         LOGGER.info("topoData: {}", topoData);
 
-        InputStream expectedInputStream = new 
ClassPathResource("expected-data/org.apache.skywalking.e2e.SampleVerificationITCase.topo.yml")
+        InputStream expectedInputStream = new ClassPathResource(
+            
"expected-data/org.apache.skywalking.e2e.SampleVerificationITCase.topo.yml")
             .getInputStream();
 
         final TopoMatcher topoMatcher = new Yaml().loadAs(expectedInputStream, 
TopoMatcher.class);
@@ -167,18 +169,21 @@ public class SampleVerificationITCase {
     private void verifyServiceInstanceTopo(LocalDateTime minutesAgo) throws 
Exception {
         final LocalDateTime now = LocalDateTime.now(ZoneOffset.UTC);
 
-        final ServiceInstanceTopoData topoData = 
queryClient.serviceInstanceTopo(new ServiceInstanceTopoQuery().stepByMinute()
-                                                                               
                                .start(minutesAgo
-                                                                               
                                    .minusDays(1))
-                                                                               
                                .end(now)
-                                                                               
                                .clientServiceId("1")
-                                                                               
                                .serverServiceId("2"));
+        final ServiceInstanceTopoData topoData = 
queryClient.serviceInstanceTopo(
+            new ServiceInstanceTopoQuery().stepByMinute()
+                                          .start(minutesAgo
+                                                     .minusDays(1))
+                                          .end(now)
+                                          .clientServiceId("1")
+                                          .serverServiceId("2"));
         LOGGER.info("instanceTopoData: {}", topoData);
 
-        InputStream expectedInputStream = new 
ClassPathResource("expected-data/org.apache.skywalking.e2e.SampleVerificationITCase.serviceInstanceTopo.yml")
+        InputStream expectedInputStream = new ClassPathResource(
+            
"expected-data/org.apache.skywalking.e2e.SampleVerificationITCase.serviceInstanceTopo.yml")
             .getInputStream();
 
-        final ServiceInstanceTopoMatcher topoMatcher = new 
Yaml().loadAs(expectedInputStream, ServiceInstanceTopoMatcher.class);
+        final ServiceInstanceTopoMatcher topoMatcher = new Yaml().loadAs(
+            expectedInputStream, ServiceInstanceTopoMatcher.class);
         topoMatcher.verify(topoData);
         verifyServiceInstanceRelationMetrics(topoData.getCalls(), minutesAgo);
     }
@@ -189,7 +194,8 @@ public class SampleVerificationITCase {
         final List<Service> services = queryClient.services(new 
ServicesQuery().start(minutesAgo).end(now));
         LOGGER.info("services: {}", services);
 
-        InputStream expectedInputStream = new 
ClassPathResource("expected-data/org.apache.skywalking.e2e.SampleVerificationITCase.services.yml")
+        InputStream expectedInputStream = new ClassPathResource(
+            
"expected-data/org.apache.skywalking.e2e.SampleVerificationITCase.services.yml")
             .getInputStream();
 
         final ServicesMatcher servicesMatcher = new 
Yaml().loadAs(expectedInputStream, ServicesMatcher.class);
@@ -211,13 +217,14 @@ public class SampleVerificationITCase {
     }
 
     private Instances verifyServiceInstances(LocalDateTime minutesAgo, 
LocalDateTime now,
-        Service service) throws Exception {
+                                             Service service) throws Exception 
{
         InputStream expectedInputStream;
         Instances instances = queryClient.instances(new 
InstancesQuery().serviceId(service.getKey())
                                                                         
.start(minutesAgo)
                                                                         
.end(now));
         LOGGER.info("instances: {}", instances);
-        expectedInputStream = new 
ClassPathResource("expected-data/org.apache.skywalking.e2e.SampleVerificationITCase.instances.yml")
+        expectedInputStream = new ClassPathResource(
+            
"expected-data/org.apache.skywalking.e2e.SampleVerificationITCase.instances.yml")
             .getInputStream();
         final InstancesMatcher instancesMatcher = new 
Yaml().loadAs(expectedInputStream, InstancesMatcher.class);
         instancesMatcher.verify(instances);
@@ -225,10 +232,11 @@ public class SampleVerificationITCase {
     }
 
     private Endpoints verifyServiceEndpoints(LocalDateTime minutesAgo, 
LocalDateTime now,
-        Service service) throws Exception {
+                                             Service service) throws Exception 
{
         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")
+        InputStream expectedInputStream = new ClassPathResource(
+            
"expected-data/org.apache.skywalking.e2e.SampleVerificationITCase.endpoints.yml")
             .getInputStream();
         final EndpointsMatcher endpointsMatcher = new 
Yaml().loadAs(expectedInputStream, EndpointsMatcher.class);
         endpointsMatcher.verify(instances);
@@ -296,7 +304,8 @@ public class SampleVerificationITCase {
         final List<Trace> traces = queryClient.traces(new 
TracesQuery().start(minutesAgo).end(now).orderByDuration());
         LOGGER.info("traces: {}", traces);
 
-        InputStream expectedInputStream = new 
ClassPathResource("expected-data/org.apache.skywalking.e2e.SampleVerificationITCase.traces.yml")
+        InputStream expectedInputStream = new ClassPathResource(
+            
"expected-data/org.apache.skywalking.e2e.SampleVerificationITCase.traces.yml")
             .getInputStream();
 
         final TracesMatcher tracesMatcher = new 
Yaml().loadAs(expectedInputStream, TracesMatcher.class);
@@ -304,16 +313,20 @@ public class SampleVerificationITCase {
     }
 
     private void verifyServiceInstanceRelationMetrics(List<Call> calls,
-        final LocalDateTime minutesAgo) throws Exception {
-        verifyRelationMetrics(calls, minutesAgo, 
ALL_SERVICE_INSTANCE_RELATION_CLIENT_METRICS, 
ALL_SERVICE_INSTANCE_RELATION_SERVER_METRICS);
+                                                      final LocalDateTime 
minutesAgo) throws Exception {
+        verifyRelationMetrics(
+            calls, minutesAgo, ALL_SERVICE_INSTANCE_RELATION_CLIENT_METRICS,
+            ALL_SERVICE_INSTANCE_RELATION_SERVER_METRICS
+        );
     }
 
     private void verifyServiceRelationMetrics(List<Call> calls, final 
LocalDateTime minutesAgo) throws Exception {
-        verifyRelationMetrics(calls, minutesAgo, 
ALL_SERVICE_RELATION_CLIENT_METRICS, ALL_SERVICE_RELATION_SERVER_METRICS);
+        verifyRelationMetrics(
+            calls, minutesAgo, ALL_SERVICE_RELATION_CLIENT_METRICS, 
ALL_SERVICE_RELATION_SERVER_METRICS);
     }
 
     private void verifyRelationMetrics(List<Call> calls, final LocalDateTime 
minutesAgo, String[] relationClientMetrics,
-        String[] relationServerMetrics) throws Exception {
+                                       String[] relationServerMetrics) throws 
Exception {
         for (Call call : calls) {
             for (String detectPoint : call.getDetectPoints()) {
                 switch (detectPoint) {

Reply via email to