Git Product home page Git Product logo

Comments (3)

mindhog avatar mindhog commented on May 6, 2024 1

[copying my response here, since replying via e-mail didn't seem to do this]
Hi Sergei,

Sorry for the delayed response, thanks for getting in touch (and thanks for Testcontainers!).

Responding inline:

Sergei Egorov wrote:

Hi!

Disclaimer: I am one of the Testcontainers' maintainers

I was looking at your usage and noticed a couple of things, and thought about posting some findings:

1. DockerWebDriverRule

I see that you have the following:
https://github.com/google/nomulus/blob/3cc8d83396bc74076dc7d21d9f740b37e94471c6/core/src/test/java/google/registry/webdriver/DockerWebDriverRule.java

The question is: have you considered using the Testcontainers' Selenium module? It looks very
similar to what you have, so it is less code to maintain :)

@hstonec or @gbrodman might be able to answer this.

2. localhost usage

I noticed what you use static localhost as host:

But I wanted to warn you that there are cases where it is not localhost (e.g. docker-machine, or remote Docker, or running a build inside a container). Fo
r that, Testcontainers provides Container#getContainerIpAddress(), so that the linked line can be changed to:

      url =
          new URL(
              String.format(
                  "http://%s:%d/wd/hub",
                  container.getContainerIpAddress(),
                  container.getMappedPort(CHROME_DRIVER_SERVICE_PORT)));

We're familiar with getContainerIpAddress() and are using it in other places,
this must have been an oversight. We don't currently kick off containers
remotely, but it's conceivable that someone might so we should fix this.

3. new lines

I just noticed https://github.com/google/nomulus/blob/365c5da9426f9bb7ea1a735fb33cb038cfa23603/db/src/test/java/google/registry/sql/flyway/SchemaTest.java#L53\
. Thanks a lot for reporting, we will take a look at it ASAP! Perhaps you have a simple reproducer to start with, btw?

I'm guessing that we probably don't? @hstonec would know.

4. Shutdown hook

Just FYI, there is no need [to register a shutdown hook](https://github.com/google/nomulus/blob/68887d427f8802c30f80efb13101393cb4fff14b/core/src/test/java/go\
ogle/registry/model/transaction/JpaTransactionManagerRule.java#L121) because we already have it. Even more - we have a special sidecar container that monitors t
he connection to the tests process and terminates the container if the tests are killed (e.g. with kill -9), because, when killed, JVM won't trigger the shutd
own hooks.

Good to know! We'll remove it.


I hope it will be helpful for your usage! :)

--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#401

from nomulus.

mindhog avatar mindhog commented on May 6, 2024 1

I think we've covered everything in this issue so I'm closing this issue. Thanks for the report, @bsideup !

from nomulus.

weiminyu avatar weiminyu commented on May 6, 2024

Hi Sergei,

regarding the spurious newline, I added some comments today to the issue I opened.

Our specific problem has gone away, and I suspect it is 'fixed' by changes in transitive dependencies that testcontainer uses (I can still reproduce the problem at an older commit with locked dependencies). However I'm not sure whether this applies to small output sizes only or arbitrary-sized output.

Regards.

from nomulus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.