提交 d0a1cdd5 编写于 作者: V viswaramamoorthy 提交者: wu-sheng

Rabbitmq plugin test migration (#3788)

* Rabbitmq plugin e2e test migration

* 3753-code review fixes

* 3753-test-case-improvements

* Update pom.xml

Remove the repo addresses.

* Update Plugin-test.md
上级 5f8ee254
......@@ -67,8 +67,7 @@ pipeline {
sh './mvnw -f test/plugin/pom.xml clean package -DskipTests docker:build'
}
}
stage('Test Cases Report (144)') {
stage('Test Cases Report (156)') {
steps {
echo "Test Cases Report"
}
......@@ -100,6 +99,12 @@ pipeline {
sh 'bash test/plugin/run.sh netty-socketio-scenario'
}
}
stage('rabbitmq-scenario (12)') {
steps {
sh 'bash test/plugin/run.sh rabbitmq-scenario'
}
}
}
}
......
......@@ -612,12 +612,13 @@ stage('Run Agent Plugin Tests') {
Find the button 'detail' of your Workload in the PR page. Enter to the page and get the elapsed time of your task.
### Workload 1
#### Group 1 (2247.00s)
#### Group 1 (2709.00s)
scenario name | versions | elapsed time (sec)
---|---|---
apm-toolkit-trace | 1 | 87.00
jetty 9.x | 63 | 2043.00
netty-socketio 1.x | 4 | 117.00
rabbitmq-scenario | 12 | 462
#### Group 2 (2291.98s)
scenario name | versions | elapsed time (sec)
......
#!/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} ${home}/../libs/rabbitmq-scenario.jar &
# 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:
- {rabbitmq-scenario: nq 0}
instances:
- {rabbitmq-scenario: 1}
operationNames:
- rabbitmq-scenario: [/rabbitmq-scenario/case/rabbitmq,RabbitMQ/Topic/Queue/test/Producer,RabbitMQ/Topic/Queue/test/Consumer]
segmentItems:
- applicationCode: rabbitmq-scenario
segmentSize: gt 2
segments:
- segmentId: not null
spans:
- operationName: RabbitMQ/Topic/Queue/test/Consumer
operationId: 0
parentSpanId: -1
spanId: 0
spanLayer: MQ
startTime: nq 0
endTime: nq 0
componentId: 53
componentName: ''
isError: false
spanType: Entry
peer: ''
peerId: 0
tags:
- {key: mq.broker, value: 'not null'}
- {key: mq.topic, value: ''}
- {key: mq.queue, value: test}
refs:
- {parentEndpointId: 0, parentEndpoint: /rabbitmq-scenario/case/rabbitmq, networkAddressId: 0,entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null,parentServiceInstanceId: nq 0, networkAddress: not null, entryEndpoint: /rabbitmq-scenario/case/rabbitmq,entryServiceInstanceId: nq 0}
- segmentId: not null
spans:
- operationName: RabbitMQ/Topic/Queue/test/Producer
operationId: 0
parentSpanId: 0
spanId: 1
spanLayer: MQ
startTime: nq 0
endTime: nq 0
componentId: 52
componentName: ''
isError: false
spanType: Exit
peer: not null
peerId: 0
tags:
- {key: mq.broker, value: 'not null'}
- {key: mq.queue, value: test}
- {key: mq.topic, value: ''}
- operationName: /rabbitmq-scenario/case/rabbitmq
operationId: 0
parentSpanId: -1
spanId: 0
spanLayer: Http
startTime: nq 0
endTime: nq 0
componentId: 1
componentName: ''
isError: false
spanType: Entry
peer: ''
peerId: 0
tags:
- {key: url, value: 'http://localhost:8080/rabbitmq-scenario/case/rabbitmq'}
- {key: http.method, value: GET}
# 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/rabbitmq-scenario/case/rabbitmq
healthCheck: http://localhost:8080/rabbitmq-scenario/case/healthcheck
startScript: ./bin/startup.sh
framework: rabbitmq
environment:
- RABBITMQ_HOST=rabbitmq-server
dependencies:
rabbitmq-server:
image: rabbitmq:latest
hostname: rabbitmq-server
expose:
- 5672
- 15672
environment:
- RABBITMQ_DEFAULT_PASS=admin
- RABBITMQ_DEFAULT_USER=admin
- RABBITMQ_DEFAULT_VHOST=/
<?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>rabbitmq-scenario</artifactId>
<version>5.0.0-2018</version>
<name>skywalking-rabbitmq-scenario</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<test.framework.version>5.4.0</test.framework.version>
<docker.image.version>${test.framework.version}</docker.image.version>
<!-- -->
<log4j.version>2.8.1</log4j.version>
<spring-boot-version>2.1.4.RELEASE</spring-boot-version>
</properties>
<dependencies>
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
<version>${test.framework.version}</version>
</dependency>
<!-- Spring Boot-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>${spring-boot-version}</version>
<exclusions>
<exclusion>
<artifactId>spring-boot-starter-logging</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring-boot-version}</version>
</dependency>
</dependencies>
<build>
<finalName>rabbitmq-scenario</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.5.9.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.8</source>
<target>1.8</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>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<?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}/rabbitmq-scenario.jar</source>
<outputDirectory>./libs</outputDirectory>
<fileMode>0775</fileMode>
</file>
</files>
</assembly>
/*
* 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.apm.testcase.rabbitmq;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
try {
SpringApplication.run(Application.class, args);
} catch (Exception e) {
// Never do this
}
}
}
/*
* 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.apm.testcase.rabbitmq.controller;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import com.rabbitmq.client.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
@RestController
@RequestMapping("/case")
@PropertySource("classpath:application.properties")
public class CaseController {
private Logger logger = LogManager.getLogger(CaseController.class);
private static final String USERNAME = "admin";
private static final String PASSWORD = "admin";
@Value(value = "${rabbitmq.host:127.0.0.1}")
private String brokerUrl;
private static final int PORT = 5672;
private static final String QUEUE_NAME = "test";
private static final String MESSAGE = "rabbitmq-testcase";
@RequestMapping("/rabbitmq")
@ResponseBody
public String rabbitmqCase() throws Exception {
Channel channel = null;
Connection connection = null;
try{
ConnectionFactory factory = new ConnectionFactory();
logger.info("Using brokerUrl = " + brokerUrl);
factory.setHost(brokerUrl);
factory.setPort(PORT);
factory.setUsername(USERNAME);
factory.setPassword(PASSWORD);
connection = factory.newConnection();
channel = connection.createChannel();
channel.queueDeclare(QUEUE_NAME, false, false, false, null);
AMQP.BasicProperties.Builder propsBuilder = new AMQP.BasicProperties.Builder();
logger.info("Message being published -------------->"+MESSAGE);
channel.basicPublish("", QUEUE_NAME, propsBuilder.build(), MESSAGE.getBytes("UTF-8"));
logger.info("Message has been published-------------->"+MESSAGE);
final CountDownLatch waitForConsume = new CountDownLatch(1);
DeliverCallback deliverCallback = (consumerTag, delivery) -> {
String message = new String(delivery.getBody(), "UTF-8");
logger.info("Message received-------------->"+message);
waitForConsume.countDown();
};
channel.basicConsume(QUEUE_NAME, true, deliverCallback, consumerTag -> { });
waitForConsume.await(5000L, TimeUnit.MILLISECONDS);
logger.info("Message Consumed-------------->");
}catch (Exception ex){
logger.error(ex.toString());
}
finally {
if (channel != null) {
try {
channel.close();
}catch (Exception e){
// ignore
}
}
if (connection != null) {
try {
connection.close();
}catch (Exception e){
// ignore
}
}
}
return "Success";
}
@RequestMapping("/healthcheck")
public String healthCheck() throws Exception {
Channel channel = null;
Connection connection = null;
try{
ConnectionFactory factory = new ConnectionFactory();
logger.info("Using brokerUrl = " + brokerUrl);
factory.setHost(brokerUrl);
factory.setPort(PORT);
factory.setUsername(USERNAME);
factory.setPassword(PASSWORD);
connection = factory.newConnection();
channel = connection.createChannel();
channel.queueDeclare(QUEUE_NAME, false, false, false, null);
logger.info("Completed Health Check. Able to connect to RabbitMQ and create queue-------------->");
}catch (Exception ex){
logger.error(ex.toString());
throw ex;
}
finally {
if (channel != null) {
try {
channel.close();
}catch (Exception e){
// ignore
}
}
if (connection != null) {
try {
connection.close();
}catch (Exception e){
// ignore
}
}
}
return "Success";
}
}
#
# 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.servlet.context-path=/rabbitmq-scenario
<?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.
~
-->
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_ERR">
<PatternLayout charset="UTF-8" pattern="[%d{yyyy-MM-dd HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="WARN">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>
# 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.
5.5.1
5.5.0
5.4.3
5.4.2
5.4.1
5.4.0
5.3.0
5.2.0
5.1.2
5.1.1
5.1.0
5.0.0
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册