use agent-test-tool docker image instead of building from source (#96)

* use agent-test-tool docker image instead of building from source
diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml
index c7bae69..a92f025 100644
--- a/.github/workflows/e2e.yaml
+++ b/.github/workflows/e2e.yaml
@@ -40,7 +40,5 @@
           java-version: 8
       - name: Set environment
         run: export MAVEN_OPTS='-Dmaven.repo.local=~/.m2/repository -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit -Xmx3g'
-      - name: Build E2E Docker
-        run: ./mvnw -f ./test/e2e/pom.xml package
       - name: Run Nginx Test
-        run: ./mvnw -f ./test/e2e/e2e-test/nginx/pom.xml verify
+        run: ./mvnw -f ./test/e2e/pom.xml verify
diff --git a/test/e2e/agent-test-tools/bin/fetch-code.sh b/test/e2e/agent-test-tools/bin/fetch-code.sh
deleted file mode 100644
index 5189a45..0000000
--- a/test/e2e/agent-test-tools/bin/fetch-code.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env 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.
-
-WORK_DIRECTORY=$1
-RESPOSITORY=$2
-COMMIT_ID=$3
-DIST_DIRECTORY=$4
-
-HOME_DIR="$(cd "$(dirname $0)"; pwd)"
-
-git clone $RESPOSITORY $WORK_DIRECTORY
-
-cd $WORK_DIRECTORY
-
-git checkout $COMMIT_ID
-
-mvn -B package -DskipTests
-
-[[ -d $DIST_DIRECTORY ]] || mkdir -p $DIST_DIRECTORY
-
-cp $WORK_DIRECTORY/dist/* $DIST_DIRECTORY/
\ No newline at end of file
diff --git a/test/e2e/agent-test-tools/docker/Dockerfile b/test/e2e/agent-test-tools/docker/Dockerfile
deleted file mode 100644
index ec78c24..0000000
--- a/test/e2e/agent-test-tools/docker/Dockerfile
+++ /dev/null
@@ -1,29 +0,0 @@
-# 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.
-
-FROM openjdk:8
-
-WORKDIR /usr/local/skywalking-nginx-lua
-
-COPY run.sh /
-RUN chmod +x /run.sh
-
-COPY skywalking-validator.jar ./agent-test-tools/skywalking-validator-tool.jar
-ADD skywalking-mock-collector.tar.gz agent-test-tools/
-RUN chmod +x ./agent-test-tools/skywalking-mock-collector/bin/collector-startup.sh
-
-CMD ["./agent-test-tools/skywalking-mock-collector/bin/collector-startup.sh"]
\ No newline at end of file
diff --git a/test/e2e/agent-test-tools/docker/run.sh b/test/e2e/agent-test-tools/docker/run.sh
deleted file mode 100644
index de08a66..0000000
--- a/test/e2e/agent-test-tools/docker/run.sh
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/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.
-
-# The variable names in UPPERCASE ltter represent that they are injected from outside.
-
-base_home="$(cd "$(dirname $0)"; pwd)"
-
-function exitOnError() {
-    echo -e "\033[31m[ERROR] $1\033[0m">&2
-    exitAndClean 1
-}
-
-function healthCheck() {
-    HEALTH_CHECK_URL=$1
-
-    STATUS_CODE="-1"
-    TIMES=${TIMES:-150}
-    for ((i=1; i<=${TIMES}; i++));
-    do
-        STATUS_CODE="$(curl --max-time 3 -Is ${HEALTH_CHECK_URL} | head -n 1)"
-        if [[ $STATUS_CODE == *"200"* ]]; then
-          echo "${HEALTH_CHECK_URL}: ${STATUS_CODE}"
-          return 0
-        fi
-        sleep 2
-    done
-
-    exitOnError "$2 url=${HEALTH_CHECK_URL}, status=${STATUS_CODE} health check failed!"
-}
-
-if [[ -z "${TESTCASE_STARTUP_SCRIPT}" ]]; then
-    exitOnError "The name of startup script cannot be empty!"
-fi
-
-tools_home=/usr/local/skywalking-nginx-lua/agent-test-tools
-testcase_home=/usr/local/skywalking-nginx-lua/testcase
-
-echo "To start mock collector"
-${tools_home}/skywalking-mock-collector/bin/collector-startup.sh 1>/dev/null &
-healthCheck http://localhost:12800/receiveData
-
-healthCheck http://localhost:12800/status
-
-echo "To visit entry service"
-curl -s --max-time 3 ${TESTCASE_SERVICE_ENTRY}
-sleep 5
-
-echo "To receive actual data"
-curl -s --max-time 3 http://localhost:12800/receiveData > ${testcase_home}/data/actualData.yaml
-[[ ! -f ${testcase_home}/data/actualData.yaml ]] && exitOnError "${TESTCASE_NAME}, 'actualData.yaml' Not Found!"
-
-echo "To validate"
-java -jar \
-    -Xmx256m -Xms256m \
-    -DcaseName="${TESTCASE_NAME}" \
-    -DtestCasePath=${testcase_home}/data/ \
-    ${tools_home}/skywalking-validator-tool.jar 1>/dev/null
-status=$?
-
-if [[ $status -eq 0 ]]; then
-  echo "Scenario[${TESTCASE_NAME}] passed!" >&2
-else
-  cat ${testcase_home}/data/actualData.yaml >&2
-  exitOnError "Scenario[${TESTCASE_NAME}] failed!"
-fi
-exitAndClean $status
diff --git a/test/e2e/agent-test-tools/pom.xml b/test/e2e/agent-test-tools/pom.xml
deleted file mode 100644
index 413a00c..0000000
--- a/test/e2e/agent-test-tools/pom.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<?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>agent-test-tools</artifactId>
-
-    <name>SkyWalking Agent Test Tools</name>
-    <packaging>jar</packaging>
-
-    <properties>
-        <docker.image.name>skywalking-collector</docker.image.name>
-        <docker-maven-plugin.version>0.4.13</docker-maven-plugin.version>
-        <exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
-        <agent-test-tools.version>ed896e044f146cf607441d375da4830e8d0547f8</agent-test-tools.version>
-        <agent-test-tools.workingDirectory>${project.basedir}/target/agent-test-tools</agent-test-tools.workingDirectory>
-        <agent-test-tools.repos>https://github.com/apache/skywalking-agent-test-tool.git</agent-test-tools.repos>
-    </properties>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>exec-maven-plugin</artifactId>
-                <version>${exec-maven-plugin.version}</version>
-                <executions>
-                    <execution>
-                        <phase>initialize</phase>
-                        <goals>
-                            <goal>exec</goal>
-                        </goals>
-                    </execution>
-                </executions>
-                <configuration>
-                    <executable>bash</executable>
-                    <arguments>
-                        <argument>${project.basedir}/bin/fetch-code.sh</argument>
-                        <argument>${agent-test-tools.workingDirectory}</argument>
-                        <argument>${agent-test-tools.repos}</argument>
-                        <argument>${agent-test-tools.version}</argument>
-                        <argument>${project.basedir}/dist</argument>
-                    </arguments>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>com.spotify</groupId>
-                <artifactId>docker-maven-plugin</artifactId>
-                <version>${docker-maven-plugin.version}</version>
-                <executions>
-                    <execution>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>build</goal>
-                        </goals>
-                    </execution>
-                </executions>
-                <configuration>
-                    <imageName>${docker.image.name}:${project.version}</imageName>
-                    <dockerDirectory>${project.basedir}/docker</dockerDirectory>
-                    <resources>
-                        <resource>
-                            <targetPath>/</targetPath>
-                            <directory>${project.basedir}/../agent-test-tools/dist</directory>
-                            <include>skywalking-mock-collector.tar.gz</include>
-                            <include>skywalking-validator.jar</include>
-                        </resource>
-                    </resources>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>
\ No newline at end of file
diff --git a/test/e2e/e2e-test/pom.xml b/test/e2e/e2e-test/pom.xml
deleted file mode 100644
index 2f98491..0000000
--- a/test/e2e/e2e-test/pom.xml
+++ /dev/null
@@ -1,270 +0,0 @@
-<?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.17.1</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/e2e-test/nginx/docker/bin/startup.sh b/test/e2e/nginx/docker/bin/startup.sh
similarity index 87%
rename from test/e2e/e2e-test/nginx/docker/bin/startup.sh
rename to test/e2e/nginx/docker/bin/startup.sh
index feed18a..3fa9a86 100644
--- a/test/e2e/e2e-test/nginx/docker/bin/startup.sh
+++ b/test/e2e/nginx/docker/bin/startup.sh
@@ -16,12 +16,9 @@
 # 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
+luarocks make /skywalking-nginx-lua/rockspec/skywalking-nginx-lua-master-0.rockspec
+
+openresty -c /var/run/nginx.conf
diff --git a/test/e2e/e2e-test/nginx/docker/conf.d/nginx.conf b/test/e2e/nginx/docker/conf.d/nginx.conf
similarity index 100%
rename from test/e2e/e2e-test/nginx/docker/conf.d/nginx.conf
rename to test/e2e/nginx/docker/conf.d/nginx.conf
diff --git a/test/e2e/e2e-test/nginx/pom.xml b/test/e2e/nginx/pom.xml
similarity index 92%
rename from test/e2e/e2e-test/nginx/pom.xml
rename to test/e2e/nginx/pom.xml
index ad349d6..dbd00af 100644
--- a/test/e2e/e2e-test/nginx/pom.xml
+++ b/test/e2e/nginx/pom.xml
@@ -22,13 +22,17 @@
 
     <parent>
         <groupId>org.apache.skywalking.plugin.nginx-lua</groupId>
-        <artifactId>e2e-test</artifactId>
+        <artifactId>e2e</artifactId>
         <version>1.0.0</version>
     </parent>
-    
+
     <artifactId>nginx</artifactId>
     <packaging>jar</packaging>
 
+    <properties>
+        <mock-collector.version>092c6a3c753684b5a301baf5bcb1965f2dfaf79d</mock-collector.version>
+    </properties>
+
     <build>
         <plugins>
             <plugin>
@@ -40,12 +44,8 @@
                         <image>
                             <name>openresty-with-skywalking</name>
                             <build>
-                                <from>openresty/openresty</from>
+                                <from>openresty/openresty:1.17.8.2-5-alpine-fat</from>
                                 <workdir>/skywalking-nginx-lua</workdir>
-                                <cmd>
-                                    <shell>apt update</shell>
-                                    <shell>apt install -y luarocks</shell>
-                                </cmd>
                             </build>
                             <run>
                                 <dependsOn>
@@ -59,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}/../../../..:/skywalking-nginx-lua/
+                                            ${project.basedir}/../../../:/skywalking-nginx-lua/
                                         </volume>
                                     </bind>
                                 </volumes>
@@ -78,7 +78,7 @@
                             </run>
                         </image>
                         <image>
-                            <name>skywalking-collector:${project.version}</name>
+                            <name>ghcr.io/apache/skywalking-agent-test-tool/mock-collector:${mock-collector.version}</name>
                             <alias>skywalking-collector</alias>
                             <run>
                                 <ports>
diff --git a/test/e2e/e2e-test/nginx/src/test/java/org/apache/skywalking/e2e/DataAssertITCase.java b/test/e2e/nginx/src/test/java/org/apache/skywalking/e2e/DataAssertITCase.java
similarity index 100%
rename from test/e2e/e2e-test/nginx/src/test/java/org/apache/skywalking/e2e/DataAssertITCase.java
rename to test/e2e/nginx/src/test/java/org/apache/skywalking/e2e/DataAssertITCase.java
diff --git a/test/e2e/e2e-test/nginx/src/test/resources/expectedData.yaml b/test/e2e/nginx/src/test/resources/expectedData.yaml
similarity index 69%
rename from test/e2e/e2e-test/nginx/src/test/resources/expectedData.yaml
rename to test/e2e/nginx/src/test/resources/expectedData.yaml
index 578b35f..3a0eb1d 100644
--- a/test/e2e/e2e-test/nginx/src/test/resources/expectedData.yaml
+++ b/test/e2e/nginx/src/test/resources/expectedData.yaml
@@ -14,13 +14,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-registryItems:
-  applications:
-    - {'e2e-test-with-mock-collector': 2}
-  instances:
-    - {'e2e-test-with-mock-collector': 1}
-  operationNames:
-    - e2e-test-with-mock-collector: [/tier2/lb, /ingress]
 segmentItems:
   - serviceName: e2e-test-with-mock-collector
     segmentSize: eq 2
@@ -38,13 +31,17 @@
             peer: 'e2e-test-with-mock-collector:upstream_ip2:port2'
             spanLayer: Http
             tags:
-              - {key: http.status, value: '200'}
+              - key: http.status
+                value: '200'
           - operationName: /tier2/lb
             startTime: gt 0
             tags:
-              - {key: http.method, value: GET}
-              - {key: http.params, value: 'http://127.0.0.1/tier2/lb'}
-              - {key: http.status, value: '200'}
+              - key: http.method
+                value: GET
+              - key: http.params
+                value: 'http://127.0.0.1/tier2/lb'
+              - key: http.status
+                value: '200'
             endTime: gt 0
             spanType: Entry
             spanId: 0
@@ -52,10 +49,14 @@
             parentSpanId: -1
             componentId: 6000
             refs:
-              - {parentEndpoint: /ingress, parentTraceSegmentId: not null, refType: 'CrossProcess',
-                 networkAddress: 'e2e-test-with-mock-collector:upstream_ip:port', parentSpanId: 1,
-                 parentServiceInstance: 'e2e-test-with-mock-collector-instanceA', traceId: not null,
-                 parentService: 'e2e-test-with-mock-collector'}
+              - parentEndpoint: /ingress
+                parentTraceSegmentId: not null
+                refType: 'CrossProcess'
+                networkAddress: 'e2e-test-with-mock-collector:upstream_ip:port'
+                parentSpanId: 1
+                parentServiceInstance: 'e2e-test-with-mock-collector-instanceA'
+                traceId: not null
+                parentService: 'e2e-test-with-mock-collector'
             spanLayer: Http
       - segmentId: not null
         spans:
@@ -70,13 +71,17 @@
             peer: 'e2e-test-with-mock-collector:upstream_ip:port'
             spanLayer: Http
             tags:
-              - {key: http.status, value: '200'}
+              - key: http.status
+                value: '200'
           - operationName: /ingress
             startTime: gt 0
             tags:
-              - {key: http.method, value: GET}
-              - {key: http.params, value: 'not null'}
-              - {key: http.status, value: '200'}
+              - key: http.method
+                value: GET
+              - key: http.params
+                value: 'not null'
+              - key: http.status
+                value: '200'
             endTime: gt 0
             spanType: Entry
             spanId: 0
diff --git a/test/e2e/pom.xml b/test/e2e/pom.xml
index 20685bb..b5d19d9 100644
--- a/test/e2e/pom.xml
+++ b/test/e2e/pom.xml
@@ -31,8 +31,7 @@
     <packaging>pom</packaging>
 
     <modules>
-        <module>agent-test-tools</module>
-        <module>e2e-test</module>
+        <module>nginx</module>
     </modules>
 
     <properties>
@@ -53,11 +52,10 @@
         <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>
+        <docker-maven-plugin.version>0.30.0</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>
 
@@ -217,6 +215,13 @@
                     </configuration>
                     <executions>
                         <execution>
+                            <id>build</id>
+                            <phase>initialize</phase>
+                            <goals>
+                                <goal>build</goal>
+                            </goals>
+                        </execution>
+                        <execution>
                             <id>start</id>
                             <phase>pre-integration-test</phase>
                             <goals>