-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removed cartridge-java from dependencies #71
Conversation
I also need to think about a container builder for SSL | mTLS tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just two small comments
CHANGELOG.md
Outdated
@@ -1,5 +1,15 @@ | |||
# Changelog | |||
|
|||
## [0.6.0] - 2023-05-17 | |||
BREAKING CHANGES |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pom.xml
Outdated
@@ -49,7 +49,7 @@ | |||
<connection>scm:git:[email protected]:tarantool/cartridge-java-testcontainers.git</connection> | |||
<developerConnection>scm:git:[email protected]:tarantool/cartridge-java-testcontainers.git</developerConnection> | |||
<url>http://github.com/tarantool/cartridge-java-testcontainers/tree/master</url> | |||
<tag>v0.5.4</tag> | |||
<tag>v0.6.0</tag> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't change it. Maven will change in release phase
71ec0bc
to
cbdf777
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall, I have few nitpicks though
@@ -1,12 +1,15 @@ | |||
package org.testcontainers.containers; | |||
|
|||
import java.util.Arrays; | |||
import org.jetbrains.annotations.NotNull; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not use unnecessary imports for such third-party types
Container.ExecResult result = executeScript(scriptResourcePath, sslIsActive, keyFile, certFile); | ||
|
||
if (result.getExitCode() != 0) { | ||
throw new IllegalStateException(String.format("Executed script %s with exit code %d," + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest making these command string templates constant variables
|
||
List<?> result = container.executeCommand("return profile_get(...)", 1).get(); | ||
ArrayList result = container.executeCommandDecoded("return profile_get(1)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The linter and compiler most likely show warnings for this place. ArrayList<?>
or ArrayList<Object>
are more approriate. ArrayList
is an old form from Java 4 that is long prohibited but exists for compatibility
Now |
f7ebd35
to
a4b81d9
Compare
import java.util.List; | ||
import java.util.Map; | ||
import java.util.concurrent.CompletableFuture; | ||
import java.util.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not use star imports (set up your IDE to not change this for, say, 100 import lines)
TarantoolClientBuilder clientBuilder) { | ||
super(TarantoolContainerImageHelper.getImage(tarantoolImageParams)); | ||
clientHelper = new TarantoolContainerClientHelper(this, clientBuilder); | ||
clientHelper = new TarantoolContainerClientHelper(this, "/sdk/tarantoolctl"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a constant at least, but better that should be either an env variable or the executable should be in the classpath so no explicit path is specified. DO not leave such hardcode, that will not work for all environments
@@ -39,6 +37,9 @@ public class TarantoolContainer extends GenericContainer<TarantoolContainer> | |||
private String password = API_PASSWORD; | |||
private String host = DEFAULT_HOST; | |||
private Integer port = DEFAULT_PORT; | |||
private Boolean sslIsActive = false; | |||
private String keyFile = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be a default path or name, shouldn't it?
.withRetryingByNumberOfAttempts(15, | ||
TarantoolRequestRetryPolicies.retryNetworkErrors(), | ||
b -> b.withDelay(100)); | ||
this.tarantoolctlPath = "tarantoolctl"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest using an environment variable with default value here
|
||
String bashCommand; | ||
if (keyFile != "" && certFile != "") { | ||
bashCommand = String.format("echo \"print(require('yaml').encode(require('net.box').connect({ uri='%s:%d', " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a constant., not an inline string. Also, we may use more proper script formatting for easier reading with backslashes or plus signs.
The same for the subsequent lines
|
||
List<?> result = container.executeCommand("return profile_get(...)", 1).get(); | ||
ArrayList<?> result = container.executeCommandDecoded("return profile_get(1)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get why we need a more specific type here. Do we use any ArrayList
methods or properties? Is ArrayList
always guaranteed as a result (as I see it is a generic parameter so it seems not)?
6e052f8
to
67b4481
Compare
SSL and mTLS support will be added in #75 |
63b2277
to
13f838b
Compare
@akudiyar, hi! We are planning to merge this PR this week. Will you have time to watch it again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that we are putting too many details to the changelog. These details can be read from the git history. Leaving internal changes that do not affect customers does not make sense, and it's better for readability to shorten several small changes related to the same feature to one line that describes the meaning of the changes.
pom.xml
Outdated
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<version>1.18.28</version> | ||
<scope>provided</scope> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please limit this import to the test
scope
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use it in SslContext class, not in the test
scope.
Why you do not recommend using lombok in other scopes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using it for a single class with 2 fields and in a library code needs additional justification. We've just removed the driver dependency (which is a good move), why are we adding to the library level a new dependency that is normally used on application level?
src/main/java/org/testcontainers/containers/TarantoolCartridgeContainer.java
Outdated
Show resolved
Hide resolved
@@ -189,6 +191,22 @@ public TarantoolCartridgeContainer(String dockerFile, String buildImageName, Str | |||
this(buildImage(dockerFile, buildImageName, buildArgs), instancesFile, topologyConfigurationFile, buildArgs); | |||
} | |||
|
|||
// todo add SSL and mTLS cartridge test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not leave any commented code in the repo. We have git and branches for not-ready changes.
@@ -251,6 +269,20 @@ private static ImageFromDockerfile buildImage(String dockerFile, String buildIma | |||
"cartridge" : buildArgs.get("CARTRIDGE_SRC_DIR")); | |||
} | |||
|
|||
// todo add SSL and mTLS cartridge test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not leave any commented code in the repo. We have git and branches for not-ready changes.
src/main/java/org/testcontainers/containers/TarantoolContainer.java
Outdated
Show resolved
Hide resolved
A side note: commits named like "Fix someone's comments" or "Update filename" are not useful for the git history. They need either to be squashed or re-formulated in a way that the message describes what exact changes are made to the code (examples: "rename variable", "pull code literals to constants", "remove/add dependency XXX" etc.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix changelog, please.
All commits will be squashed into one before the changes are merged into master. I try not to merge them during reviews to make it easier to keep track of requested changes. If everything looks good for you, just approve changes, and I'll use "Squash and merge" button. |
@@ -0,0 +1,62 @@ | |||
package org.testcontainers.containers.Enterprise; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package org.testcontainers.containers.Enterprise; | |
package org.testcontainers.containers.enterprise; |
src/main/java/org/testcontainers/containers/TarantoolContainerOperations.java
Outdated
Show resolved
Hide resolved
src/main/java/org/testcontainers/containers/TarantoolCartridgeContainer.java
Outdated
Show resolved
Hide resolved
// No SSL | ||
if (sslContext == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this type of comment code style is more appropriate in this case
// No SSL | |
if (sslContext == null) { | |
if (sslContext == null) { // No SSL |
// mTLS | ||
} else if (sslContext.getKeyFile() != null && sslContext.getCertFile() != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// mTLS | |
} else if (sslContext.getKeyFile() != null && sslContext.getCertFile() != null) { | |
} else if (sslContext.getKeyFile() != null && sslContext.getCertFile() != null) { // mTLS |
// SSL | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// SSL | |
} else { | |
} else { // SSL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Есть небольшие замечания.
В остальном, можно мержить.
@@ -213,6 +167,20 @@ public TarantoolContainer withPassword(String password) { | |||
return this; | |||
} | |||
|
|||
|
|||
/** | |||
* Specify SSL as connection transport. And path to key and cert files inside your container for mTLS connection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Specify SSL as connection transport. And path to key and cert files inside your container for mTLS connection | |
* Specify SSL as connection transport. Add path to key and cert files inside your container for mTLS connection |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant, specify transport and path.
); | ||
final Map<String, String> buildArgs = new HashMap<>(); | ||
buildArgs.put("DOWNLOAD_SDK_URI", System.getenv("DOWNLOAD_SDK_URI")); | ||
buildArgs.put("SDK_VERSION", "tarantool-enterprise-sdk-nogc64-2.10.6-0-r557.linux.x86_64"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я бы вынес версию SDK в константу или settings.
0947346
to
7e6d389
Compare
- [breaking change] Remove io.tarantool.cartridge-driver dependency - [breaking change] Update executeScript and executeCommand methods to execute code viva execInContainer (now it returns yaml string in Container.ExecResult not CompletableFuture) - Add executeScriptDecoded and executeCommandDecoded methods to return parsed yaml not string. - Add SslContext class - Add withSslContext method to TarantoolContainer and TarantoolCartridgeContainer. - Update org.yaml.snakeyaml to 2.0 version. Closes #69
executeScript
andexecuteCommand
methods to execute code vivaexecInContainer
.executeScriptDecoded
andexecuteCommandDecoded
methods to return parsedyaml
notString
.TarantoolContainerClientHelper
and tests.io.tarantool.cartridge-driver
dependency.org.yaml.snakeyaml
to 2.0 version.I haven't forgotten about:
Related issues:
Closes #69