You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2019/11/04 09:51:34 UTC

[skywalking] branch master updated: [test/plugin] immigrate test redisson scenario. (#3775)

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 c002a6b  [test/plugin] immigrate test redisson scenario. (#3775)
c002a6b is described below

commit c002a6b3bfbc1affc8ba976a7deb01acbe9746db
Author: 于玉桔 <zh...@apache.org>
AuthorDate: Mon Nov 4 17:51:23 2019 +0800

    [test/plugin] immigrate test redisson scenario. (#3775)
    
    * add redisson testcase
---
 Jenkinsfile-Agent-Test-2                           |   8 +-
 .../scenarios/redisson-scenario/bin/startup.sh     |  21 +++++
 .../redisson-scenario/config/expectedData.yaml     |  80 ++++++++++++++++
 .../scenarios/redisson-scenario/configuration.yml  |  29 ++++++
 test/plugin/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(-)

diff --git a/Jenkinsfile-Agent-Test-2 b/Jenkinsfile-Agent-Test-2
index 2a51eeb..8b43e94 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 0000000..3463dab
--- /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 0000000..d1cb1dc
--- /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 0000000..e97e416
--- /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 0000000..288129b
--- /dev/null
+++ b/test/plugin/scenarios/redisson-scenario/pom.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  ~
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.apache.skywalking</groupId>
+    <artifactId>redisson-scenario</artifactId>
+    <version>5.0.0</version>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <compiler.version>1.8</compiler.version>
+        <spring-boot-version>1.5.2.RELEASE</spring-boot-version>
+        <test.framework.version>3.6.0</test.framework.version>
+        <docker.image.version>${test.framework.version}</docker.image.version>
+    </properties>
+
+    <name>skywalking-redisson-scenario</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.redisson</groupId>
+            <artifactId>redisson</artifactId>
+            <version>${test.framework.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+            <version>${spring-boot-version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <finalName>redisson-scenario</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>${compiler.version}</source>
+                    <target>${compiler.version}</target>
+                    <encoding>${project.build.sourceEncoding}</encoding>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>assemble</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <configuration>
+                            <descriptors>
+                                <descriptor>src/main/assembly/assembly.xml</descriptor>
+                            </descriptors>
+                            <outputDirectory>./target/</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <pluginRepositories>
+        <pluginRepository>
+            <id>spring-snapshots</id>
+            <url>http://repo.spring.io/snapshot</url>
+        </pluginRepository>
+        <pluginRepository>
+            <id>spring-milestones</id>
+            <url>http://repo.spring.io/milestone</url>
+        </pluginRepository>
+    </pluginRepositories>
+</project>
\ 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 0000000..8172353
--- /dev/null
+++ b/test/plugin/scenarios/redisson-scenario/src/main/assembly/assembly.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  ~
+  -->
+<assembly
+        xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+    <formats>
+        <format>zip</format>
+    </formats>
+
+    <fileSets>
+        <fileSet>
+            <directory>./bin</directory>
+            <fileMode>0775</fileMode>
+        </fileSet>
+    </fileSets>
+
+    <files>
+        <file>
+            <source>${project.build.directory}/redisson-scenario.jar</source>
+            <outputDirectory>./libs</outputDirectory>
+            <fileMode>0775</fileMode>
+        </file>
+    </files>
+</assembly>
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 0000000..c6d641e
--- /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 0000000..657776f
--- /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<String> 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 0000000..7953075
--- /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 0000000..ace97af
--- /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