Skip to content

Commit bed88c2

Browse files
committed
Update bigdata-test dependency to 0.1.6 and introduce dns.hosts for local container network alias mapping
1 parent 456fb4b commit bed88c2

7 files changed

Lines changed: 25 additions & 10 deletions

File tree

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,13 @@ GRADLE_USER_HOME=/data/.gradle ./gradlew :example:spark:dependencies \
5050
bundled Hadoop native libraries and prepends `-Djava.library.path` / `-Dhadoop.home.dir` to the
5151
Surefire `argLine`, so the native Hadoop code is used instead of the pure-Java fallback.
5252
- **[java-dns](../java-dns) `0.1.1`** — the agent jar (`org.openprojectx.java.dns:core`) is attached
53-
to the Surefire JVM via `-javaagent:…=hosts=fake-gcs/127.0.0.1`. This redirects the `fake-gcs`
54-
host to the local container, so the GCS connector can use the stable URL
55-
`http://fake-gcs:4443/` and the test **no longer needs to read the dynamic GCS endpoint**. The
56-
fake-gcs container is bound to the fixed host port `4443` via `[ports] fakeGcs = 4443` in
57-
`spark-bigdata-test-common.toml` so the redirected host:port lines up.
53+
to the Surefire JVM via `-javaagent:…=hostsFile=${project.basedir}/dns.hosts`. The
54+
[`dns.hosts`](spark-apache/dns.hosts) file maps the bigdata-test container network aliases
55+
(`fake-gcs`, `hdfs`) to `127.0.0.1`, so the clients reach the local mapped containers without
56+
wiring per-run endpoints into the Spark session. In particular the GCS connector can use the
57+
stable URL `http://fake-gcs:4443/` and the test **no longer needs to read the dynamic GCS
58+
endpoint**. The fake-gcs container is bound to the fixed host port `4443` via
59+
`[ports] fakeGcs = 4443` in `spark-bigdata-test-common.toml` so the redirected host:port lines up.
5860

5961
## Prerequisites
6062

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<maven.compiler.release>17</maven.compiler.release>
2525

2626
<!-- bigdata-test framework, published locally as 0.1.1-SNAPSHOT -->
27-
<bigdata-test.version>0.1.4</bigdata-test.version>
27+
<bigdata-test.version>0.1.6</bigdata-test.version>
2828

2929
<!-- shared, version-line independent dependencies -->
3030
<junit.version>5.11.4</junit.version>

spark-apache/dns.hosts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# java-dns host overrides (hosts-file format: <ip> <hostname>).
2+
# Resolves the bigdata-test container network aliases to the local mapped containers,
3+
# so the test reaches them without wiring per-run endpoints into the Spark session.
4+
127.0.0.1 fake-gcs
5+
127.0.0.1 hdfs

spark-apache/pom.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@
156156
<scope>test</scope>
157157
</dependency>
158158

159-
<!-- java-dns agent jar (attached to the Surefire JVM to redirect the fake-gcs host) -->
159+
<!-- java-dns agent jar (attached to the Surefire JVM; redirects the hosts in dns.hosts
160+
(fake-gcs, hdfs) to the local mapped containers) -->
160161
<dependency>
161162
<groupId>org.openprojectx.java.dns</groupId>
162163
<artifactId>core</artifactId>
@@ -199,7 +200,7 @@
199200
<groupId>org.apache.maven.plugins</groupId>
200201
<artifactId>maven-surefire-plugin</artifactId>
201202
<configuration>
202-
<argLine>@{argLine} -javaagent:${org.openprojectx.java.dns:core:jar}=hosts=fake-gcs/127.0.0.1;fallback=true ${bigdata.test.argLine}</argLine>
203+
<argLine>@{argLine} -javaagent:${org.openprojectx.java.dns:core:jar}=hostsFile=${project.basedir}/dns.hosts;fallback=true ${bigdata.test.argLine}</argLine>
203204
<dependenciesToScan>
204205
<dependency>org.openprojectx.bigdata.test.example:spark-test-common</dependency>
205206
</dependenciesToScan>

spark-cloudera/dns.hosts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# java-dns host overrides (hosts-file format: <ip> <hostname>).
2+
# Resolves the bigdata-test container network aliases to the local mapped containers,
3+
# so the test reaches them without wiring per-run endpoints into the Spark session.
4+
127.0.0.1 fake-gcs
5+
127.0.0.1 hdfs

spark-cloudera/pom.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@
161161
<scope>test</scope>
162162
</dependency>
163163

164-
<!-- java-dns agent jar (attached to the Surefire JVM to redirect the fake-gcs host) -->
164+
<!-- java-dns agent jar (attached to the Surefire JVM; redirects the hosts in dns.hosts
165+
(fake-gcs, hdfs) to the local mapped containers) -->
165166
<dependency>
166167
<groupId>org.openprojectx.java.dns</groupId>
167168
<artifactId>core</artifactId>
@@ -204,7 +205,7 @@
204205
<groupId>org.apache.maven.plugins</groupId>
205206
<artifactId>maven-surefire-plugin</artifactId>
206207
<configuration>
207-
<argLine>@{argLine} -javaagent:${org.openprojectx.java.dns:core:jar}=hosts=fake-gcs/127.0.0.1;fallback=true ${bigdata.test.argLine}</argLine>
208+
<argLine>@{argLine} -javaagent:${org.openprojectx.java.dns:core:jar}=hostsFile=${project.basedir}/dns.hosts;fallback=true ${bigdata.test.argLine}</argLine>
208209
<dependenciesToScan>
209210
<dependency>org.openprojectx.bigdata.test.example:spark-test-common</dependency>
210211
</dependenciesToScan>

spark-test-common/src/main/resources/spark-bigdata-test-common.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ fakeGcs = true
2121
# URL http://fake-gcs:4443/ (host "fake-gcs" -> 127.0.0.1) to the running container.
2222
[ports]
2323
fakeGcs = 4443
24+
hdfsDataNode = 9866
2425

2526
[containerLogs]
2627
mode = "FILE"

0 commit comments

Comments
 (0)