Skip to content

Commit

Permalink
use non-empty password
Browse files Browse the repository at this point in the history
  • Loading branch information
whhe committed Jul 3, 2024
1 parent 3c15974 commit 8331fdd
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public class OceanBaseDatabase extends DatabaseExtension implements OceanBaseIma
.withStartupTimeout(Duration.ofMinutes(2))
.withLogConsumer(new Slf4jLogConsumer(LOG));

private static final String PASSWORD = "1234567";

private static OceanBaseMetadata metadata;

public static OceanBaseMetadata getMetadata() {
Expand All @@ -64,7 +66,7 @@ public static OceanBaseMetadata getMetadata() {
metadata =
new OceanBaseMetadata(
CONTAINER.getUsername(),
CONTAINER.getPassword(),
PASSWORD,
CONTAINER.getJdbcUrl(),
CONTAINER.getDriverClassName(),
CONTAINER.getDockerImageName());
Expand All @@ -75,9 +77,10 @@ public static OceanBaseMetadata getMetadata() {
@Override
protected DatabaseMetadata startDatabase() throws Exception {
CONTAINER.start();
try (Connection connection = getMetadata().getConnection();
try (Connection connection = CONTAINER.createConnection("");
Statement statement = connection.createStatement()) {
statement.execute(String.format("SET GLOBAL time_zone = '%s'", ZONE_OFFSET));
statement.execute(String.format("ALTER USER root IDENTIFIED BY '%s'", PASSWORD));
}
return getMetadata();
}
Expand Down

0 comments on commit 8331fdd

Please sign in to comment.