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

Fix StreamType.RAW frame processing #1101

Merged
merged 6 commits into from
Dec 27, 2018
Merged

Fix StreamType.RAW frame processing #1101

merged 6 commits into from
Dec 27, 2018

Conversation

vektory79
Copy link
Contributor

Fix for Issue #1100. It's solve my problem.

@testcontainers testcontainers deleted a comment Dec 27, 2018
@testcontainers testcontainers deleted a comment Dec 27, 2018
@testcontainers testcontainers deleted a comment Dec 27, 2018
@testcontainers testcontainers deleted a comment Dec 27, 2018
@testcontainers testcontainers deleted a comment Dec 27, 2018
public class OutputStreamWithTTYTest {

@Rule
public GenericContainer container = new GenericContainer("alpine:3.2")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you change to GenericContainer<>, you can remove ((CreateContainerCmd)command) cast


@Rule
public GenericContainer container = new GenericContainer("alpine:3.2")
.withCommand("/bin/sh", "-c", "sleep 2; ls -1" +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. could you please remove + ""
  2. would be better to not use sleep here because it adds constant 2 seconds to the overall test execution time

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...also, you might want to use OneShotStartupCheckStrategy here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, but I was forced to do so because ls command is too fast and container is closes before Testcontainers have time to connect to it.

Solution with Google ping is not the case for me because I behind the firewall and cant ping the Internet. 😄

container.followOutput(consumer, STDOUT);

consumer.waitUntil(frame -> frame.getType() == STDOUT && frame.getUtf8String().contains("home"),
30, TimeUnit.SECONDS);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove the line break


assertThrows("a TimeoutException should be thrown", TimeoutException.class, () -> {
consumer.waitUntil(frame -> frame.getType() == STDOUT && frame.getUtf8String().contains("qqq"),
4, TimeUnit.SECONDS);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it necessary to be 4 seconds?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's can be 3 seconds 😃 Just should be greater than sleep in running script.


@Test
public void testFetchStdout() throws TimeoutException {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

"")
.withCreateContainerCmdModifier(command -> ((CreateContainerCmd)command).withTty(Boolean.TRUE));

private static final Logger LOGGER = LoggerFactory.getLogger(OutputStreamTest.class);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use @Slf4j annotation from Lombok

@testcontainers testcontainers deleted a comment Dec 27, 2018
@testcontainers testcontainers deleted a comment Dec 27, 2018
@testcontainers testcontainers deleted a comment Dec 27, 2018
@testcontainers testcontainers deleted a comment Dec 27, 2018
@testcontainers testcontainers deleted a comment Dec 27, 2018
@bsideup bsideup added this to the next milestone Dec 27, 2018
@testcontainers testcontainers deleted a comment Dec 27, 2018
@testcontainers testcontainers deleted a comment Dec 27, 2018
@testcontainers testcontainers deleted a comment Dec 27, 2018
@testcontainers testcontainers deleted a comment Dec 27, 2018
@bsideup bsideup self-assigned this Dec 27, 2018
@bsideup bsideup changed the title Issue #1100. Fixes processing logs of the RAW type. Fix StreamType.RAW frame processing Dec 27, 2018
@bsideup bsideup merged commit 93312be into testcontainers:master Dec 27, 2018
@bsideup
Copy link
Member

bsideup commented Dec 27, 2018

@vektory79 thanks for your contribution! 👍

@rnorth
Copy link
Member

rnorth commented Dec 28, 2018

Released in 1.10.4!

Thanks for the contribution!

@rnorth rnorth removed this from the next milestone Dec 28, 2018
@bsideup bsideup added this to the 1.10.4 milestone Dec 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants