You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2020/04/11 14:31:40 UTC
[skywalking] branch master updated: Support `java` -> `nginx` ->
`java` e2e test, and v3 protocol (#4637)
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 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 1601cc1 Support `java` -> `nginx` -> `java` e2e test, and v3 protocol (#4637)
1601cc1 is described below
commit 1601cc107c800e1011b37f131d1b520c1a8a57b0
Author: mrproliu <74...@qq.com>
AuthorDate: Sat Apr 11 22:31:28 2020 +0800
Support `java` -> `nginx` -> `java` e2e test, and v3 protocol (#4637)
---
.github/workflows/e2e.yaml | 5 +--
.../apache/skywalking/e2e/lua/LuaController.java | 43 ++++++++++++++++++++
test/e2e/e2e-test/docker/lua/Dockerfile.nginx | 2 +-
test/e2e/e2e-test/docker/lua/docker-compose.yml | 27 ++++++++++++-
test/e2e/e2e-test/docker/lua/nginx.conf | 2 +-
.../java/org/apache/skywalking/e2e/LuaE2E.java | 17 +++++---
.../lua/{endpoints.yml => endpoints-end.yml} | 0
.../lua/{endpoints.yml => endpoints-entry.yml} | 5 +--
.../src/test/resources/expected/lua/instances.yml | 2 +-
.../test/resources/expected/lua/nginxEndpoints.yml | 2 +-
.../test/resources/expected/lua/nginxInstances.yml | 4 +-
.../resources/expected/lua/serviceInstanceTopo.yml | 27 +++++++------
.../src/test/resources/expected/lua/services.yml | 10 +++--
.../src/test/resources/expected/lua/topo.yml | 47 ++++++++++++----------
.../src/test/resources/expected/lua/traces.yml | 13 +++++-
15 files changed, 146 insertions(+), 60 deletions(-)
diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml
index 7d4c16b..867db1e 100644
--- a/.github/workflows/e2e.yaml
+++ b/.github/workflows/e2e.yaml
@@ -72,9 +72,8 @@ jobs:
run: make docker
- name: Copy dist package
run: cp -R dist test/e2e/
-# TODO, LUA hasn't followed the v3 protocol
-# - name: Nginx Lua
-# run: ./mvnw --batch-mode -f test/e2e/pom.xml -am -DfailIfNoTests=false verify -Dit.test=org.apache.skywalking.e2e.LuaE2E
+ - name: Nginx Lua
+ run: ./mvnw --batch-mode -f test/e2e/pom.xml -am -DfailIfNoTests=false verify -Dit.test=org.apache.skywalking.e2e.LuaE2E
- uses: actions/upload-artifact@v1
if: failure()
with:
diff --git a/test/e2e/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/lua/LuaController.java b/test/e2e/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/lua/LuaController.java
new file mode 100644
index 0000000..6fad0c7
--- /dev/null
+++ b/test/e2e/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/lua/LuaController.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) 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.
+ *
+ */
+
+package org.apache.skywalking.e2e.lua;
+
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.client.RestTemplate;
+
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+@RestController
+@RequiredArgsConstructor
+public class LuaController {
+ protected final RestTemplate restTemplate = new RestTemplate();
+
+ @PostMapping("/nginx/entry/info")
+ private String nginxEntry(String backend) throws MalformedURLException, URISyntaxException {
+ final URL url = new URL("http://nginx:8080/nginx/info");
+ final ResponseEntity<String> response = restTemplate.postForEntity(url.toURI(), null, String.class);
+ return response.getBody();
+ }
+
+}
diff --git a/test/e2e/e2e-test/docker/lua/Dockerfile.nginx b/test/e2e/e2e-test/docker/lua/Dockerfile.nginx
index cbb26a5..af9de7c 100644
--- a/test/e2e/e2e-test/docker/lua/Dockerfile.nginx
+++ b/test/e2e/e2e-test/docker/lua/Dockerfile.nginx
@@ -15,7 +15,7 @@
FROM openresty/openresty
-ENV COMMIT_HASH=9cebe51276d9a8a5b360ee1d9897e8bf803bda31
+ENV COMMIT_HASH=45cf64640047a4a54619fa1d3451b4d0a65a62d6
WORKDIR /usr/share/skywalking-nginx-lua
diff --git a/test/e2e/e2e-test/docker/lua/docker-compose.yml b/test/e2e/e2e-test/docker/lua/docker-compose.yml
index ff01e62..1752bb7 100644
--- a/test/e2e/e2e-test/docker/lua/docker-compose.yml
+++ b/test/e2e/e2e-test/docker/lua/docker-compose.yml
@@ -42,7 +42,7 @@ services:
oap:
condition: service_healthy
- provider:
+ provider-entry:
build:
context: ../../../
dockerfile: e2e-test/docker/Dockerfile.provider
@@ -52,6 +52,27 @@ services:
- 9090
environment:
- SW_AGENT_COLLECTOR_BACKEND_SERVICES=oap:11800
+ - SW_AGENT_NAME=e2e-service-entry-provider
+ depends_on:
+ oap:
+ condition: service_healthy
+ healthcheck:
+ test: ["CMD", "sh", "-c", "nc -z 127.0.0.1 9090"]
+ interval: 5s
+ timeout: 60s
+ retries: 120
+
+ provider-end:
+ build:
+ context: ../../../
+ dockerfile: e2e-test/docker/Dockerfile.provider
+ networks:
+ - e2e
+ expose:
+ - 9090
+ environment:
+ - SW_AGENT_COLLECTOR_BACKEND_SERVICES=oap:11800
+ - SW_AGENT_NAME=e2e-service-end-provider
depends_on:
oap:
condition: service_healthy
@@ -72,7 +93,9 @@ services:
depends_on:
oap:
condition: service_healthy
- provider: # Just to make sure that the service id > provider service id
+ provider-entry:
+ condition: service_healthy
+ provider-end:
condition: service_healthy
volumes:
- ../lua/nginx.conf:/var/nginx/conf.d/nginx.conf
diff --git a/test/e2e/e2e-test/docker/lua/nginx.conf b/test/e2e/e2e-test/docker/lua/nginx.conf
index 61eb559..cf2c3f2 100644
--- a/test/e2e/e2e-test/docker/lua/nginx.conf
+++ b/test/e2e/e2e-test/docker/lua/nginx.conf
@@ -50,7 +50,7 @@ http {
require("tracer"):start("User_Service_Name")
}
- proxy_pass http://provider:9090/info;
+ proxy_pass http://provider-end:9090/info;
body_filter_by_lua_block {
require("tracer"):finish()
diff --git a/test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/LuaE2E.java b/test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/LuaE2E.java
index c2f2372..46fb459 100644
--- a/test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/LuaE2E.java
+++ b/test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/LuaE2E.java
@@ -78,16 +78,21 @@ public class LuaE2E extends SkyWalkingTestAdapter {
private HostAndPort swWebappHostPort;
@SuppressWarnings("unused")
+ @ContainerHostAndPort(name = "provider-entry", port = 9090)
+ private HostAndPort entryProvider;
+
+ @SuppressWarnings("unused")
@ContainerHostAndPort(name = "nginx", port = 8080)
private HostAndPort nginxHostPort;
private final String nginxServiceName = "User_Service_Name";
+ private final String entryServiceName = "e2e-service-entry-provider";
@BeforeAll
public void setUp() throws Exception {
queryClient(swWebappHostPort);
- trafficController(nginxHostPort, "/nginx/info");
+ trafficController(entryProvider, "/nginx/entry/info?backend=" + nginxHostPort.host() + ":" + nginxHostPort.port());
}
@AfterAll
@@ -144,8 +149,8 @@ public class LuaE2E extends SkyWalkingTestAdapter {
new ServiceInstanceTopologyQuery().stepByMinute()
.start(startTime.minusDays(1))
.end(now())
- .clientServiceId("1")
- .serverServiceId("4"));
+ .clientServiceId("ZTJlLXNlcnZpY2UtZW50cnktcHJvdmlkZXI=.1")
+ .serverServiceId("VXNlcl9TZXJ2aWNlX05hbWU=.1"));
LOGGER.info("topology: {}", topology);
@@ -177,8 +182,10 @@ public class LuaE2E extends SkyWalkingTestAdapter {
if (nginxServiceName.equals(service.getLabel())) {
load("expected/lua/nginxEndpoints.yml").as(EndpointsMatcher.class).verify(endpoints);
+ } else if (entryServiceName.equals(service.getLabel())) {
+ load("expected/lua/endpoints-entry.yml").as(EndpointsMatcher.class).verify(endpoints);
} else {
- load("expected/lua/endpoints.yml").as(EndpointsMatcher.class).verify(endpoints);
+ load("expected/lua/endpoints-end.yml").as(EndpointsMatcher.class).verify(endpoints);
}
return endpoints;
@@ -206,7 +213,7 @@ public class LuaE2E extends SkyWalkingTestAdapter {
private void verifyEndpointsMetrics(Endpoints endpoints) throws Exception {
for (Endpoint endpoint : endpoints.getEndpoints()) {
- if (!endpoint.getLabel().equals("/info") || !endpoint.getLabel().equals("/nginx/info")) {
+ if (!endpoint.getLabel().equals("/info") && !endpoint.getLabel().equals("/nginx/info")) {
continue;
}
for (final String metricName : ALL_ENDPOINT_METRICS) {
diff --git a/test/e2e/e2e-test/src/test/resources/expected/lua/endpoints.yml b/test/e2e/e2e-test/src/test/resources/expected/lua/endpoints-end.yml
similarity index 100%
copy from test/e2e/e2e-test/src/test/resources/expected/lua/endpoints.yml
copy to test/e2e/e2e-test/src/test/resources/expected/lua/endpoints-end.yml
diff --git a/test/e2e/e2e-test/src/test/resources/expected/lua/endpoints.yml b/test/e2e/e2e-test/src/test/resources/expected/lua/endpoints-entry.yml
similarity index 96%
rename from test/e2e/e2e-test/src/test/resources/expected/lua/endpoints.yml
rename to test/e2e/e2e-test/src/test/resources/expected/lua/endpoints-entry.yml
index ec9f776..c1726ee 100644
--- a/test/e2e/e2e-test/src/test/resources/expected/lua/endpoints.yml
+++ b/test/e2e/e2e-test/src/test/resources/expected/lua/endpoints-entry.yml
@@ -15,7 +15,4 @@
endpoints:
- key: not null
- label: /info
-
-
-
+ label: /nginx/entry/info
diff --git a/test/e2e/e2e-test/src/test/resources/expected/lua/instances.yml b/test/e2e/e2e-test/src/test/resources/expected/lua/instances.yml
index 7d1f330..1f61c74 100644
--- a/test/e2e/e2e-test/src/test/resources/expected/lua/instances.yml
+++ b/test/e2e/e2e-test/src/test/resources/expected/lua/instances.yml
@@ -14,7 +14,7 @@
# limitations under the License.
instances:
- - key: 2
+ - key: not null
label: not null
attributes:
- name: OS Name
diff --git a/test/e2e/e2e-test/src/test/resources/expected/lua/nginxEndpoints.yml b/test/e2e/e2e-test/src/test/resources/expected/lua/nginxEndpoints.yml
index fc1bee6..1674bf5 100644
--- a/test/e2e/e2e-test/src/test/resources/expected/lua/nginxEndpoints.yml
+++ b/test/e2e/e2e-test/src/test/resources/expected/lua/nginxEndpoints.yml
@@ -14,7 +14,7 @@
# limitations under the License.
endpoints:
- - key: not null
+ - key: VXNlcl9TZXJ2aWNlX05hbWU=.1_L25naW54L2luZm8=
label: /nginx/info
diff --git a/test/e2e/e2e-test/src/test/resources/expected/lua/nginxInstances.yml b/test/e2e/e2e-test/src/test/resources/expected/lua/nginxInstances.yml
index 6fdeab2..992de44 100644
--- a/test/e2e/e2e-test/src/test/resources/expected/lua/nginxInstances.yml
+++ b/test/e2e/e2e-test/src/test/resources/expected/lua/nginxInstances.yml
@@ -14,5 +14,5 @@
# limitations under the License.
instances:
- - key: 4
- label: not null
+ - key: VXNlcl9TZXJ2aWNlX05hbWU=.1_VXNlcl9TZXJ2aWNlX0luc3RhbmNlX05hbWU=
+ label: User_Service_Instance_Name
diff --git a/test/e2e/e2e-test/src/test/resources/expected/lua/serviceInstanceTopo.yml b/test/e2e/e2e-test/src/test/resources/expected/lua/serviceInstanceTopo.yml
index 2cf5f08..0c8ee18 100644
--- a/test/e2e/e2e-test/src/test/resources/expected/lua/serviceInstanceTopo.yml
+++ b/test/e2e/e2e-test/src/test/resources/expected/lua/serviceInstanceTopo.yml
@@ -14,21 +14,22 @@
# limitations under the License.
nodes:
- - id: 1
- name: User
- type: USER
- serviceId: 1
- serviceName: User
- isReal: false
- - id: 4
- name: not null
- serviceId: 4
- serviceName: User_Service_Name
+ - id: VXNlcl9TZXJ2aWNlX05hbWU=.1_VXNlcl9TZXJ2aWNlX0luc3RhbmNlX05hbWU=
+ name: User_Service_Instance_Name
type: not null
+ serviceId: VXNlcl9TZXJ2aWNlX05hbWU=.1
+ serviceName: User_Service_Name
+ isReal: true
+ - id: not null
+ name: not null
+ serviceId: ZTJlLXNlcnZpY2UtZW50cnktcHJvdmlkZXI=.1
+ serviceName: e2e-service-entry-provider
+ type: ""
isReal: true
calls:
- - id: 1_4
- source: 1
+ - id: not null
+ source: not null
detectPoints:
+ - CLIENT
- SERVER
- target: 4
+ target: VXNlcl9TZXJ2aWNlX05hbWU=.1_VXNlcl9TZXJ2aWNlX0luc3RhbmNlX05hbWU=
diff --git a/test/e2e/e2e-test/src/test/resources/expected/lua/services.yml b/test/e2e/e2e-test/src/test/resources/expected/lua/services.yml
index 6f22a90..05d84df 100644
--- a/test/e2e/e2e-test/src/test/resources/expected/lua/services.yml
+++ b/test/e2e/e2e-test/src/test/resources/expected/lua/services.yml
@@ -14,7 +14,9 @@
# limitations under the License.
services:
- - key: gt 0
- label: "Your_ApplicationName"
- - key: gt 0
- label: "User_Service_Name"
\ No newline at end of file
+ - key: ZTJlLXNlcnZpY2UtZW50cnktcHJvdmlkZXI=.1
+ label: "e2e-service-entry-provider"
+ - key: VXNlcl9TZXJ2aWNlX05hbWU=.1
+ label: "User_Service_Name"
+ - key: ZTJlLXNlcnZpY2UtZW5kLXByb3ZpZGVy.1
+ label: "e2e-service-end-provider"
\ No newline at end of file
diff --git a/test/e2e/e2e-test/src/test/resources/expected/lua/topo.yml b/test/e2e/e2e-test/src/test/resources/expected/lua/topo.yml
index f72c029..cb21af9 100644
--- a/test/e2e/e2e-test/src/test/resources/expected/lua/topo.yml
+++ b/test/e2e/e2e-test/src/test/resources/expected/lua/topo.yml
@@ -14,41 +14,46 @@
# limitations under the License.
nodes:
- - id: 1
+ - id: VXNlcg==.0
name: User
type: USER
isReal: false
- - id: 2
- name: Your_ApplicationName
+ - id: ZTJlLXNlcnZpY2UtZW50cnktcHJvdmlkZXI=.1
+ name: e2e-service-entry-provider
type: Tomcat
isReal: true
- - id: 3
- name: localhost:-1
- type: H2
- isReal: false
- - id: 4
+ - id: VXNlcl9TZXJ2aWNlX05hbWU=.1
name: User_Service_Name
type: Nginx
isReal: true
+ - id: ZTJlLXNlcnZpY2UtZW5kLXByb3ZpZGVy.1
+ name: e2e-service-end-provider
+ type: Tomcat
+ isReal: true
+ - id: bG9jYWxob3N0Oi0x.0
+ name: localhost:-1
+ type: H2
+ isReal: false
calls:
- - id: 1_4
- source: 1
+ - id: VXNlcg==.0-ZTJlLXNlcnZpY2UtZW50cnktcHJvdmlkZXI=.1
+ source: VXNlcg==.0
detectPoints:
- SERVER
- target: 4
- - id: 4_2
- source: 4
+ target: ZTJlLXNlcnZpY2UtZW50cnktcHJvdmlkZXI=.1
+ - id: ZTJlLXNlcnZpY2UtZW50cnktcHJvdmlkZXI=.1-VXNlcl9TZXJ2aWNlX05hbWU=.1
+ source: ZTJlLXNlcnZpY2UtZW50cnktcHJvdmlkZXI=.1
detectPoints:
- CLIENT
- SERVER
- target: 2
- - id: 2_3
- source: 2
+ target: VXNlcl9TZXJ2aWNlX05hbWU=.1
+ - id: VXNlcl9TZXJ2aWNlX05hbWU=.1-ZTJlLXNlcnZpY2UtZW5kLXByb3ZpZGVy.1
+ source: VXNlcl9TZXJ2aWNlX05hbWU=.1
detectPoints:
- CLIENT
- target: 3
- - id: 1_2
- source: 1
- detectPoints:
- SERVER
- target: 2
\ No newline at end of file
+ target: ZTJlLXNlcnZpY2UtZW5kLXByb3ZpZGVy.1
+ - id: ZTJlLXNlcnZpY2UtZW5kLXByb3ZpZGVy.1-bG9jYWxob3N0Oi0x.0
+ source: ZTJlLXNlcnZpY2UtZW5kLXByb3ZpZGVy.1
+ detectPoints:
+ - CLIENT
+ target: bG9jYWxob3N0Oi0x.0
\ No newline at end of file
diff --git a/test/e2e/e2e-test/src/test/resources/expected/lua/traces.yml b/test/e2e/e2e-test/src/test/resources/expected/lua/traces.yml
index 9eb6538..ef118f8 100644
--- a/test/e2e/e2e-test/src/test/resources/expected/lua/traces.yml
+++ b/test/e2e/e2e-test/src/test/resources/expected/lua/traces.yml
@@ -16,7 +16,7 @@
traces:
- key: not null
endpointNames:
- - /info
+ - /nginx/entry/info
duration: ge 0
start: gt 0
isError: false
@@ -30,4 +30,13 @@ traces:
start: gt 0
isError: false
traceIds:
- - not null
\ No newline at end of file
+ - not null
+
+ - key: not null
+ endpointNames:
+ - /info
+ duration: ge 0
+ start: gt 0
+ isError: false
+ traceIds:
+ - not null