Skip to content

Commit

Permalink
Fix CI failed && move to JVM container.
Browse files Browse the repository at this point in the history
  • Loading branch information
wayilau committed Nov 28, 2019
1 parent e0012d7 commit 828b034
Show file tree
Hide file tree
Showing 10 changed files with 190 additions and 130 deletions.
8 changes: 7 additions & 1 deletion Jenkinsfile-Agent-Test-2
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pipeline {
sh './mvnw -f test/plugin/pom.xml clean package -DskipTests docker:build'
}
}
stage('Test Cases Report (170)') {
stage('Test Cases Report (223)') {
steps {
echo "Test Cases Report"
}
Expand Down Expand Up @@ -139,6 +139,12 @@ pipeline {
sh 'bash test/plugin/run.sh elasticsearch-5.x-scenario'
}
}

stage('mysql 5.1.2-8.0.15 (53)') {
steps {
sh 'bash test/plugin/run.sh mysql-scenario'
}
}
}
}
}
Expand Down
8 changes: 1 addition & 7 deletions Jenkinsfile-Agent-Test-3
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pipeline {
sh './mvnw -f test/plugin/pom.xml clean package -DskipTests docker:build'
}
}
stage('Test Cases Report (214)') {
stage('Test Cases Report (161)') {
steps {
echo "Test Cases Report"
}
Expand Down Expand Up @@ -127,12 +127,6 @@ pipeline {
sh 'bash test/plugin/run.sh grpc-scenario'
}
}

stage('mysql 5.1.2-8.0.15 (53)') {
steps {
sh 'bash test/plugin/run.sh mysql-scenario'
}
}
}
}
}
Expand Down
79 changes: 76 additions & 3 deletions test/plugin/scenarios/mysql-scenario/config/expectedData.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,87 @@ registryItems:
instances:
- {mysql-scenario: 1}
operationNames:
- mysql-scenario: [/mysql-scenario/case/mysql]
- mysql-scenario: [Mysql/JDBI/Statement/execute, /mysql-scenario/case/healthCheck,
Mysql/JDBI/PreparedStatement/execute, /mysql-scenario/case/mysql-scenario, Mysql/JDBI/Connection/close]
segmentItems:
- applicationCode: mysql-scenario
segmentSize: ge 2
segments:
- segmentId: not null
spans:
- operationName: /mysql-scenario/case/mysql
- operationName: Mysql/JDBI/PreparedStatement/execute
operationId: eq 0
parentSpanId: 0
spanId: 1
tags:
- {key: "db.type", value: "sql"}
- {key: "db.instance", value: "test"}
- {key: "db.statement", value: "CREATE TABLE test_007(\nid VARCHAR(1) PRIMARY KEY, \nvalue VARCHAR(1) NOT NULL)"}
logs: []
startTime: nq 0
endTime: nq 0
isError: false
spanLayer: Database
spanType: Exit
componentName: null
componentId: 33
peer: mysql-server:3306
peerId: eq 0
- operationName: Mysql/JDBI/PreparedStatement/execute
operationId: eq 0
parentSpanId: 0
spanId: 2
tags:
- {key: "db.type", value: "sql"}
- {key: "db.instance", value: "test"}
- {key: "db.statement", value: "INSERT INTO test_007(id, value) VALUES(?,?)"}
logs: []
startTime: nq 0
endTime: nq 0
isError: false
spanLayer: Database
spanType: Exit
componentName: null
componentId: 33
peer: mysql-server:3306
peerId: eq 0
- operationName: Mysql/JDBI/Statement/execute
operationId: eq 0
parentSpanId: 0
spanId: 3
tags:
- {key: "db.type", value: "sql"}
- {key: "db.instance", value: "test"}
- {key: "db.statement", value: "DROP table test_007"}
logs: []
startTime: nq 0
endTime: nq 0
isError: false
spanLayer: Database
spanType: Exit
componentName: null
componentId: 33
peer: mysql-server:3306
peerId: eq 0
- operationName: Mysql/JDBI/Connection/close
operationId: eq 0
parentSpanId: 0
spanId: 4
tags:
- {key: "db.type", value: "sql"}
- {key: "db.instance", value: "test"}
- {key: "db.statement", value: ""}
logs: []
startTime: nq 0
endTime: nq 0
isError: false
spanLayer: Database
spanType: Exit
componentName: null
componentId: 33
peer: mysql-server:3306
peerId: eq 0
- operationName: /mysql-scenario/case/mysql-scenario
operationId: eq 0
parentSpanId: -1
spanId: 0
Expand All @@ -38,7 +111,7 @@ segmentItems:
componentName: null
componentId: 1
tags:
- {key: url, value: 'http://localhost:8080/mysql-scenario/case/mysql'}
- {key: url, value: 'http://localhost:8080/mysql-scenario/case/mysql-scenario'}
- {key: http.method, value: GET}
logs: []
peer: null
Expand Down
27 changes: 12 additions & 15 deletions test/plugin/scenarios/mysql-scenario/configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.

type: tomcat
entryService: http://localhost:8080/mysql-scenario/case/mysql
type: jvm
entryService: http://localhost:8080/mysql-scenario/case/mysql-scenario
healthCheck: http://localhost:8080/mysql-scenario/case/healthCheck
framework: mysql
startScript: ./bin/startup.sh
framework: mysql-scenario
environment:
depends_on:
- mysql
- mysql-server
dependencies:
mysql:
mysql-server:
image: mysql:5.7
hostname: mysql
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=test
hostname: mysql-server
expose:
- "3306"
healthcheck:
- 'test: ["CMD", "mysqladmin", "ping","--silent"]'
- "interval: 5s"
- "timeout: 10s"
- "retries: 5"
- "3306"
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=test
72 changes: 58 additions & 14 deletions test/plugin/scenarios/mysql-scenario/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,50 @@
<groupId>org.apache.skywalking.apm.testcase</groupId>
<artifactId>mysql-scenario</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>
<packaging>jar</packaging>

<modelVersion>4.0.0</modelVersion>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compiler.version>1.8</compiler.version>

<test.framework.version>5.1.5</test.framework.version>
<docker.image.version>${test.framework.version}</docker.image.version>

<spring-boot-version>2.1.6.RELEASE</spring-boot-version>
</properties>

<name>skywalking-mysql-scenario</name>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot-version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.8.1</version>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.8.1</version>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
Expand All @@ -63,6 +77,17 @@
<build>
<finalName>mysql-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>
Expand All @@ -71,6 +96,25 @@
<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>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,23 @@
* 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.mysql;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

public class HealthCheckServlet extends HttpServlet {

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// your codes
PrintWriter writer = resp.getWriter();
writer.write("Success");
writer.flush();
}
@SpringBootApplication
public class Application {

@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doGet(req, resp);
public static void main(String[] args) {
try {
SpringApplication.run(Application.class, args);
} catch (Exception e) {
// Never do this
}
}
}
Loading

0 comments on commit 828b034

Please sign in to comment.