Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,27 @@ public class TestingMySqlServer
private final MySQLContainer<?> container;
private final Closeable cleanup;

public final int majorVersion;
public final int minorVersion;
public final int patchVersion;
Comment on lines +36 to +38
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about adding public static constants for the versions to test - LATEST_IMAGE, DEFAULT_IMAGE?
That should be sufficient?


public TestingMySqlServer()
{
this(false);
}

public TestingMySqlServer(boolean globalTransactionEnable)
{
this("mysql:8.0.12", globalTransactionEnable);
this(8, 0, 12, globalTransactionEnable);
}

public TestingMySqlServer(String dockerImageName, boolean globalTransactionEnable)
public TestingMySqlServer(int majorVersion, int minorVersion, int patchVersion, boolean globalTransactionEnable)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the refactoring purpose is

Allows version-based testing of mysql. For example, testing specific features from mysql8 that are not supported in mysql5.

the original code should be sufficient.

{
this.majorVersion = majorVersion;
this.minorVersion = minorVersion;
this.patchVersion = patchVersion;
String dockerImageName = format("mysql:%s.%s.%s", majorVersion, minorVersion, patchVersion);

MySQLContainer<?> container = new MySQLContainer<>(dockerImageName);
container = container.withDatabaseName("tpch");
if (globalTransactionEnable) {
Expand Down