From 705d2dedbeb557aba45b5fc03db04b09ce4f2969 Mon Sep 17 00:00:00 2001 From: Siman-hub Date: Sun, 1 Feb 2026 17:58:45 +0000 Subject: [PATCH 1/2] test(gateway-4.3.x): add scenario coverage for 4.3.x --- support-version.list | 1 + test/plugin/run.sh | 9 + .../config/expectedData.yaml | 189 ++++++++++++++++++ .../gateway-4.3.x-scenario/configuration.yml | 23 +++ .../gateway-dist/bin/startup.sh | 24 +++ .../gateway-dist/pom.xml | 57 ++++++ .../src/main/assembly/assembly.xml | 47 +++++ .../gateway-projectA-scenario/pom.xml | 56 ++++++ .../sc/gateway/projectA/ApiKeyResolver.java | 31 +++ .../sc/gateway/projectA/Application.java | 29 +++ .../sc/gateway/projectA/Test1Filter.java | 38 ++++ .../sc/gateway/projectA/Test2Filter.java | 39 ++++ .../sc/gateway/projectA/TestFilterConfig.java | 35 ++++ .../src/main/resources/application.yml | 33 +++ .../gateway-projectB-scenario/pom.xml | 57 ++++++ .../sc/gateway/projectB/Application.java | 31 +++ .../projectB/controller/TestController.java | 40 ++++ .../src/main/resources/application.properties | 17 ++ .../scenarios/gateway-4.3.x-scenario/pom.xml | 79 ++++++++ .../support-version.list | 17 ++ 20 files changed, 852 insertions(+) create mode 100644 support-version.list create mode 100644 test/plugin/scenarios/gateway-4.3.x-scenario/config/expectedData.yaml create mode 100644 test/plugin/scenarios/gateway-4.3.x-scenario/configuration.yml create mode 100644 test/plugin/scenarios/gateway-4.3.x-scenario/gateway-dist/bin/startup.sh create mode 100644 test/plugin/scenarios/gateway-4.3.x-scenario/gateway-dist/pom.xml create mode 100644 test/plugin/scenarios/gateway-4.3.x-scenario/gateway-dist/src/main/assembly/assembly.xml create mode 100644 test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/pom.xml create mode 100644 test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectA/ApiKeyResolver.java create mode 100644 test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectA/Application.java create mode 100644 test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectA/Test1Filter.java create mode 100644 test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectA/Test2Filter.java create mode 100644 test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectA/TestFilterConfig.java create mode 100644 test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/resources/application.yml create mode 100644 test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectB-scenario/pom.xml create mode 100644 test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectB-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectB/Application.java create mode 100644 test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectB-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectB/controller/TestController.java create mode 100644 test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectB-scenario/src/main/resources/application.properties create mode 100644 test/plugin/scenarios/gateway-4.3.x-scenario/pom.xml create mode 100644 test/plugin/scenarios/gateway-4.3.x-scenario/support-version.list diff --git a/support-version.list b/support-version.list new file mode 100644 index 0000000000..e91d9be2a8 --- /dev/null +++ b/support-version.list @@ -0,0 +1 @@ +4.3.3 diff --git a/test/plugin/run.sh b/test/plugin/run.sh index 47a87de456..f2d566a20c 100755 --- a/test/plugin/run.sh +++ b/test/plugin/run.sh @@ -159,6 +159,15 @@ remove_dir() { start_stamp=`date +%s` parse_commandline "$@" +if [[ "$scenario_name" == "gateway-4.3.x-scenario" ]]; then + base_image_java="eclipse-temurin:17-jdk-jammy" + base_image_tomcat="tomcat:10.1-jdk17" +fi + +echo "Scenario=$scenario_name JavaImage=$base_image_java TomcatImage=$base_image_tomcat" + + + if [[ "$cleanup" == "on" ]]; then do_cleanup [[ -z "${scenario_name}" ]] && exit 0 diff --git a/test/plugin/scenarios/gateway-4.3.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/gateway-4.3.x-scenario/config/expectedData.yaml new file mode 100644 index 0000000000..94488a65aa --- /dev/null +++ b/test/plugin/scenarios/gateway-4.3.x-scenario/config/expectedData.yaml @@ -0,0 +1,189 @@ + # 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. + + ignoreSegmentNames: + - HEAD:/provider/b/healthCheck + - /provider/b/healthCheck + + segmentItems: + - serviceName: gateway-projectB-scenario + segmentSize: nq 0 + segments: + - segmentId: not null + spans: + - operationName: GET:/provider/b/testcase + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: nq 0 + isError: false + spanType: Entry + peer: '' + tags: + - {key: url, value: not null} + - {key: http.method, value: GET} + - {key: http.status_code, value: '200'} + refs: + - {parentEndpoint: SpringCloudGateway/GatewayFilter, networkAddress: not null, + refType: CrossProcess, parentSpanId: 2, parentTraceSegmentId: not null, parentServiceInstance: not + null, parentService: not null, traceId: not null} + skipAnalysis: 'false' + + - serviceName: gateway-projectA-scenario + segmentSize: nq 0 + segments: + # -------------------------------------------------------- + # Case 1: Timeout Error + # -------------------------------------------------------- + # A. Entry Span + - segmentId: not null + spans: + - operationName: /provider/timeout/error + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: nq 0 + isError: true + spanType: Entry + peer: '' + tags: + - {key: url, value: not null } + - {key: http.method, value: GET} + - {key: http.status_code, value: '500'} + skipAnalysis: 'false' + + # B. Exit Span (Contains Logs) + - segmentId: not null + spans: + - operationName: SpringCloudGateway/sendRequest + parentSpanId: 1 + spanId: 2 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: nq 0 + isError: true + spanType: Exit + peer: not null + skipAnalysis: 'false' + tags: + - { key: url, value: not null } + logs: + - logEvent: + - { key: event, value: error } + - { key: error.kind, value: not null } + - { key: message, value: not null } + - { key: stack, value: not null} + - operationName: SpringCloudGateway/RoutingFilter + parentSpanId: 0 + spanId: 1 + startTime: nq 0 + endTime: nq 0 + componentId: nq 0 + isError: false + spanType: Local + peer: '' + skipAnalysis: 'false' + refs: + - { parentEndpoint: '/provider/timeout/error', networkAddress: '', refType: CrossThread, + parentSpanId: 0, parentTraceSegmentId: not null, parentServiceInstance: not + null, parentService: not null, traceId: not null } + - operationName: SpringCloudGateway/GatewayFilter + parentSpanId: -1 + spanId: 0 + startTime: nq 0 + endTime: nq 0 + componentId: nq 0 + isError: false + spanType: Local + peer: '' + skipAnalysis: 'false' + refs: + - { parentEndpoint: '/provider/timeout/error', networkAddress: '', refType: CrossThread, + parentSpanId: 0, parentTraceSegmentId: not null, parentServiceInstance: not + null, parentService: not null, traceId: not null } + + # -------------------------------------------------------- + # Case 2: Success Case + # -------------------------------------------------------- + # A. Entry Span + - segmentId: not null + spans: + - operationName: /provider/b/testcase + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: nq 0 + isError: false + spanType: Entry + peer: '' + tags: + - { key: url, value: not null } + - { key: http.method, value: GET } + - { key: http.status_code, value: '200' } + skipAnalysis: 'false' + + # B. Exit Span + - segmentId: not null + spans: + - operationName: SpringCloudGateway/sendRequest + parentSpanId: 1 + spanId: 2 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: nq 0 + isError: false + spanType: Exit + peer: not null + tags: + - {key: url, value: not null} + - {key: http.status_code, value: '200'} + skipAnalysis: 'false' + - operationName: SpringCloudGateway/RoutingFilter + parentSpanId: 0 + spanId: 1 + startTime: nq 0 + endTime: nq 0 + componentId: nq 0 + isError: false + spanType: Local + peer: '' + skipAnalysis: 'false' + refs: + - {parentEndpoint: '/provider/b/testcase', networkAddress: '', refType: CrossThread, + parentSpanId: 0, parentTraceSegmentId: not null, parentServiceInstance: not + null, parentService: not null, traceId: not null} + - operationName: SpringCloudGateway/GatewayFilter + parentSpanId: -1 + spanId: 0 + startTime: nq 0 + endTime: nq 0 + componentId: nq 0 + isError: false + spanType: Local + peer: '' + skipAnalysis: 'false' + refs: + - {parentEndpoint: '/provider/b/testcase', networkAddress: '', refType: CrossThread, + parentSpanId: 0, parentTraceSegmentId: not null, parentServiceInstance: not + null, parentService: not null, traceId: not null} diff --git a/test/plugin/scenarios/gateway-4.3.x-scenario/configuration.yml b/test/plugin/scenarios/gateway-4.3.x-scenario/configuration.yml new file mode 100644 index 0000000000..49d08ed8ef --- /dev/null +++ b/test/plugin/scenarios/gateway-4.3.x-scenario/configuration.yml @@ -0,0 +1,23 @@ +# 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. + +type: jvm +entryService: http://localhost:8080/provider/b/testcase +healthCheck: http://localhost:8080/provider/b/healthCheck +startScript: ./bin/startup.sh +runningMode: with_optional +withPlugins: apm-spring-cloud-gateway-4.x-plugin-*.jar + diff --git a/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-dist/bin/startup.sh b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-dist/bin/startup.sh new file mode 100644 index 0000000000..0d28675632 --- /dev/null +++ b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-dist/bin/startup.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# +# 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. + +home="$(cd "$(dirname $0)"; pwd)" + +java -jar ${agent_opts} "-Dskywalking.agent.service_name=gateway-projectA-scenario" ${home}/../libs/gateway-projectA-scenario.jar & +sleep 1 + +java -jar ${agent_opts} "-Dskywalking.agent.service_name=gateway-projectB-scenario" ${home}/../libs/gateway-projectB-scenario.jar & diff --git a/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-dist/pom.xml b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-dist/pom.xml new file mode 100644 index 0000000000..45b02e8800 --- /dev/null +++ b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-dist/pom.xml @@ -0,0 +1,57 @@ + + + + + org.apache.skywalking + gateway-4.3.x-scenario + 5.0.0 + + 4.0.0 + + gateway-dist + + + gateway-4.3.x-scenario + + + org.apache.maven.plugins + maven-assembly-plugin + + + assemble + package + + single + + + gateway-4.3.x-scenario + false + + src/main/assembly/assembly.xml + + ../target/ + + + + + + + diff --git a/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-dist/src/main/assembly/assembly.xml b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-dist/src/main/assembly/assembly.xml new file mode 100644 index 0000000000..127200bdc8 --- /dev/null +++ b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-dist/src/main/assembly/assembly.xml @@ -0,0 +1,47 @@ + + + + gateway-dist + + zip + + + + + ./bin + 0775 + + + + + + ../gateway-projectA-scenario/target/gateway-projectA-scenario.jar + ./libs + 0775 + + + ../gateway-projectB-scenario/target/gateway-projectB-scenario.jar + ./libs + 0775 + + + \ No newline at end of file diff --git a/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/pom.xml b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/pom.xml new file mode 100644 index 0000000000..a3009bea02 --- /dev/null +++ b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/pom.xml @@ -0,0 +1,56 @@ + + + + + org.apache.skywalking + gateway-4.3.x-scenario + 5.0.0 + + 4.0.0 + + gateway-projectA-scenario + + + + org.springframework.cloud + spring-cloud-starter-gateway + ${test.framework.version} + + + + + gateway-projectA-scenario + + + org.springframework.boot + spring-boot-maven-plugin + 3.0.0 + + + + repackage + + + + + + + diff --git a/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectA/ApiKeyResolver.java b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectA/ApiKeyResolver.java new file mode 100644 index 0000000000..40517d1d3f --- /dev/null +++ b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectA/ApiKeyResolver.java @@ -0,0 +1,31 @@ +/* + * 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 test.apache.skywalking.apm.testcase.sc.gateway.projectA; + +import org.springframework.cloud.gateway.filter.ratelimit.KeyResolver; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +@Component +public class ApiKeyResolver implements KeyResolver { + + public Mono resolve(ServerWebExchange exchange) { + return Mono.just(exchange.getRequest().getPath().value()); + } +} diff --git a/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectA/Application.java b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectA/Application.java new file mode 100644 index 0000000000..68eb95b0c6 --- /dev/null +++ b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectA/Application.java @@ -0,0 +1,29 @@ +/* + * 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 test.apache.skywalking.apm.testcase.sc.gateway.projectA; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } +} diff --git a/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectA/Test1Filter.java b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectA/Test1Filter.java new file mode 100644 index 0000000000..af891eae20 --- /dev/null +++ b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectA/Test1Filter.java @@ -0,0 +1,38 @@ +/* + * 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 test.apache.skywalking.apm.testcase.sc.gateway.projectA; + +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.cloud.gateway.filter.GlobalFilter; +import org.springframework.core.Ordered; +import org.springframework.http.server.reactive.ServerHttpRequest; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +public class Test1Filter implements GlobalFilter, Ordered { + @Override + public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { + ServerHttpRequest buildRequest = exchange.getRequest().mutate().build(); + return chain.filter(exchange.mutate().request(buildRequest).build()); + } + + @Override + public int getOrder() { + return 0; + } +} diff --git a/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectA/Test2Filter.java b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectA/Test2Filter.java new file mode 100644 index 0000000000..d3a5846bd5 --- /dev/null +++ b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectA/Test2Filter.java @@ -0,0 +1,39 @@ +/* + * 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 test.apache.skywalking.apm.testcase.sc.gateway.projectA; + +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.cloud.gateway.filter.GlobalFilter; +import org.springframework.core.Ordered; +import org.springframework.http.server.reactive.ServerHttpRequest; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +public class Test2Filter implements GlobalFilter, Ordered { + + @Override + public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { + ServerHttpRequest buildRequest = exchange.getRequest().mutate().build(); + return chain.filter(exchange.mutate().request(buildRequest).build()); + } + + @Override + public int getOrder() { + return 1; + } +} diff --git a/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectA/TestFilterConfig.java b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectA/TestFilterConfig.java new file mode 100644 index 0000000000..29f9627bdf --- /dev/null +++ b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectA/TestFilterConfig.java @@ -0,0 +1,35 @@ +/* + * 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 test.apache.skywalking.apm.testcase.sc.gateway.projectA; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class TestFilterConfig { + + @Bean + public Test1Filter test1Filter() { + return new Test1Filter(); + } + + @Bean + public Test2Filter test2Filter() { + return new Test2Filter(); + } +} diff --git a/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/resources/application.yml b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/resources/application.yml new file mode 100644 index 0000000000..7639e7ce8a --- /dev/null +++ b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectA-scenario/src/main/resources/application.yml @@ -0,0 +1,33 @@ +# +# 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. +# + +server: + port: 8080 +spring: + cloud: + gateway: + httpclient: + connect-timeout: 2000 + routes: + - id: provider_route + uri: http://localhost:18070 + predicates: + - Path=/provider/b/* + - id: provider_timeout + uri: http://1.2.3.4:18070 + predicates: + - Path=/provider/timeout/* diff --git a/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectB-scenario/pom.xml b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectB-scenario/pom.xml new file mode 100644 index 0000000000..2e1b7cb3d7 --- /dev/null +++ b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectB-scenario/pom.xml @@ -0,0 +1,57 @@ + + + + + gateway-4.3.x-scenario + org.apache.skywalking + 5.0.0 + + 4.0.0 + + gateway-projectB-scenario + + + + org.springframework.boot + spring-boot-starter-web + 2.1.0.RELEASE + + + + + gateway-projectB-scenario + + + org.springframework.boot + spring-boot-maven-plugin + 1.5.9.RELEASE + + + + repackage + + + + + + + + \ No newline at end of file diff --git a/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectB-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectB/Application.java b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectB-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectB/Application.java new file mode 100644 index 0000000000..51c94655c7 --- /dev/null +++ b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectB-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectB/Application.java @@ -0,0 +1,31 @@ +/* + * 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 test.apache.skywalking.apm.testcase.sc.gateway.projectB; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; + +@SpringBootApplication +@ComponentScan(value = {"test.apache.skywalking.apm.testcase.sc.gateway.projectB.controller"}) +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } +} diff --git a/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectB-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectB/controller/TestController.java b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectB-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectB/controller/TestController.java new file mode 100644 index 0000000000..923d7fd7ff --- /dev/null +++ b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectB-scenario/src/main/java/test/apache/skywalking/apm/testcase/sc/gateway/projectB/controller/TestController.java @@ -0,0 +1,40 @@ +/* + * 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 test.apache.skywalking.apm.testcase.sc.gateway.projectB.controller; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.client.RestTemplate; + +@RestController +public class TestController { + + @RequestMapping("/provider/b/testcase") + public String testcase() { + try { + new RestTemplate().getForEntity("http://localhost:8080/provider/timeout/error", String.class); + } catch (Exception e) { + } + return "1"; + } + + @RequestMapping("/provider/b/healthCheck") + public String healthCheck() { + return "Success"; + } +} diff --git a/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectB-scenario/src/main/resources/application.properties b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectB-scenario/src/main/resources/application.properties new file mode 100644 index 0000000000..cac2c4d5a1 --- /dev/null +++ b/test/plugin/scenarios/gateway-4.3.x-scenario/gateway-projectB-scenario/src/main/resources/application.properties @@ -0,0 +1,17 @@ +# +# 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. +# +server.port=18070 \ No newline at end of file diff --git a/test/plugin/scenarios/gateway-4.3.x-scenario/pom.xml b/test/plugin/scenarios/gateway-4.3.x-scenario/pom.xml new file mode 100644 index 0000000000..a91ec5a97d --- /dev/null +++ b/test/plugin/scenarios/gateway-4.3.x-scenario/pom.xml @@ -0,0 +1,79 @@ + + + + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 3.2.5 + + + + org.apache.skywalking + gateway-4.3.x-scenario + pom + 5.0.0 + + gateway-projectA-scenario + gateway-projectB-scenario + gateway-dist + + + skywalking-gateway-4.3.x-scenario + + + UTF-8 + 17 + 2023.0.0 + 3.11.0 + 4.3.3 + ${test.framework.version} + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + gateway-4.3.x-scenario + + + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${java.version} + ${java.version} + ${project.build.sourceEncoding} + + + + + + diff --git a/test/plugin/scenarios/gateway-4.3.x-scenario/support-version.list b/test/plugin/scenarios/gateway-4.3.x-scenario/support-version.list new file mode 100644 index 0000000000..ab039a217d --- /dev/null +++ b/test/plugin/scenarios/gateway-4.3.x-scenario/support-version.list @@ -0,0 +1,17 @@ +# 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. + +4.3.3 \ No newline at end of file From c4bed4826b6998aa8846bf0d6477d98536f2f824 Mon Sep 17 00:00:00 2001 From: Siman-hub Date: Mon, 2 Feb 2026 10:13:14 +0000 Subject: [PATCH 2/2] test(plugin): install bash in agent-test-jvm image and add gateway 4.3.x scenario --- support-version.list | 1 - test/plugin/containers/jvm-container/pom.xml | 2 +- test/plugin/run.sh | 7 ------- 3 files changed, 1 insertion(+), 9 deletions(-) delete mode 100644 support-version.list diff --git a/support-version.list b/support-version.list deleted file mode 100644 index e91d9be2a8..0000000000 --- a/support-version.list +++ /dev/null @@ -1 +0,0 @@ -4.3.3 diff --git a/test/plugin/containers/jvm-container/pom.xml b/test/plugin/containers/jvm-container/pom.xml index 65d4045469..e71083c86e 100644 --- a/test/plugin/containers/jvm-container/pom.xml +++ b/test/plugin/containers/jvm-container/pom.xml @@ -53,7 +53,7 @@ chmod +x /usr/local/skywalking/run.sh tar -xvf ../tools/skywalking-mock-collector.tar.gz -C ../tools apt-get update -y - apt-get install -y unzip + apt-get install -y unzip bash rm -rf /var/lib/apt/lists/* ["/usr/local/skywalking/run.sh"] diff --git a/test/plugin/run.sh b/test/plugin/run.sh index f2d566a20c..164eebfe6d 100755 --- a/test/plugin/run.sh +++ b/test/plugin/run.sh @@ -159,15 +159,8 @@ remove_dir() { start_stamp=`date +%s` parse_commandline "$@" -if [[ "$scenario_name" == "gateway-4.3.x-scenario" ]]; then - base_image_java="eclipse-temurin:17-jdk-jammy" - base_image_tomcat="tomcat:10.1-jdk17" -fi - echo "Scenario=$scenario_name JavaImage=$base_image_java TomcatImage=$base_image_tomcat" - - if [[ "$cleanup" == "on" ]]; then do_cleanup [[ -z "${scenario_name}" ]] && exit 0