Skip to content

Commit

Permalink
Add questdb as a database provider (#7244)
Browse files Browse the repository at this point in the history
Previously, postgresql has been used as a database provider for
QuestDB along with Testcontainers JDBC URL. `postgresql` has been
deprecated and instead `questdb` has been added.
  • Loading branch information
eddumelendez authored Jun 28, 2023
1 parent b69262e commit c5732a8
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/modules/databases/jdbc.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Insert `tc:` after `jdbc:` as follows. Note that the hostname, port and database

#### Using QuestDB

`jdbc:tc:postgresql:6.5.3:///databasename`
`jdbc:tc:questdb:6.5.3:///databasename`

#### Using TimescaleDB

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.testcontainers.containers;

@Deprecated
public class LegacyQuestDBProvider extends JdbcDatabaseContainerProvider {

@Override
public boolean supports(String databaseType) {
return databaseType.equals(QuestDBContainer.LEGACY_DATABASE_PROVIDER);
}

@Override
public JdbcDatabaseContainer newInstance(String tag) {
return new QuestDBContainer(QuestDBContainer.DEFAULT_IMAGE_NAME.withTag(tag));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
*/
public class QuestDBContainer extends JdbcDatabaseContainer<QuestDBContainer> {

static final String DATABASE_PROVIDER = "postgresql";
@Deprecated
static final String LEGACY_DATABASE_PROVIDER = "postgresql";

static final String DATABASE_PROVIDER = "questdb";

private static final String DEFAULT_DATABASE_NAME = "qdb";

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
org.testcontainers.containers.LegacyQuestDBProvider
org.testcontainers.containers.QuestDBProvider
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ public class QuestDBJDBCDriverTest extends AbstractJDBCDriverTest {
@Parameterized.Parameters(name = "{index} - {0}")
public static Iterable<Object[]> data() {
return Arrays.asList(
new Object[][] { { "jdbc:tc:postgresql://hostname/databasename", EnumSet.of(Options.PmdKnownBroken) } }
new Object[][] {
{ "jdbc:tc:postgresql://hostname/databasename", EnumSet.of(Options.PmdKnownBroken) },
{ "jdbc:tc:questdb://hostname/databasename", EnumSet.of(Options.PmdKnownBroken) },
}
);
}
}

0 comments on commit c5732a8

Please sign in to comment.