testcontainers / testcontainers/testcontainers-java

[Enhancement]: make execInContainer asynchronous

Open
#6,388 0 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type/enhancement
Dominant language
Java
Stars
8.7k
Forks
1.9k
Avg merge
2d 17h
Merged PRs (30d)
9

Description

Module

Core

Proposal

In function org.testcontainers.containers.ExecInContainerPattern#execInContainer(com.github.dockerjava.api.DockerClient, com.github.dockerjava.api.command.InspectContainerResponse, java.nio.charset.Charset, java.lang.String...)

I found this part of code:

        try (FrameConsumerResultCallback callback = new FrameConsumerResultCallback()) {
            callback.addConsumer(OutputFrame.OutputType.STDOUT, stdoutConsumer);
            callback.addConsumer(OutputFrame.OutputType.STDERR, stderrConsumer);

            dockerClient.execStartCmd(execCreateCmdResponse.getId()).exec(callback).awaitCompletion();
        }

It seems like this part of code is producing the result in a synchronous and blocking pattern.

This seems to have the impact on the logging and makes it impossible to see the logs as they arrive.

Is it possible to make this asynchronous?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with org.testcontainers.containers.ExecInContainerPattern#execInContainer and inspect the shown FrameConsumerResultCallback and execStartCmd flow. Determine how asynchronous execution should expose output as it arrives without blocking, then verify that logging is observable during execution and that the existing execution result behavior remains covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.