79673176

Date: 2025-06-20 09:56:44
Score: 1
Natty:
Report link

So, I didn't find a solution on YDB side, but looks like it is possible to configure testContainers.

Next configuration saved me:

private static final GenericContainer<?> ydbContainer = new GenericContainer<>(
            DockerImageName.parse("cr.yandex/yc/yandex-docker-local-ydb:latest"))
            .withCreateContainerCmdModifier(cmd -> {
                HostConfig hostConfig = cmd.getHostConfig();

                hostConfig.withPortBindings(
                        new PortBinding(
                                Ports.Binding.bindPort(grpcPort),
                                new ExposedPort(grpcPort)
                        )
                );
                cmd.withHostConfig(hostConfig);
            })
            .withExposedPorts(grpcPort)
            .withCreateContainerCmdModifier(cmd -> cmd.withHostName("localhost"))
            .withExtraHost("ydb-node", "127.0.0.1")
            .withEnv("GRPC_PORT", String.valueOf(grpcPort))
            .withEnv("YDB_USE_IN_MEMORY_PDISKS", "1");

we define some available grpcPort and bind all internal hostnames to localhost. Also, we set YDB GRPC_PORT to available grpc port on our machine. This way all discovered nodes will have host localhost and port - grpcPort.

It is not the solution I want, but it is workaround

Reasons:
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Aleksandr Molev