Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgres Test Containers stopped working on GitHub Actions

I'm using the Postgres Test Container module for writing DB integration tests for an API in Go. Also, I'm using GitHub Actions as part of CI to run these tests.

Test code:

        pgContainer, err := postgres.RunContainer(ctx,
            testcontainers.WithImage("postgres:14-alpine"),
            postgres.WithDatabase("db"),
            postgres.WithUsername("user"),
            postgres.WithPassword("secret"),
            testcontainers.WithWaitStrategy(
                wait.ForLog("database system is ready to accept connections").
                    WithOccurrence(2).WithStartupTimeout(5*time.Second)),
        )
        if err != nil {
            t.Fatal(err)
        }
        ...
        // get a connection pool for the above container via the connection string.
        // use the connection pool in the tests.
         

The setup used to work fine for about a week. I was quite happy with the results, and smug about putting it all together.

That is, until this morning when the CI started failing out of the blue. Now, all I have are the following errors:

2023/07/12 13:59:56 github.com/testcontainers/testcontainers-go - Connected to docker: 
  Server Version: 20.10.25+azure-2
  API Version: 1.41
  Operating System: Ubuntu 22.04.2 LTS
  Total Memory: 6931 MB
2023/07/12 13:59:57 Failed to get image auth for docker.io. Setting empty credentials for the image: docker.io/testcontainers/ryuk:0.5.1. Error is:credentials not found in native keychain
2023/07/12 13:59:59 🐳 Creating container for image docker.io/testcontainers/ryuk:0.5.1
2023/07/12 13:59:59 ✅ Container created: 85df4c97985a
2023/07/12 13:59:59 🐳 Starting container: 85df4c97985a
2023/07/12 14:00:00 ✅ Container started: 85df4c97985a
2023/07/12 14:00:00 🚧 Waiting for container id 85df4c97985a image: docker.io/testcontainers/ryuk:0.5.1. Waiting for: &{Port:8080/tcp timeout:<nil> PollInterval:100ms}
2023/07/12 14:00:00 container logs:
2023/07/12 14:00:00 Pinging Docker...
2023/07/12 14:00:00 Docker daemon is available!
2023/07/12 14:00:00 Starting on port 8080...
2023/07/12 14:00:00 Started!
2023/07/12 14:00:00 New client connected: 172.17.0.1:35910
2023/07/12 14:00:00 EOF
2023/07/12 14:00:00 Client disconnected: 172.17.0.1:35910

Any clues on what could have caused this and/or suggestions on how to go about debugging this.

Please note: The same tests still work locally on my macOSX machine. They just fail on GitHub Actions runner.

like image 563
Kshitij Saraogi Avatar asked Sep 16 '25 14:09

Kshitij Saraogi


1 Answers

This issue seems to be related to the Go version 1.20.6 release.

Pinning the Go version to 1.20.5 in the tests circumvented the issue so far.

Here is a link to GitHub issue that reports similar behavior: https://github.com/moby/moby/issues/45935

like image 138
Kshitij Saraogi Avatar answered Sep 18 '25 09:09

Kshitij Saraogi