Skip to content
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

Update TestContainers dependency #429

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
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
10 changes: 4 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@

## [Unreleased]

### API changes

- Add `"mode"` option for select operation ([#107](https://github.com/tarantool/cartridge-java/issues/107))
- Change using of proxy client parameters (`mode`, `rollback_on_error`, `stop_on_error`) with enum classes ([#419](https://github.com/tarantool/cartridge-java/issues/419))

### Bugfixes

- Fix Instant converter to parse 8 bytes datetime ([#408](https://github.com/tarantool/cartridge-java/issues/408))

### Internal changes
### Internal and API changes
nickkkccc marked this conversation as resolved.
Show resolved Hide resolved

- Bump testcontainers-java-tarantool to 1.0.1 ([#400](https://github.com/tarantool/cartridge-java/issues/400))
- Add `"mode"` option for select operation ([#107](https://github.com/tarantool/cartridge-java/issues/107))
- Change using of proxy client parameters (`mode`, `rollback_on_error`, `stop_on_error`) with enum classes ([#419](https://github.com/tarantool/cartridge-java/issues/419))
- Change using of option names with the String type in the internal API to using with the ProxyOption enum class ([#420](https://github.com/tarantool/cartridge-java/issues/420))

## [0.12.1] - 2023-08-04
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
<dependency>
<groupId>io.tarantool</groupId>
<artifactId>testcontainers-java-tarantool</artifactId>
<version>0.5.4</version>
<version>1.0.1</version>
<scope>test</scope>
<exclusions>
<exclusion>
Expand Down

This file was deleted.

16 changes: 8 additions & 8 deletions src/test/java/io/tarantool/driver/integration/ConnectionIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import io.tarantool.driver.exceptions.TarantoolClientException;
import io.tarantool.driver.exceptions.TarantoolConnectionException;
import io.tarantool.driver.exceptions.TarantoolInternalException;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
Expand Down Expand Up @@ -324,14 +323,15 @@ public void testIncorrectPassword_shouldCloseConnection() throws Exception {
container.getUsername(), "incorrect");
TarantoolServerAddress serverAddress = new TarantoolServerAddress(
container.getHost(), container.getPort());
ClusterTarantoolTupleClient client = new ClusterTarantoolTupleClient(credentials, serverAddress);
for (int i = 0; i < 100; i++) {
assertThrows(TarantoolClientException.class, () -> {
client.getVersion();
});
try (ClusterTarantoolTupleClient client = new ClusterTarantoolTupleClient(credentials, serverAddress)) {
for (int i = 0; i < 100; i++) {
assertThrows(TarantoolClientException.class, client::getVersion);
}
}
Map netStat = (Map) container.executeCommand("return box.stat.net()").join().get(0);
Map connections = (Map) netStat.get("CONNECTIONS");

List<?> result = container.executeCommandDecoded("return box.stat.net()");
Map<?, ?> netStat = (Map<?, ?>) result.get(0);
Map<?, ?> connections = (Map<?, ?>) netStat.get("CONNECTIONS");
assertTrue((Integer) connections.get("current") <= 2); // one for container one for static test client
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import io.tarantool.driver.api.tuple.DefaultTarantoolTupleFactory;
import io.tarantool.driver.api.tuple.TarantoolTuple;
import io.tarantool.driver.api.tuple.TarantoolTupleFactory;
import io.tarantool.driver.mappers.DefaultMessagePackMapperFactory;
import io.tarantool.driver.mappers.factories.DefaultMessagePackMapperFactory;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,36 +38,35 @@ public class SslClientITEnterprise {

private static TarantoolContainer containerWithSsl;
private static TarantoolContainer containerWithoutSsl;
private static final String RESOURCE_PATH = "org/testcontainers/containers/enterprise/";

@BeforeAll
public static void setUp() throws URISyntaxException, SSLException {
final File dockerfile = new File(
SslClientITEnterprise.class.getClassLoader()
.getResource("org/testcontainers/containers/enterprise/Dockerfile").toURI()
.getResource(RESOURCE_PATH + "Dockerfile").toURI()
);
final Map<String, String> buildArgs = new HashMap<>();
buildArgs.put("DOWNLOAD_SDK_URI", System.getenv("DOWNLOAD_SDK_URI"));
buildArgs.put("SDK_VERSION", System.getenv("SDK_VERSION"));

final TarantoolClientBuilder tarantoolClientBuilder = TarantoolClientFactory.createClient()
.withSslContext(getSslContext());

containerWithSsl = new TarantoolContainer(
new TarantoolImageParams("tarantool-enterprise", dockerfile, buildArgs), tarantoolClientBuilder)
new TarantoolImageParams("tarantool-enterprise", dockerfile, buildArgs))
.withScriptFileName("ssl_server.lua")
.withUsername("test_user")
.withPassword("test_password")
.withMemtxMemory(256 * 1024 * 1024)
.withDirectoryBinding("org/testcontainers/containers/enterprise/ssl")
.withLogConsumer(new Slf4jLogConsumer(log));
.withDirectoryBinding(RESOURCE_PATH + "ssl")
.withLogConsumer(new Slf4jLogConsumer(log))
.withSslContext(org.testcontainers.containers.SslContext.getSslContext());

containerWithoutSsl = new TarantoolContainer(
new TarantoolImageParams("tarantool-enterprise", dockerfile, buildArgs))
.withScriptFileName("server.lua")
.withUsername("test_user")
.withPassword("test_password")
.withMemtxMemory(256 * 1024 * 1024)
.withDirectoryBinding("org/testcontainers/containers/enterprise")
.withDirectoryBinding(RESOURCE_PATH)
.withLogConsumer(new Slf4jLogConsumer(log));

if (!containerWithSsl.isRunning()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class SslClientMTlsITEnterprise {
private static final Logger log = LoggerFactory.getLogger(SslClientMTlsITEnterprise.class);

private static TarantoolContainer containerWithSsl;
private static final String RESOURCE_PATH = "org/testcontainers/containers/enterprise/ssl/mtls/";

@BeforeAll
public static void setUp() throws Exception {
Expand All @@ -50,18 +51,17 @@ public static void setUp() throws Exception {
buildArgs.put("DOWNLOAD_SDK_URI", System.getenv("DOWNLOAD_SDK_URI"));
buildArgs.put("SDK_VERSION", System.getenv("SDK_VERSION"));

final TarantoolClientBuilder tarantoolClientBuilder = TarantoolClientFactory.createClient()
.withSslContext(getSslContextWithCA())
.withConnectTimeout(5000);

containerWithSsl = new TarantoolContainer(
new TarantoolImageParams("tarantool-enterprise", dockerfile, buildArgs), tarantoolClientBuilder)
new TarantoolImageParams("tarantool-enterprise", dockerfile, buildArgs))
.withScriptFileName("mtls_server.lua")
.withUsername("test_user")
.withPassword("test_password")
.withMemtxMemory(256 * 1024 * 1024)
.withDirectoryBinding("org/testcontainers/containers/enterprise/ssl/mtls")
.withLogConsumer(new Slf4jLogConsumer(log));
.withDirectoryBinding(RESOURCE_PATH)
.withLogConsumer(new Slf4jLogConsumer(log))
.withSslContext(org.testcontainers.containers.SslContext.getSslContext(
RESOURCE_PATH + "ca.key",
RESOURCE_PATH + "ca.crt"));

if (!containerWithSsl.isRunning()) {
containerWithSsl.start();
Expand Down Expand Up @@ -106,15 +106,15 @@ public void test_clientWithoutCA_shouldThrowException_ifServerWithMTLS() throws
private static SslContext getSslContextWithCA() throws Exception {
ClassLoader classloader = Thread.currentThread().getContextClassLoader();
final File keyCertChainFile = new File(classloader
.getResource("org/testcontainers/containers/enterprise/ssl/mtls/ca.crt").toURI());
.getResource(RESOURCE_PATH + "ca.crt").toURI());
final File keyFile = new File(classloader
.getResource("org/testcontainers/containers/enterprise/ssl/mtls/ca.key").toURI());
.getResource(RESOURCE_PATH + "ca.key").toURI());

String keyStoreFilePassword = "12345678";
KeyStore keyStore = KeyStore.getInstance("PKCS12");

InputStream trustStore = classloader
.getResourceAsStream("org/testcontainers/containers/enterprise/ssl/mtls/trustStoreFile");
.getResourceAsStream(RESOURCE_PATH + "trustStoreFile");
keyStore.load(trustStore, keyStoreFilePassword.toCharArray());

TrustManagerFactory trustManagerFactory = TrustManagerFactory
Expand Down
Loading