Support `java` -> `nginx` -> `java` e2e test, and v3 protocol (#4637)
This commit is contained in:
parent
31385159c2
commit
1601cc107c
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
FROM openresty/openresty
|
||||
|
||||
ENV COMMIT_HASH=9cebe51276d9a8a5b360ee1d9897e8bf803bda31
|
||||
ENV COMMIT_HASH=45cf64640047a4a54619fa1d3451b4d0a65a62d6
|
||||
|
||||
WORKDIR /usr/share/skywalking-nginx-lua
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -77,17 +77,22 @@ public class LuaE2E extends SkyWalkingTestAdapter {
|
|||
@ContainerHostAndPort(name = "ui", port = 8080)
|
||||
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) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
# 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.
|
||||
|
||||
endpoints:
|
||||
- key: not null
|
||||
label: /nginx/entry/info
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
instances:
|
||||
- key: 2
|
||||
- key: not null
|
||||
label: not null
|
||||
attributes:
|
||||
- name: OS Name
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
endpoints:
|
||||
- key: not null
|
||||
- key: VXNlcl9TZXJ2aWNlX05hbWU=.1_L25naW54L2luZm8=
|
||||
label: /nginx/info
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -14,5 +14,5 @@
|
|||
# limitations under the License.
|
||||
|
||||
instances:
|
||||
- key: 4
|
||||
label: not null
|
||||
- key: VXNlcl9TZXJ2aWNlX05hbWU=.1_VXNlcl9TZXJ2aWNlX0luc3RhbmNlX05hbWU=
|
||||
label: User_Service_Instance_Name
|
||||
|
|
|
|||
|
|
@ -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=
|
||||
|
|
|
|||
|
|
@ -14,7 +14,9 @@
|
|||
# limitations under the License.
|
||||
|
||||
services:
|
||||
- key: gt 0
|
||||
label: "Your_ApplicationName"
|
||||
- key: gt 0
|
||||
label: "User_Service_Name"
|
||||
- key: ZTJlLXNlcnZpY2UtZW50cnktcHJvdmlkZXI=.1
|
||||
label: "e2e-service-entry-provider"
|
||||
- key: VXNlcl9TZXJ2aWNlX05hbWU=.1
|
||||
label: "User_Service_Name"
|
||||
- key: ZTJlLXNlcnZpY2UtZW5kLXByb3ZpZGVy.1
|
||||
label: "e2e-service-end-provider"
|
||||
|
|
@ -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
|
||||
target: ZTJlLXNlcnZpY2UtZW5kLXByb3ZpZGVy.1
|
||||
- id: ZTJlLXNlcnZpY2UtZW5kLXByb3ZpZGVy.1-bG9jYWxob3N0Oi0x.0
|
||||
source: ZTJlLXNlcnZpY2UtZW5kLXByb3ZpZGVy.1
|
||||
detectPoints:
|
||||
- CLIENT
|
||||
target: bG9jYWxob3N0Oi0x.0
|
||||
|
|
@ -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
|
||||
- not null
|
||||
|
||||
- key: not null
|
||||
endpointNames:
|
||||
- /info
|
||||
duration: ge 0
|
||||
start: gt 0
|
||||
isError: false
|
||||
traceIds:
|
||||
- not null
|
||||
|
|
|
|||
Loading…
Reference in New Issue