Skip to content

Commit

Permalink
Replace localhost with empty to also work with IPv6 mapped ports in D…
Browse files Browse the repository at this point in the history
…ocker
  • Loading branch information
Miel Donkers committed Oct 5, 2022
1 parent f5bf42e commit cd0ac6d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
6 changes: 2 additions & 4 deletions tests/resources/custom.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" ?>
<clickhouse>
<listen_host>::</listen_host>
<listen_host>0.0.0.0</listen_host>
<listen_try>1</listen_try>
<https_port>8443</https_port>
<tcp_port_secure>9440</tcp_port_secure>
<logger>
<console>1</console>
</logger>
Expand Down Expand Up @@ -30,7 +31,4 @@
</client>
</openSSL>
<display_name>clickhouse</display_name>
<listen_host>0.0.0.0</listen_host>
<https_port>8443</https_port>
<tcp_port_secure>9440</tcp_port_secure>
</clickhouse>
11 changes: 7 additions & 4 deletions tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,12 @@ func CreateClickHouseTestEnvironment(testSet string) (ClickHouseTestEnvironment,
Image: fmt.Sprintf("clickhouse/clickhouse-server:%s", GetClickHouseTestVersion()),
Name: fmt.Sprintf("clickhouse-go-%s-%d", strings.ToLower(testSet), time.Now().UnixNano()),
ExposedPorts: []string{"9000/tcp", "8123/tcp", "9440/tcp", "8443/tcp"},
WaitingFor: wait.ForAll(wait.ForLog("Ready for connections").WithStartupTimeout(time.Second*time.Duration(120)), wait.ForSQL("9000/tcp", "clickhouse", func(port nat.Port) string {
return fmt.Sprintf("clickhouse://default:ClickHouse@localhost:%s", port.Port())
})).WithStartupTimeout(time.Second * time.Duration(120)),
WaitingFor: wait.ForAll(
wait.ForLog("Ready for connections").WithStartupTimeout(time.Second*time.Duration(120)),
wait.ForSQL("9000/tcp", "clickhouse", func(port nat.Port) string {
return fmt.Sprintf("clickhouse://default:[email protected]:%s", port.Port())
}),
).WithStartupTimeout(time.Second * time.Duration(120)),
Mounts: []testcontainers.ContainerMount{
testcontainers.BindMount(path.Join(basePath, "./resources/custom.xml"), "/etc/clickhouse-server/config.d/custom.xml"),
testcontainers.BindMount(path.Join(basePath, "./resources/admin.xml"), "/etc/clickhouse-server/users.d/admin.xml"),
Expand Down Expand Up @@ -185,7 +188,7 @@ func CreateClickHouseTestEnvironment(testSet string) (ClickHouseTestEnvironment,
HttpPort: hp.Int(),
SslPort: sslPort.Int(),
HttpsPort: hps.Int(),
Host: "localhost",
Host: "127.0.0.1",
// we set this explicitly - note its also set in the /etc/clickhouse-server/users.d/admin.xml
Username: "default",
Password: "ClickHouse",
Expand Down

0 comments on commit cd0ac6d

Please sign in to comment.