Skip to content

Commit 67b4481

Browse files
committed
Remove ssl support from TarantoolCartridgeContainer
1 parent 8e64fc8 commit 67b4481

15 files changed

+55
-227
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Add the Maven dependency:
1414
<dependency>
1515
<groupId>io.tarantool</groupId>
1616
<artifactId>testcontainers-java-tarantool</artifactId>
17-
<version>0.6.0</version>
17+
<version>0.5.4</version>
1818
</dependency>
1919
```
2020

src/main/java/org/testcontainers/containers/SslContext.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,4 @@ public class SslContext {
1717
private String keyFile;
1818
@NonNull
1919
private String certFile;
20-
21-
// public SslContext(@NonNull String keyFile, @NonNull String certFile) {
22-
// if (keyFile.isEmpty()) {
23-
// throw new RuntimeException("Parameter keyFile can not be empty String");
24-
// }
25-
// if (certFile.isEmpty()) {
26-
// throw new RuntimeException("Parameter certFile can not be empty String");
27-
// }
28-
//
29-
// this.keyFile = keyFile;
30-
// this.certFile = certFile;
31-
// }
3220
}

src/main/java/org/testcontainers/containers/TarantoolCartridgeContainer.java

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -191,20 +191,21 @@ public TarantoolCartridgeContainer(String dockerFile, String buildImageName, Str
191191
this(buildImage(dockerFile, buildImageName), instancesFile, topologyConfigurationFile, buildArgs);
192192
}
193193

194-
/**
195-
* Create a container with specified image and specified instances file from the classpath resources. By providing
196-
* the result Cartridge container image name, you can cache the image and avoid rebuilding on each test run (the
197-
* image is tagged with the provided name and not deleted after tests finishing).
198-
*
199-
* @param tarantoolImageParams params for cached image creating
200-
* @param instancesFile URL resource path to instances.yml relative in the classpath
201-
* @param topologyConfigurationFile URL resource path to a topology bootstrap script in the classpath
202-
*/
203-
public TarantoolCartridgeContainer(TarantoolImageParams tarantoolImageParams, String instancesFile,
204-
String topologyConfigurationFile) {
205-
this(new ImageFromDockerfile(TarantoolContainerImageHelper.getImage(tarantoolImageParams)), instancesFile,
206-
topologyConfigurationFile, tarantoolImageParams.getBuildArgs());
207-
}
194+
// todo add SSL and mTLS cartridge test
195+
// /**
196+
// * Create a container with specified image and specified instances file from the classpath resources. By providing
197+
// * the result Cartridge container image name, you can cache the image and avoid rebuilding on each test run (the
198+
// * image is tagged with the provided name and not deleted after tests finishing).
199+
// *
200+
// * @param tarantoolImageParams params for cached image creating
201+
// * @param instancesFile URL resource path to instances.yml relative in the classpath
202+
// * @param topologyConfigurationFile URL resource path to a topology bootstrap script in the classpath
203+
// */
204+
// public TarantoolCartridgeContainer(TarantoolImageParams tarantoolImageParams, String instancesFile,
205+
// String topologyConfigurationFile) {
206+
// this(new ImageFromDockerfile(TarantoolContainerImageHelper.getImage(tarantoolImageParams)), instancesFile,
207+
// topologyConfigurationFile, tarantoolImageParams.getBuildArgs());
208+
// }
208209

209210
private TarantoolCartridgeContainer(ImageFromDockerfile image, String instancesFile, String topologyConfigurationFile,
210211
Map<String, String> buildArgs) {
@@ -263,18 +264,19 @@ private static ImageFromDockerfile buildImage(String dockerFile, String buildIma
263264
return new ImageFromDockerfile().withFileFromClasspath("Dockerfile", dockerFile);
264265
}
265266

266-
/**
267-
* Specify SSL as connection transport. And path to key and cert files inside your container for mTLS connection
268-
* Warning! SSL must be set as default transport on your tarantool cluster.
269-
* Supported only in Tarantool Enterprise
270-
*
271-
* @return this container instance
272-
*/
273-
public TarantoolCartridgeContainer withSslContext(SslContext sslContext) {
274-
checkNotRunning();
275-
this.sslContext = sslContext;
276-
return this;
277-
}
267+
// todo add SSL and mTLS cartridge test
268+
// /**
269+
// * Specify SSL as connection transport. And path to key and cert files inside your container for mTLS connection
270+
// * Warning! SSL must be set as default transport on your tarantool cluster.
271+
// * Supported only in Tarantool Enterprise
272+
// *
273+
// * @return this container instance
274+
// */
275+
// public TarantoolCartridgeContainer withSslContext(SslContext sslContext) {
276+
// checkNotRunning();
277+
// this.sslContext = sslContext;
278+
// return this;
279+
// }
278280

279281
/**
280282
* Get the router host

src/main/java/org/testcontainers/containers/TarantoolContainerClientHelper.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ public final class TarantoolContainerClientHelper {
2424
private final TarantoolContainerOperations<? extends Container<?>> container;
2525
private final String EXECUTE_SCRIPT_ERROR_TEMPLATE =
2626
"Executed script %s with exit code %d, stderr: \"%s\", stdout: \"%s\"";
27-
private final String EXECUTE_COMMAND_ERROR_TEMPLATE =
27+
private static final String EXECUTE_COMMAND_ERROR_TEMPLATE =
2828
"Executed command \"%s\" with exit code %d, stderr: \"%s\", stdout: \"%s\"";
29-
private final String MTLS_COMMAND_TEMPLATE =
29+
private static final String MTLS_COMMAND_TEMPLATE =
3030
"echo \" " +
3131
" print(require('yaml').encode( " +
3232
" require('net.box').connect( " +
@@ -36,7 +36,7 @@ public final class TarantoolContainerClientHelper {
3636
" ); " +
3737
" os.exit(); " +
3838
"\" | tarantool";
39-
private final String SSL_COMMAND_TEMPLATE =
39+
private static final String SSL_COMMAND_TEMPLATE =
4040
"echo \" " +
4141
" print(require('yaml').encode( " +
4242
" require('net.box').connect( " +
@@ -46,7 +46,7 @@ public final class TarantoolContainerClientHelper {
4646
" ); " +
4747
" os.exit(); " +
4848
"\" | tarantool";
49-
private final String COMMAND_TEMPLATE = "echo \" " +
49+
private static final String COMMAND_TEMPLATE = "echo \" " +
5050
" print(require('yaml').encode( " +
5151
" require('net.box').connect( " +
5252
" { uri='%s:%d' }, " +

src/test/java/org/testcontainers/containers/Enterprise/TarantoolCartridgeMtlsContainerTestEnterprise.java

Lines changed: 0 additions & 72 deletions
This file was deleted.

src/test/java/org/testcontainers/containers/Enterprise/TarantoolMTlsContainerTestEnterprise.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ public static void setUp() throws Exception {
3232
);
3333
final Map<String, String> buildArgs = new HashMap<>();
3434
buildArgs.put("DOWNLOAD_SDK_URI", System.getenv("DOWNLOAD_SDK_URI"));
35-
buildArgs.put("SDK_VERSION", System.getenv("SDK_VERSION"));
35+
buildArgs.put("SDK_VERSION", "tarantool-enterprise-sdk-nogc64-2.10.6-0-r557.linux.x86_64");
3636

3737
containerWithSsl = new TarantoolContainer(
3838
new TarantoolImageParams("tarantool-enterprise", dockerfile, buildArgs))
3939
.withScriptFileName("mtls_server.lua")
40-
.withUsername("test_user")
41-
.withPassword("test_password")
40+
.withUsername("api_user")
41+
.withPassword("secret")
4242
.withMemtxMemory(256 * 1024 * 1024)
4343
.withDirectoryBinding("enterprise/ssl/mtls")
4444
.withSslContext(SslContext.getSslContext("/app/ca.key", "/app/ca.crt"))

src/test/java/org/testcontainers/containers/Enterprise/TarantoolSdkContainerTestEnterprise.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ public class TarantoolSdkContainerTestEnterprise {
1919
@Test
2020
void test_should_createTarantoolContainerFromSdk() throws Exception {
2121
final File dockerfile = new File(
22-
TarantoolSdkContainerTestEnterprise.class.getClassLoader().getResource("testsdk/Dockerfile").toURI()
22+
TarantoolSdkContainerTestEnterprise.class.getClassLoader().getResource("enterprise/Dockerfile").toURI()
2323
);
2424
final Map<String, String> buildArgs = new HashMap<>();
2525
buildArgs.put("DOWNLOAD_SDK_URI", System.getenv("DOWNLOAD_SDK_URI"));
2626
buildArgs.put("SDK_VERSION", "tarantool-enterprise-sdk-nogc64-2.10.6-0-r557.linux.x86_64");
2727

2828
try (final TarantoolContainer tarantoolContainer = new TarantoolContainer(
2929
new TarantoolImageParams("tarantool-enterprise-bundle:latest", dockerfile, buildArgs))
30-
.withDirectoryBinding("testsdk")) {
30+
.withDirectoryBinding("enterprise")) {
3131

3232
tarantoolContainer.start();
3333

src/test/java/org/testcontainers/containers/Enterprise/TarantoolSslContainerTestEnterprise.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ public static void setUp() throws Exception {
3232
);
3333
final Map<String, String> buildArgs = new HashMap<>();
3434
buildArgs.put("DOWNLOAD_SDK_URI", System.getenv("DOWNLOAD_SDK_URI"));
35-
buildArgs.put("SDK_VERSION", System.getenv("SDK_VERSION"));
35+
buildArgs.put("SDK_VERSION", "tarantool-enterprise-sdk-nogc64-2.10.6-0-r557.linux.x86_64");
3636

3737
containerWithSsl = new TarantoolContainer(
3838
new TarantoolImageParams("tarantool-enterprise", dockerfile, buildArgs))
3939
.withScriptFileName("ssl_server.lua")
40-
.withUsername("test_user")
41-
.withPassword("test_password")
40+
.withUsername("api_user")
41+
.withPassword("secret")
4242
.withMemtxMemory(256 * 1024 * 1024)
4343
.withDirectoryBinding("enterprise/ssl")
4444
.withSslContext(SslContext.getSslContext())

src/test/resources/enterprise/server.lua

100755100644
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
box.cfg { listen = 3301 }
2-
3-
box.schema.user.create('test_user', { password = 'test_password', if_not_exists = true })
4-
box.schema.user.grant('test_user', 'read, write, execute', 'universe', nil, { if_not_exists = true })
1+
box.cfg {
2+
listen = 3301,
3+
memtx_memory = 128 * 1024 * 1024, -- 128 Mb
4+
-- log = 'file:/tmp/tarantool.log',
5+
log_level = 6,
6+
}
7+
-- API user will be able to login with this password
8+
box.schema.user.create('api_user', { password = 'secret', if_not_exists = true })
9+
-- API user will be able to create spaces, add or remove data, execute functions
10+
box.schema.user.grant('api_user', 'read,write,execute', 'universe', nil, { if_not_exists = true })

src/test/resources/enterprise/ssl/Dockerfile

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/test/resources/enterprise/ssl/mtls/Dockerfile

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/test/resources/enterprise/ssl/mtls/mtls_server.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ box.cfg { listen = {
88
}
99
} }
1010

11-
box.schema.user.create('test_user', { password = 'test_password', if_not_exists = true })
12-
box.schema.user.grant('test_user', 'read, write, execute', 'universe', nil, { if_not_exists = true })
11+
box.schema.user.create('api_user', { password = 'secret', if_not_exists = true })
12+
box.schema.user.grant('api_user', 'read, write, execute', 'universe', nil, { if_not_exists = true })

src/test/resources/enterprise/ssl/ssl_server.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ box.cfg { listen = {
77
}
88
} }
99

10-
box.schema.user.create('test_user', { password = 'test_password', if_not_exists = true })
11-
box.schema.user.grant('test_user', 'read, write, execute', 'universe', nil, { if_not_exists = true })
10+
box.schema.user.create('api_user', { password = 'secret', if_not_exists = true })
11+
box.schema.user.grant('api_user', 'read, write, execute', 'universe', nil, { if_not_exists = true })

src/test/resources/testsdk/Dockerfile

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/test/resources/testsdk/server.lua

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)