Skip to content

Commit

Permalink
Merge pull request #233 from alex268/develop
Browse files Browse the repository at this point in the history
Update visiblity of constructor of YdbDockerContainer
  • Loading branch information
alex268 authored Feb 13, 2024
2 parents fb888c9 + 0ad0477 commit 5163999
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<log4j2.version>2.17.2</log4j2.version>
<gson.version>2.8.9</gson.version>
<mockito.version>4.11.0</mockito.version>
<testcontainers.version>1.17.6</testcontainers.version>
<testcontainers.version>1.19.3</testcontainers.version>
</properties>

<licenses>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package tech.ydb.test.integration.docker;

import com.google.common.annotations.VisibleForTesting;
import org.testcontainers.utility.TestcontainersConfiguration;

import tech.ydb.core.grpc.GrpcTransport;
Expand All @@ -22,10 +21,10 @@ public DockerHelperFactory(YdbEnvironment env) {
this(env, new YdbDockerContainer(env, new PortsGenerator()));
}

@VisibleForTesting
DockerHelperFactory(YdbEnvironment env, YdbDockerContainer container) {
public DockerHelperFactory(YdbEnvironment env, YdbDockerContainer container) {
this.env = env;
this.container = container;
this.container.init();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ public class YdbDockerContainer extends GenericContainer<YdbDockerContainer> {
private final int grpcsPort; // Secure connection
private final int grpcPort; // Non secure connection

YdbDockerContainer(YdbEnvironment env, PortsGenerator portsGenerator) {
public YdbDockerContainer(YdbEnvironment env, PortsGenerator portsGenerator) {
super(env.dockerImage());

this.env = env;
this.grpcsPort = portsGenerator.findAvailablePort();
this.grpcPort = portsGenerator.findAvailablePort();
}

grpcsPort = portsGenerator.findAvailablePort();
grpcPort = portsGenerator.findAvailablePort();

public void init() {
addExposedPort(grpcPort);
addExposedPort(grpcsPort);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
package tech.ydb.test.integration.docker;
package tech.ydb.test.integration;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.function.Consumer;

import com.github.dockerjava.api.command.CreateContainerCmd;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
import org.testcontainers.core.CreateContainerCmdModifier;
import org.testcontainers.utility.ThrowingFunction;

import tech.ydb.core.grpc.GrpcTransport;
import tech.ydb.test.integration.DockerMock;
import tech.ydb.test.integration.GrpcTransportMock;
import tech.ydb.test.integration.YdbEnvironment;
import tech.ydb.test.integration.YdbEnvironmentMock;
import tech.ydb.test.integration.YdbHelper;
import tech.ydb.test.integration.docker.DockerHelperFactory;
import tech.ydb.test.integration.docker.YdbDockerContainer;
import tech.ydb.test.integration.utils.PortsGenerator;

/**
Expand Down Expand Up @@ -82,8 +79,8 @@ private void assertCreateContainerCmdModifiers(YdbMockContainer container) {
Mockito.when(cmd.withName(Mockito.any())).thenReturn(cmd);
Mockito.when(cmd.withHostName(Mockito.any())).thenReturn(cmd);

for (Consumer<CreateContainerCmd> modifier: container.getCreateContainerCmdModifiers()) {
modifier.accept(cmd);
for (CreateContainerCmdModifier modifier: container.getCreateContainerCmdModifiers()) {
modifier.modify(cmd);
}

Mockito.verify(cmd, Mockito.times(1)).withName("ydb-" + DockerMock.UUID_MOCKED); // from random UUID
Expand Down
1 change: 1 addition & 0 deletions tests/junit4-support/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
1 change: 1 addition & 0 deletions tests/junit5-support/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

0 comments on commit 5163999

Please sign in to comment.