File tree Expand file tree Collapse file tree 3 files changed +20
-7
lines changed
main/java/org/testcontainers/clickhouse
test/java/org/testcontainers Expand file tree Collapse file tree 3 files changed +20
-7
lines changed Original file line number Diff line number Diff line change 2121 */
2222public class ClickHouseContainer extends JdbcDatabaseContainer <ClickHouseContainer > {
2323
24- private static final String NAME = "clickhouse" ;
25-
2624 static final String CLICKHOUSE_CLICKHOUSE_SERVER = "clickhouse/clickhouse-server" ;
2725
2826 private static final DockerImageName CLICKHOUSE_IMAGE_NAME = DockerImageName .parse (CLICKHOUSE_CLICKHOUSE_SERVER );
@@ -33,13 +31,13 @@ public class ClickHouseContainer extends JdbcDatabaseContainer<ClickHouseContain
3331
3432 private static final String DRIVER_CLASS_NAME = "com.clickhouse.jdbc.ClickHouseDriver" ;
3533
36- private static final String JDBC_URL_PREFIX = "jdbc:" + NAME + " ://" ;
34+ private static final String JDBC_URL_PREFIX = "jdbc:clickhouse ://" ;
3735
3836 private static final String TEST_QUERY = "SELECT 1" ;
3937
40- static final String DEFAULT_USER = "default " ;
38+ static final String DEFAULT_USER = "test " ;
4139
42- static final String DEFAULT_PASSWORD = "" ;
40+ static final String DEFAULT_PASSWORD = "test " ;
4341
4442 private String databaseName = "default" ;
4543
Original file line number Diff line number Diff line change 44
55public interface ClickhouseTestImages {
66 DockerImageName CLICKHOUSE_IMAGE = DockerImageName .parse ("clickhouse/clickhouse-server:21.9.2-alpine" );
7+
8+ DockerImageName CLICKHOUSE_24_12_IMAGE = DockerImageName .parse ("clickhouse/clickhouse-server:24.12-alpine" );
79}
Original file line number Diff line number Diff line change 11package org .testcontainers .clickhouse ;
22
33import org .junit .Test ;
4+ import org .testcontainers .ClickhouseTestImages ;
45import org .testcontainers .db .AbstractContainerDatabaseTest ;
56
67import java .sql .ResultSet ;
@@ -26,8 +27,8 @@ public void testSimple() throws SQLException {
2627 public void customCredentialsWithUrlParams () throws SQLException {
2728 try (
2829 ClickHouseContainer clickhouse = new ClickHouseContainer ("clickhouse/clickhouse-server:21.9.2-alpine" )
29- .withUsername ("test " )
30- .withPassword ("test " )
30+ .withUsername ("default " )
31+ .withPassword ("" )
3132 .withDatabaseName ("test" )
3233 .withUrlParam ("max_result_rows" , "5" )
3334 ) {
@@ -42,4 +43,16 @@ public void customCredentialsWithUrlParams() throws SQLException {
4243 assertThat (resultSetInt ).isEqualTo (5 );
4344 }
4445 }
46+
47+ @ Test
48+ public void testNewAuth () throws SQLException {
49+ try (ClickHouseContainer clickhouse = new ClickHouseContainer (ClickhouseTestImages .CLICKHOUSE_24_12_IMAGE )) {
50+ clickhouse .start ();
51+
52+ ResultSet resultSet = performQuery (clickhouse , "SELECT 1" );
53+
54+ int resultSetInt = resultSet .getInt (1 );
55+ assertThat (resultSetInt ).isEqualTo (1 );
56+ }
57+ }
4558}
You can’t perform that action at this time.
0 commit comments