testcontainers / testcontainers-ruby

Testcontainers for Ruby
MIT License
120 stars 16 forks source link

Container stuck when calling start #30

Open ruiarodrigues opened 9 months ago

ruiarodrigues commented 9 months ago

Hi!

I'm trying to use the testcontainers for Ruby to use a minIO image in my rspec. I tried multiple ways but didn't succeed. The container keeps being stuck forever when calling start. I thought it was the way I passed the arguments to the container but I think it's not. So I tried to use one of the example with memcached

    puts 'Starting'
    memcached = Testcontainers::GenericContainer.new("memcached:latest").with_exposed_port(11211).start
    puts 'Started'

And the 'Started' log is never written. I can see that the image has been downloaded by the test container but then nothing. It get stuck.

REPOSITORY              TAG                            IMAGE ID       CREATED         SIZE
localstack/localstack   3.0                            8c92f9339e48   9 days ago      1.17GB
minio/minio             RELEASE.2023-10-25T06-33-25Z   7c07ce16e586   4 weeks ago     289MB
memcached               latest                         f05ec0c73b4a   5 weeks ago     126MB
minio/minio             RELEASE.2023-09-04T19-57-37Z   9701b708d3cb   2 months ago    292MB
alpine                  3.16                           47a0d92d42c9   3 months ago    5.3MB
adobe/s3mock            2.17.0                         871cb24de6e3   4 months ago    98MB
testcontainers/ryuk     0.5.1                          8be3fdcaa3e8   6 months ago    12.2MB
confluentinc/cp-kafka   7.2.2                          93fe61e45a92   14 months ago   846MB
testcontainers/ryuk     0.3.4                          5d28cedc492d   16 months ago   11.5MB

I'm using the minIO testcontainer for java in JUnit tests and it works fine. So the docker part is working fine in my laptop.

But when using with RSpec it doesn't work. I'm using it like this (and tried many different ways using with_xxx):

@container = Testcontainers::DockerContainer.new(image: "minio/minio:RELEASE.2023-10-25T06-33-25Z",
                                                     port_bindings: 9000,
                                                     command: %w[server /data]
                                                     )
    @container.add_wait_for(:logs, /1 Online, 0 Offline/)
    @container.start

How can I understand what's going on? Can 'start' be called anywhere in the RSpec?

guilleiguaran commented 9 months ago

@ruiarodrigues thanks for reporting this, I'll investigate it during the next days and hopefully return with some answers