This is an automated email from the ASF dual-hosted git repository.
hxd pushed a commit to branch testcontainer
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/testcontainer by this push:
new f19b5b4 for docker-compose
f19b5b4 is described below
commit f19b5b46eaaa5367aa616c188ca3ee41df859cc3
Author: xiangdong huang <[email protected]>
AuthorDate: Fri Apr 9 19:55:02 2021 +0800
for docker-compose
---
docker/src/main/{Dockerfile => Dockerfile-cluster} | 4 +--
docker/src/main/{Dockerfile => Dockerfile-single} | 0
testcontainer/pom.xml | 34 +++++++++++++++++++---
.../test/java/org/apache/iotdb/db/sql/SqlE2E.java | 7 +++++
.../test/resources/composes/docker-compose-3.yaml | 30 ++++++-------------
.../src/test/resources/iotdb-engine.properties | 24 +++++++++++++++
6 files changed, 72 insertions(+), 27 deletions(-)
diff --git a/docker/src/main/Dockerfile b/docker/src/main/Dockerfile-cluster
similarity index 92%
copy from docker/src/main/Dockerfile
copy to docker/src/main/Dockerfile-cluster
index c0e00a9..277132b 100644
--- a/docker/src/main/Dockerfile
+++ b/docker/src/main/Dockerfile-cluster
@@ -21,7 +21,7 @@
FROM openjdk:11-jre-slim
-ADD distribution/target/apache-iotdb-*-server-bin.zip /
+ADD distribution/target/apache-iotdb-*-cluster-bin.zip /
RUN apt update \
&& apt install lsof procps unzip -y \
@@ -40,4 +40,4 @@ EXPOSE 8181
VOLUME /iotdb/data
VOLUME /iotdb/logs
ENV PATH="/iotdb/sbin/:/iotdb/tools/:${PATH}"
-ENTRYPOINT ["/iotdb/sbin/start-server.sh"]
+ENTRYPOINT ["/iotdb/sbin/start-node.sh"]
diff --git a/docker/src/main/Dockerfile b/docker/src/main/Dockerfile-single
similarity index 100%
rename from docker/src/main/Dockerfile
rename to docker/src/main/Dockerfile-single
diff --git a/testcontainer/pom.xml b/testcontainer/pom.xml
index 23088dd..f8bb9f6 100644
--- a/testcontainer/pom.xml
+++ b/testcontainer/pom.xml
@@ -11,8 +11,10 @@
<properties>
<docker.test.skip>false</docker.test.skip>
<docker.build.executable>docker</docker.build.executable>
- <docker.build.argument>build -t apache/iotdb:maven-development -f
${basedir}/../docker/src/main/Dockerfile ${basedir}/../.</docker.build.argument>
- <docker.clean.argument>image rm
apache/iotdb:maven-development</docker.clean.argument>
+ <docker.build.single.argument>build -t apache/iotdb:maven-development
-f ${basedir}/../docker/src/main/Dockerfile-single
${basedir}/../.</docker.build.single.argument>
+ <docker.clean.single.argument>image rm
apache/iotdb:maven-development</docker.clean.single.argument>
+ <docker.build.cluster.argument>build -t
apache/iotdb:cluster-maven-development -f
${basedir}/../docker/src/main/Dockerfile-cluster
${basedir}/../.</docker.build.cluster.argument>
+ <docker.clean.cluster.argument>image rm
apache/iotdb:cluster-maven-development</docker.clean.cluster.argument>
</properties>
<dependencies>
<dependency>
@@ -51,7 +53,19 @@
<configuration>
<skip>${docker.test.skip}</skip>
<executable>${docker.build.executable}</executable>
-
<commandlineArgs>${docker.build.argument}</commandlineArgs>
+
<commandlineArgs>${docker.build.single.argument}</commandlineArgs>
+ </configuration>
+ </execution>
+ <execution>
+ <id>build-cluster-docker-image</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <skip>${docker.test.skip}</skip>
+ <executable>${docker.build.executable}</executable>
+
<commandlineArgs>${docker.build.cluster.argument}</commandlineArgs>
</configuration>
</execution>
<execution>
@@ -63,7 +77,19 @@
<configuration>
<skip>${docker.test.skip}</skip>
<executable>${docker.build.executable}</executable>
-
<commandlineArgs>${docker.clean.argument}</commandlineArgs>
+
<commandlineArgs>${docker.clean.single.argument}</commandlineArgs>
+ </configuration>
+ </execution>
+ <execution>
+ <id>clean-cluster-docker-image</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <skip>${docker.test.skip}</skip>
+ <executable>${docker.build.executable}</executable>
+
<commandlineArgs>${docker.clean.cluster.argument}</commandlineArgs>
</configuration>
</execution>
</executions>
diff --git a/testcontainer/src/test/java/org/apache/iotdb/db/sql/SqlE2E.java
b/testcontainer/src/test/java/org/apache/iotdb/db/sql/SqlE2E.java
index 25cefea..4fec53e 100644
--- a/testcontainer/src/test/java/org/apache/iotdb/db/sql/SqlE2E.java
+++ b/testcontainer/src/test/java/org/apache/iotdb/db/sql/SqlE2E.java
@@ -24,11 +24,13 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
+import org.testcontainers.containers.BindMode;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.images.PullPolicy;
import org.testcontainers.utility.DockerImageName;
+import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
@@ -42,6 +44,11 @@ public class SqlE2E {
public GenericContainer dslContainer =
new
GenericContainer(DockerImageName.parse("apache/iotdb:maven-development"))
.withImagePullPolicy(PullPolicy.defaultPolicy())
+ // mount another properties for changing parameters, e.g., open 5555
port (sync module)
+ .withFileSystemBind(
+ new
File("src/test/resources/iotdb-engine.properties").getAbsolutePath(),
+ "/iotdb/conf/iotdb-engine.properties",
+ BindMode.READ_ONLY)
.withExposedPorts(6667)
.waitingFor(Wait.forListeningPort());
diff --git a/docker/src/main/docker-compose.yaml
b/testcontainer/src/test/resources/composes/docker-compose-3.yaml
similarity index 67%
rename from docker/src/main/docker-compose.yaml
rename to testcontainer/src/test/resources/composes/docker-compose-3.yaml
index 815cb3c..e345335 100644
--- a/docker/src/main/docker-compose.yaml
+++ b/testcontainer/src/test/resources/composes/docker-compose-3.yaml
@@ -17,35 +17,23 @@
# under the License.
#
-version: '2.4'
+version: '3.8'
services:
- server-prototype:
- build:
- context: ../../..
- dockerfile: docker/src/main/Dockerfile
- ports:
- - 6667:6667
+ iotdb-server:
+ image: apache/iotdb:cluster-maven-development
+ expose:
+ - 6667
+ - 9003
+ - 40010
networks:
- iotdb:
+ - iotdb
healthcheck:
test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/6667"
]
interval: 5s
timeout: 60s
retries: 120
- initializer:
- build:
- context: ../../..
- dockerfile: docker/src/main/Dockerfile
- networks:
- iotdb:
- entrypoint:
- - bash
- - -c
- - |
- cat /res/init.sql | grep -v '^--' | xargs -I {}
/iotdb/sbin/start-cli.sh -h server -e {}
- echo "Ready to Run IoTDB E2E Tests"
-
networks:
iotdb:
+ driver: bridge
diff --git a/testcontainer/src/test/resources/iotdb-engine.properties
b/testcontainer/src/test/resources/iotdb-engine.properties
new file mode 100644
index 0000000..960aa13
--- /dev/null
+++ b/testcontainer/src/test/resources/iotdb-engine.properties
@@ -0,0 +1,24 @@
+#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.
+
+
+base_dir=target/tmp
+data_dirs=target/data
+wal_dir=target/wal
+index_root_dir=target/index
+udf_root_dir=target/ext
+tracing_dir=target/data/tracing
\ No newline at end of file