From c002a6b3bfbc1affc8ba976a7deb01acbe9746db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E7=8E=89=E6=A1=94?= Date: Mon, 4 Nov 2019 17:51:23 +0800 Subject: [PATCH] [test/plugin] immigrate test redisson scenario. (#3775) * add redisson testcase --- Jenkinsfile-Agent-Test-2 | 8 +- .../redisson-scenario/bin/startup.sh | 21 ++++ .../config/expectedData.yaml | 80 +++++++++++++ .../redisson-scenario/configuration.yml | 29 +++++ .../scenarios/redisson-scenario/pom.xml | 105 ++++++++++++++++++ .../src/main/assembly/assembly.xml | 41 +++++++ .../apm/testcase/redisson/Application.java | 33 ++++++ .../redisson/controller/CaseController.java | 74 ++++++++++++ .../src/main/resources/application.properties | 20 ++++ .../redisson-scenario/support-version.list | 39 +++++++ 10 files changed, 449 insertions(+), 1 deletion(-) create mode 100644 test/plugin/scenarios/redisson-scenario/bin/startup.sh create mode 100644 test/plugin/scenarios/redisson-scenario/config/expectedData.yaml create mode 100644 test/plugin/scenarios/redisson-scenario/configuration.yml create mode 100644 test/plugin/scenarios/redisson-scenario/pom.xml create mode 100644 test/plugin/scenarios/redisson-scenario/src/main/assembly/assembly.xml create mode 100644 test/plugin/scenarios/redisson-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/redisson/Application.java create mode 100644 test/plugin/scenarios/redisson-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/redisson/controller/CaseController.java create mode 100644 test/plugin/scenarios/redisson-scenario/src/main/resources/application.properties create mode 100644 test/plugin/scenarios/redisson-scenario/support-version.list diff --git a/Jenkinsfile-Agent-Test-2 b/Jenkinsfile-Agent-Test-2 index 2a51eebcd..8b43e9487 100755 --- a/Jenkinsfile-Agent-Test-2 +++ b/Jenkinsfile-Agent-Test-2 @@ -67,7 +67,7 @@ pipeline { sh './mvnw -f test/plugin/pom.xml clean package -DskipTests docker:build' } } - stage('Test Cases Report (175)') { + stage('Test Cases Report (198)') { steps { echo "Test Cases Report" } @@ -82,6 +82,12 @@ pipeline { parallel { stage('Group1') { stages { + stage('redisson-scenario 3.x (23)') { + steps { + sh 'bash test/plugin/run.sh redisson-scenario' + } + } + stage('spring-cloud-gateway 2.1.x (3)') { steps { sh 'bash test/plugin/run.sh gateway-scenario' diff --git a/test/plugin/scenarios/redisson-scenario/bin/startup.sh b/test/plugin/scenarios/redisson-scenario/bin/startup.sh new file mode 100644 index 000000000..3463dabe3 --- /dev/null +++ b/test/plugin/scenarios/redisson-scenario/bin/startup.sh @@ -0,0 +1,21 @@ +#!/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 -Dredis.servers=${REDIS_SERVERS} -jar ${agent_opts} ${home}/../libs/redisson-scenario.jar & \ No newline at end of file diff --git a/test/plugin/scenarios/redisson-scenario/config/expectedData.yaml b/test/plugin/scenarios/redisson-scenario/config/expectedData.yaml new file mode 100644 index 000000000..d1cb1dcc7 --- /dev/null +++ b/test/plugin/scenarios/redisson-scenario/config/expectedData.yaml @@ -0,0 +1,80 @@ +# 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. + +registryItems: + applications: + - {redisson-scenario: 2} + instances: + - {redisson-scenario: 1} + operationNames: + - redisson-scenario: [/case/healthCheck, Redisson/BATCH_EXECUTE, Redisson/SET, /case/redisson-case] + heartbeat: [] +segmentItems: + - applicationCode: redisson-scenario + segmentSize: nq 0 + segments: + - segmentId: not null + spans: + - operationName: Redisson/SET + operationId: 0 + parentSpanId: 0 + spanId: 1 + spanLayer: Cache + startTime: not null + endTime: not null + componentId: 56 + componentName: '' + isError: false + spanType: Exit + peer: not null + peerId: 0 + tags: + - {key: db.type, value: Redis} + - {key: db.instance, value: not null} + - {key: db.statement, value: 'SET key_a ?'} + - operationName: Redisson/BATCH_EXECUTE + operationId: 0 + parentSpanId: 0 + spanId: nq 0 + spanLayer: Cache + startTime: not null + endTime: not null + componentId: 56 + componentName: '' + isError: false + spanType: Exit + peer: not null + peerId: 0 + tags: + - {key: db.type, value: Redis} + - {key: db.instance, value: not null} + - {key: db.statement, value: 'SET batch_k_a ?;SET batch_k_b ?;PEXPIRE batch_k_b 20000;'} + - operationName: /case/redisson-case + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: not null + endTime: not null + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: not null} + - {key: http.method, value: GET} \ No newline at end of file diff --git a/test/plugin/scenarios/redisson-scenario/configuration.yml b/test/plugin/scenarios/redisson-scenario/configuration.yml new file mode 100644 index 000000000..e97e41618 --- /dev/null +++ b/test/plugin/scenarios/redisson-scenario/configuration.yml @@ -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. + +type: jvm +entryService: http://localhost:8080/redisson-scenario/case/redisson-case +healthCheck: http://localhost:8080/redisson-scenario/case/healthCheck +startScript: ./bin/startup.sh +framework: redisson +environment: + - REDIS_SERVERS=redis-server:6379 +depends_on: + - redis-server +dependencies: + redis-server: + image: redis:3.2.9-alpine + hostname: redis-server \ No newline at end of file diff --git a/test/plugin/scenarios/redisson-scenario/pom.xml b/test/plugin/scenarios/redisson-scenario/pom.xml new file mode 100644 index 000000000..288129b55 --- /dev/null +++ b/test/plugin/scenarios/redisson-scenario/pom.xml @@ -0,0 +1,105 @@ + + + + 4.0.0 + + org.apache.skywalking + redisson-scenario + 5.0.0 + + + UTF-8 + 1.8 + 1.5.2.RELEASE + 3.6.0 + ${test.framework.version} + + + skywalking-redisson-scenario + + + + org.redisson + redisson + ${test.framework.version} + + + org.springframework.boot + spring-boot-starter-web + ${spring-boot-version} + + + + + redisson-scenario + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + maven-compiler-plugin + + ${compiler.version} + ${compiler.version} + ${project.build.sourceEncoding} + + + + org.apache.maven.plugins + maven-assembly-plugin + + + assemble + package + + single + + + + src/main/assembly/assembly.xml + + ./target/ + + + + + + + + + + spring-snapshots + http://repo.spring.io/snapshot + + + spring-milestones + http://repo.spring.io/milestone + + + \ No newline at end of file diff --git a/test/plugin/scenarios/redisson-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/redisson-scenario/src/main/assembly/assembly.xml new file mode 100644 index 000000000..817235368 --- /dev/null +++ b/test/plugin/scenarios/redisson-scenario/src/main/assembly/assembly.xml @@ -0,0 +1,41 @@ + + + + + zip + + + + + ./bin + 0775 + + + + + + ${project.build.directory}/redisson-scenario.jar + ./libs + 0775 + + + diff --git a/test/plugin/scenarios/redisson-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/redisson/Application.java b/test/plugin/scenarios/redisson-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/redisson/Application.java new file mode 100644 index 000000000..c6d641e05 --- /dev/null +++ b/test/plugin/scenarios/redisson-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/redisson/Application.java @@ -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. + * + */ + +package test.org.apache.skywalking.apm.testcase.redisson; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * @author zhaoyuguang + */ +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } +} diff --git a/test/plugin/scenarios/redisson-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/redisson/controller/CaseController.java b/test/plugin/scenarios/redisson-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/redisson/controller/CaseController.java new file mode 100644 index 000000000..657776f45 --- /dev/null +++ b/test/plugin/scenarios/redisson-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/redisson/controller/CaseController.java @@ -0,0 +1,74 @@ +/* + * 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.org.apache.skywalking.apm.testcase.redisson.controller; + +import org.redisson.Redisson; +import org.redisson.api.RBatch; +import org.redisson.api.RBucket; +import org.redisson.api.RedissonClient; +import org.redisson.config.Config; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.PropertySource; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.PostConstruct; +import java.util.concurrent.TimeUnit; + +/** + * @author zhaoyuguang + */ +@Controller +@RequestMapping("/case") +@PropertySource("classpath:application.properties") +public class CaseController { + + @Value("${redis.servers:127.0.0.1:6379}") + private String address; + + private RedissonClient client; + + @PostConstruct + private void setUp() { + Config config = new Config(); + config.useSingleServer().setAddress("redis://" + address); + client = Redisson.create(config); + } + + @RequestMapping("/redisson-case") + @ResponseBody + public String redissonCase() { + RBucket bucket = client.getBucket("key_a"); + bucket.set("value_a"); + RBatch batch = client.createBatch(); + batch.getBucket("batch_k_a").setAsync("batch_v_a"); + batch.getBucket("batch_k_b").setAsync("batch_v_b"); + batch.getBucket("batch_k_b").expireAsync(20, TimeUnit.SECONDS); + batch.execute(); + return "Success"; + } + + @RequestMapping("/healthCheck") + @ResponseBody + public String healthCheck() { + return "success"; + } +} + diff --git a/test/plugin/scenarios/redisson-scenario/src/main/resources/application.properties b/test/plugin/scenarios/redisson-scenario/src/main/resources/application.properties new file mode 100644 index 000000000..79530757d --- /dev/null +++ b/test/plugin/scenarios/redisson-scenario/src/main/resources/application.properties @@ -0,0 +1,20 @@ +# +# 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 +server.contextPath=/redisson-scenario \ No newline at end of file diff --git a/test/plugin/scenarios/redisson-scenario/support-version.list b/test/plugin/scenarios/redisson-scenario/support-version.list new file mode 100644 index 000000000..ace97afaa --- /dev/null +++ b/test/plugin/scenarios/redisson-scenario/support-version.list @@ -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 +# "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. + +3.9.1 +3.9.0 +3.8.2 +3.8.1 +3.8.0 +3.7.5 +3.7.4 +3.7.3 +3.7.2 +3.7.1 +3.7.0 +3.6.5 +3.6.4 +3.6.3 +3.6.2 +3.6.1 +3.6.0 +3.5.7 +3.5.6 +3.5.5 +3.5.4 +3.5.3 +3.5.2 \ No newline at end of file