improve nginx e2e test (#72)
Co-authored-by: zhuanghaochao <zhuanghaochao@yy.com>
diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml
index d08adb3..cd607ce 100644
--- a/.github/workflows/e2e.yaml
+++ b/.github/workflows/e2e.yaml
@@ -45,4 +45,4 @@
run: export MAVEN_OPTS='-Dmaven.repo.local=~/.m2/repository -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit -Xmx3g'
- name: Compile & E2E Test
run: |
- ./mvnw -f ./test/e2e/pom.xml package verify
+ ./mvnw -f ./test/e2e/pom.xml verify
diff --git a/test/e2e/agent-test-tools/pom.xml b/test/e2e/agent-test-tools/pom.xml
index 30d972d..413a00c 100644
--- a/test/e2e/agent-test-tools/pom.xml
+++ b/test/e2e/agent-test-tools/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.skywalking.plugin.nginx-lua</groupId>
- <artifactId>e2e-tests</artifactId>
+ <artifactId>e2e</artifactId>
<version>1.0.0</version>
</parent>
diff --git a/test/e2e/e2e-with-mock-collector/docker/bin/startup.sh b/test/e2e/e2e-test/nginx/docker/bin/startup.sh
similarity index 90%
rename from test/e2e/e2e-with-mock-collector/docker/bin/startup.sh
rename to test/e2e/e2e-test/nginx/docker/bin/startup.sh
index abb4561..fefa653 100644
--- a/test/e2e/e2e-with-mock-collector/docker/bin/startup.sh
+++ b/test/e2e/e2e-test/nginx/docker/bin/startup.sh
@@ -16,7 +16,13 @@
# specific language governing permissions and limitations
# under the License.
+apt update
+
+apt install -y luarocks
+
+luarocks make rockspec/skywalking-nginx-lua-master-0.rockspec
+
COLLECTOR=$(grep "skywalking-collector" /etc/hosts |awk -F" " '{print $1}')
sed -e "s%\${collector}%${COLLECTOR}%g" /var/nginx/conf.d/nginx.conf > /var/run/nginx.conf
-/usr/bin/openresty -c /var/run/nginx.conf
\ No newline at end of file
+/usr/bin/openresty -c /var/run/nginx.conf
diff --git a/test/e2e/e2e-with-mock-collector/docker/conf.d/nginx.conf b/test/e2e/e2e-test/nginx/docker/conf.d/nginx.conf
similarity index 97%
rename from test/e2e/e2e-with-mock-collector/docker/conf.d/nginx.conf
rename to test/e2e/e2e-test/nginx/docker/conf.d/nginx.conf
index be89a69..ab6bbe5 100644
--- a/test/e2e/e2e-with-mock-collector/docker/conf.d/nginx.conf
+++ b/test/e2e/e2e-test/nginx/docker/conf.d/nginx.conf
@@ -25,7 +25,7 @@
worker_connections 1024;
}
http {
- lua_package_path "/usr/local/skywalking-nginx-lua/lib/?.lua;;";
+ lua_package_path "/usr/local/share/lua/5.1/skywalking/?.lua;;";
# Buffer represents the register inform and the queue of the finished segment
lua_shared_dict tracing_buffer 100m;
diff --git a/test/e2e/e2e-with-mock-collector/pom.xml b/test/e2e/e2e-test/nginx/pom.xml
similarity index 88%
rename from test/e2e/e2e-with-mock-collector/pom.xml
rename to test/e2e/e2e-test/nginx/pom.xml
index 1286e15..e171fe3 100644
--- a/test/e2e/e2e-with-mock-collector/pom.xml
+++ b/test/e2e/e2e-test/nginx/pom.xml
@@ -22,10 +22,11 @@
<parent>
<groupId>org.apache.skywalking.plugin.nginx-lua</groupId>
- <artifactId>e2e-tests</artifactId>
+ <artifactId>e2e-test</artifactId>
<version>1.0.0</version>
</parent>
- <artifactId>e2e-with-mock-collector</artifactId>
+
+ <artifactId>nginx</artifactId>
<packaging>jar</packaging>
<build>
@@ -37,8 +38,15 @@
<containerNamePattern>%a-%t-%i</containerNamePattern>
<images>
<image>
- <name>openresty/openresty</name>
- <alias>openresty-with-skywalking</alias>
+ <name>openresty-with-skywalking</name>
+ <build>
+ <from>openresty/openresty</from>
+ <workdir>/skywalking-nginx-lua</workdir>
+ <cmd>
+ <shell>apt update</shell>
+ <shell>apt install -y luarocks</shell>
+ </cmd>
+ </build>
<run>
<dependsOn>
<container>skywalking-collector</container>
@@ -51,7 +59,7 @@
<volume>${project.basedir}/docker/conf.d:/var/nginx/conf.d</volume>
<volume>${project.basedir}/docker/bin:/opt/bin</volume>
<volume>
- ${project.basedir}/../../../lib:/usr/local/skywalking-nginx-lua/lib
+ ${project.basedir}/../../../..:/skywalking-nginx-lua/
</volume>
</bind>
</volumes>
diff --git a/test/e2e/e2e-with-mock-collector/src/test/java/org/apache/skywalking/e2e/DataAssertITCase.java b/test/e2e/e2e-test/nginx/src/test/java/org/apache/skywalking/e2e/DataAssertITCase.java
similarity index 100%
rename from test/e2e/e2e-with-mock-collector/src/test/java/org/apache/skywalking/e2e/DataAssertITCase.java
rename to test/e2e/e2e-test/nginx/src/test/java/org/apache/skywalking/e2e/DataAssertITCase.java
diff --git a/test/e2e/e2e-with-mock-collector/src/test/resources/expectedData.yaml b/test/e2e/e2e-test/nginx/src/test/resources/expectedData.yaml
similarity index 100%
rename from test/e2e/e2e-with-mock-collector/src/test/resources/expectedData.yaml
rename to test/e2e/e2e-test/nginx/src/test/resources/expectedData.yaml
diff --git a/test/e2e/e2e-test/pom.xml b/test/e2e/e2e-test/pom.xml
new file mode 100644
index 0000000..5910793
--- /dev/null
+++ b/test/e2e/e2e-test/pom.xml
@@ -0,0 +1,270 @@
+<?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>
+
+ <parent>
+ <groupId>org.apache.skywalking.plugin.nginx-lua</groupId>
+ <artifactId>e2e</artifactId>
+ <version>1.0.0</version>
+ </parent>
+
+ <artifactId>e2e-test</artifactId>
+
+ <name>SkyWalking Nginx Lua E2E Tests</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>nginx</module>
+ </modules>
+
+ <properties>
+ <java.version>1.8</java.version>
+
+ <junit.version>4.11</junit.version>
+ <slf4j.version>1.7.25</slf4j.version>
+ <log4j.version>2.9.0</log4j.version>
+ <gson.version>2.8.6</gson.version>
+ <guava.version>28.1-jre</guava.version>
+ <lombok.version>1.18.10</lombok.version>
+ <snakeyaml.version>1.18</snakeyaml.version>
+ <httpclient.version>4.5.6</httpclient.version>
+
+ <maven.compiler.source>${java.version}</maven.compiler.source>
+ <maven.compiler.target>${java.version}</maven.compiler.target>
+
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+
+ <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
+ <docker-maven-plugin.version>0.4.13</docker-maven-plugin.version>
+
+ <maven-failsafe-plugin.version>3.0.0-M4</maven-failsafe-plugin.version>
+ <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
+ <docker-maven-plugin.version>0.30.0</docker-maven-plugin.version>
+ <surefire.version>3.0.0-M4</surefire.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>${httpclient.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>${guava.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.yaml</groupId>
+ <artifactId>snakeyaml</artifactId>
+ <version>${snakeyaml.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>${gson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>${lombok.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>log4j-over-slf4j</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ <version>${log4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ <version>${log4j.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.yaml</groupId>
+ <artifactId>snakeyaml</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>log4j-over-slf4j</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ <version>${log4j.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>${maven-failsafe-plugin.version}</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>surefire-junit4</artifactId>
+ <version>${maven-failsafe-plugin.version}</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ <configuration>
+ <excludes>
+ <exclude>none</exclude>
+ </excludes>
+ <includes>
+ <include>**/*ITCase.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>${docker-maven-plugin.version}</version>
+ <configuration>
+ <sourceMode>all</sourceMode>
+ <showLogs>true</showLogs>
+ <logDate>default</logDate>
+ <imagePullPolicy>IfNotPresent</imagePullPolicy>
+ </configuration>
+ <executions>
+ <execution>
+ <id>build</id>
+ <phase>package</phase>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>start</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${surefire.version}</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${maven-compiler-plugin.version}</version>
+ <configuration>
+ <source>${java.version}</source>
+ <target>${java.version}</target>
+ <encoding>${project.build.sourceEncoding}</encoding>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${surefire.version}</version>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git a/test/e2e/pom.xml b/test/e2e/pom.xml
index bc30b91..20685bb 100644
--- a/test/e2e/pom.xml
+++ b/test/e2e/pom.xml
@@ -24,7 +24,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.skywalking.plugin.nginx-lua</groupId>
- <artifactId>e2e-tests</artifactId>
+ <artifactId>e2e</artifactId>
<version>1.0.0</version>
<name>SkyWalking Nginx Lua E2E Tests</name>
@@ -32,7 +32,7 @@
<modules>
<module>agent-test-tools</module>
- <module>e2e-with-mock-collector</module>
+ <module>e2e-test</module>
</modules>
<properties>