Skip to content

Instantly share code, notes, and snippets.

@agosmou
Last active November 23, 2023 06:14
Show Gist options
  • Save agosmou/5fbbecde54f8e1282eb0bfa76cf9d9f7 to your computer and use it in GitHub Desktop.
Save agosmou/5fbbecde54f8e1282eb0bfa76cf9d9f7 to your computer and use it in GitHub Desktop.

Fails

PS C:\_code\testcontainers-go\modules\postgres> go test -v
=== RUN   TestPostgres
=== RUN   TestPostgres/Postgres
2023/11/22 22:10:13 🐳 Creating container for image docker.io/testcontainers/ryuk:0.5.1
2023/11/22 22:10:13 βœ… Container created: 68f51bbccb36
2023/11/22 22:10:13 🐳 Starting container: 68f51bbccb36
2023/11/22 22:10:14 βœ… Container started: 68f51bbccb36
2023/11/22 22:10:14 🚧 Waiting for container id 68f51bbccb36 image: docker.io/testcontainers/ryuk:0.5.1. Waiting for: &{Port:8080/tcp timeout:<nil> PollInterval:100ms}
2023/11/22 22:10:14 failed accessing container logs: Error response from daemon: No such container: 68f51bbccb3615d612b63548321b08e14a42c098cc3f4a330c9cd284ddd846d7
    postgres_test.go:65: Error response from daemon: No such container: 68f51bbccb3615d612b63548321b08e14a42c098cc3f4a330c9cd284ddd846d7: could not start container: creating reaper failed: failed to create container
=== RUN   TestPostgres/Timescale
2023/11/22 22:10:14 🐳 Creating container for image docker.io/testcontainers/ryuk:0.5.1
2023/11/22 22:10:15 βœ… Container created: aa9e2ceac893
2023/11/22 22:10:15 🐳 Starting container: aa9e2ceac893
2023/11/22 22:10:15 βœ… Container started: aa9e2ceac893
2023/11/22 22:10:15 🚧 Waiting for container id aa9e2ceac893 image: docker.io/testcontainers/ryuk:0.5.1. Waiting for: &{Port:8080/tcp timeout:<nil> PollInterval:100ms}
2023/11/22 22:10:15 failed accessing container logs: Error response from daemon: No such container: aa9e2ceac8935368dac258fa957d90cdb966b820e0a38056f7e0e049c83db7d3
    postgres_test.go:65: Error response from daemon: No such container: aa9e2ceac8935368dac258fa957d90cdb966b820e0a38056f7e0e049c83db7d3: could not start container: creating reaper failed: failed to create container
=== RUN   TestPostgres/Postgis
2023/11/22 22:10:15 🐳 Creating container for image docker.io/testcontainers/ryuk:0.5.1
2023/11/22 22:10:16 βœ… Container created: 6e24665dbe51
2023/11/22 22:10:16 🐳 Starting container: 6e24665dbe51
2023/11/22 22:10:16 βœ… Container started: 6e24665dbe51
2023/11/22 22:10:16 🚧 Waiting for container id 6e24665dbe51 image: docker.io/testcontainers/ryuk:0.5.1. Waiting for: &{Port:8080/tcp timeout:<nil> PollInterval:100ms}
2023/11/22 22:10:16 failed accessing container logs: Error response from daemon: No such container: 6e24665dbe513d1632cf693f1e5efea4d4ab1cacc61fbb147239313ba7d1a81a
    postgres_test.go:65: Error response from daemon: No such container: 6e24665dbe513d1632cf693f1e5efea4d4ab1cacc61fbb147239313ba7d1a81a: could not start container: creating reaper failed: failed to create container
--- FAIL: TestPostgres (3.21s)
    --- FAIL: TestPostgres/Postgres (1.09s)
    --- FAIL: TestPostgres/Timescale (1.09s)
    --- FAIL: TestPostgres/Postgis (1.03s)
=== RUN   TestContainerWithWaitForSQL
=== RUN   TestContainerWithWaitForSQL/default_query
2023/11/22 22:10:17 🐳 Creating container for image docker.io/testcontainers/ryuk:0.5.1
2023/11/22 22:10:17 βœ… Container created: 4e1c8c1ffcaa
2023/11/22 22:10:17 🐳 Starting container: 4e1c8c1ffcaa
2023/11/22 22:10:17 βœ… Container started: 4e1c8c1ffcaa
2023/11/22 22:10:17 🚧 Waiting for container id 4e1c8c1ffcaa image: docker.io/testcontainers/ryuk:0.5.1. Waiting for: &{Port:8080/tcp timeout:<nil> PollInterval:100ms}
2023/11/22 22:10:18 failed accessing container logs: Error response from daemon: No such container: 4e1c8c1ffcaab3bafdda6aef2c13c03720ec1afef96132c5fea06964b5d423e2
    postgres_test.go:119:
                Error Trace:    C:/_code/testcontainers-go/modules/postgres/postgres_test.go:119
                Error:          Received unexpected error:
                                Error response from daemon: No such container: 4e1c8c1ffcaab3bafdda6aef2c13c03720ec1afef96132c5fea06964b5d423e2: could not start container: creating reaper failed: failed to create container
                Test:           TestContainerWithWaitForSQL/default_query
=== RUN   TestContainerWithWaitForSQL/custom_query
2023/11/22 22:10:18 🐳 Creating container for image docker.io/testcontainers/ryuk:0.5.1
2023/11/22 22:10:18 βœ… Container created: f615881b8a11
2023/11/22 22:10:18 🐳 Starting container: f615881b8a11
2023/11/22 22:10:18 βœ… Container started: f615881b8a11
2023/11/22 22:10:18 🚧 Waiting for container id f615881b8a11 image: docker.io/testcontainers/ryuk:0.5.1. Waiting for: &{Port:8080/tcp timeout:<nil> PollInterval:100ms}
2023/11/22 22:10:19 failed accessing container logs: Error response from daemon: No such container: f615881b8a11780616c66544b8d26ff262e2eda6205c9e4b100517a68c498f03
    postgres_test.go:130:
                Error Trace:    C:/_code/testcontainers-go/modules/postgres/postgres_test.go:130
                Error:          Received unexpected error:
                                Error response from daemon: No such container: f615881b8a11780616c66544b8d26ff262e2eda6205c9e4b100517a68c498f03: could not start container: creating reaper failed: failed to create container
                Test:           TestContainerWithWaitForSQL/custom_query
=== RUN   TestContainerWithWaitForSQL/custom_bad_query
2023/11/22 22:10:19 🐳 Creating container for image docker.io/testcontainers/ryuk:0.5.1
2023/11/22 22:10:19 βœ… Container created: 5d8c3d63933f
2023/11/22 22:10:19 🐳 Starting container: 5d8c3d63933f
2023/11/22 22:10:19 βœ… Container started: 5d8c3d63933f
2023/11/22 22:10:19 🚧 Waiting for container id 5d8c3d63933f image: docker.io/testcontainers/ryuk:0.5.1. Waiting for: &{Port:8080/tcp timeout:<nil> PollInterval:100ms}
2023/11/22 22:10:20 failed accessing container logs: Error response from daemon: No such container: 5d8c3d63933fff5c92910810a0eb9931243c6cb7d912b511dfa6d9d893d1d88f
--- FAIL: TestContainerWithWaitForSQL (3.32s)
    --- FAIL: TestContainerWithWaitForSQL/default_query (1.12s)
    --- FAIL: TestContainerWithWaitForSQL/custom_query (1.04s)
    --- PASS: TestContainerWithWaitForSQL/custom_bad_query (1.15s)
=== RUN   TestWithConfigFile
2023/11/22 22:10:20 🐳 Creating container for image docker.io/testcontainers/ryuk:0.5.1
2023/11/22 22:10:20 βœ… Container created: e4f6d79a688a
2023/11/22 22:10:20 🐳 Starting container: e4f6d79a688a
2023/11/22 22:10:20 βœ… Container started: e4f6d79a688a
2023/11/22 22:10:20 🚧 Waiting for container id e4f6d79a688a image: docker.io/testcontainers/ryuk:0.5.1. Waiting for: &{Port:8080/tcp timeout:<nil> PollInterval:100ms}
2023/11/22 22:10:21 failed accessing container logs: Error response from daemon: No such container: e4f6d79a688a6d84dc0441ccaffe46f31f6229d86d647e1be987a5077279e397
    postgres_test.go:157: Error response from daemon: No such container: e4f6d79a688a6d84dc0441ccaffe46f31f6229d86d647e1be987a5077279e397: could not start container: creating reaper failed: failed to create container
--- FAIL: TestWithConfigFile (1.17s)
=== RUN   TestWithInitScript
2023/11/22 22:10:21 🐳 Creating container for image docker.io/testcontainers/ryuk:0.5.1
2023/11/22 22:10:21 βœ… Container created: df98276e1f2d
2023/11/22 22:10:21 🐳 Starting container: df98276e1f2d
2023/11/22 22:10:22 βœ… Container started: df98276e1f2d
2023/11/22 22:10:22 🚧 Waiting for container id df98276e1f2d image: docker.io/testcontainers/ryuk:0.5.1. Waiting for: &{Port:8080/tcp timeout:<nil> PollInterval:100ms}
2023/11/22 22:10:22 failed accessing container logs: Error response from daemon: No such container: df98276e1f2df69ffc55dbc20c9b4b2dba41311eae20a495f1605460553b0c74
    postgres_test.go:188: Error response from daemon: No such container: df98276e1f2df69ffc55dbc20c9b4b2dba41311eae20a495f1605460553b0c74: could not start container: creating reaper failed: failed to create container
--- FAIL: TestWithInitScript (1.12s)
=== RUN   ExampleRunContainer
2023/11/22 22:10:22 🐳 Creating container for image docker.io/testcontainers/ryuk:0.5.1
2023/11/22 22:10:22 βœ… Container created: cc149a3ba4f6
2023/11/22 22:10:22 🐳 Starting container: cc149a3ba4f6
2023/11/22 22:10:23 βœ… Container started: cc149a3ba4f6
2023/11/22 22:10:23 🚧 Waiting for container id cc149a3ba4f6 image: docker.io/testcontainers/ryuk:0.5.1. Waiting for: &{Port:8080/tcp timeout:<nil> PollInterval:100ms}
2023/11/22 22:10:23 failed accessing container logs: Error response from daemon: No such container: cc149a3ba4f6ec20b6c0035a3924eb5a40459d113cb8b94202782b07b71bc8ee
--- FAIL: ExampleRunContainer (1.19s)
panic: Error response from daemon: No such container: cc149a3ba4f6ec20b6c0035a3924eb5a40459d113cb8b94202782b07b71bc8ee: could not start container: creating reaper failed: failed to create container [recovered]
        panic: Error response from daemon: No such container: cc149a3ba4f6ec20b6c0035a3924eb5a40459d113cb8b94202782b07b71bc8ee: could not start container: creating reaper failed: failed to create container

goroutine 1 [running]:
testing.(*InternalExample).processRunResult(0xc000463bd8, {0x0, 0x0}, 0x0?, 0x0, {0xdfa1e0, 0xc0004a05e0})
        C:/Program Files/Go/src/testing/example.go:95 +0x645
testing.runExample.func2()
        C:/Program Files/Go/src/testing/run_example.go:59 +0x11a
panic({0xdfa1e0?, 0xc0004a05e0?})
        C:/Program Files/Go/src/runtime/panic.go:914 +0x21f
github.com/testcontainers/testcontainers-go/modules/postgres_test.ExampleRunContainer()
        C:/_code/testcontainers-go/modules/postgres/examples_test.go:35 +0x5e5
testing.runExample({{0xeb2b67, 0x13}, 0xef0720, {0xea9cde, 0x5}, 0x0})
        C:/Program Files/Go/src/testing/run_example.go:63 +0x2cd
testing.runExamples(0xc000463d98, {0x13816a0?, 0x1, 0x4?})
        C:/Program Files/Go/src/testing/example.go:44 +0x171
testing.(*M).Run(0xc000305540)
        C:/Program Files/Go/src/testing/testing.go:1927 +0x6e6
main.main()
        _testmain.go:57 +0x19c
exit status 2
FAIL    github.com/testcontainers/testcontainers-go/modules/postgres    10.646s

Now it still fails if I disable ryuk

PS C:\_code\testcontainers-go\modules\postgres> $env:TESTCONTAINERS_RYUK_DISABLED="true"
PS C:\_code\testcontainers-go\modules\postgres> go test -v
=== RUN   TestPostgres
=== RUN   TestPostgres/Postgres

**********************************************************************************************
Ryuk has been disabled for the current execution. This can cause unexpected behavior in your environment.
More on this: https://golang.testcontainers.org/features/garbage_collector/
**********************************************************************************************
2023/11/22 22:11:37 🐳 Creating container for image docker.io/postgres:15.2-alpine
2023/11/22 22:11:38 βœ… Container created: 19a23df3865d
2023/11/22 22:11:38 🐳 Starting container: 19a23df3865d
2023/11/22 22:11:39 βœ… Container started: 19a23df3865d
2023/11/22 22:11:39 🚧 Waiting for container id 19a23df3865d image: docker.io/postgres:15.2-alpine. Waiting for: &{timeout:<nil> deadline:0xc000386868 Strategies:[0xc0003cca20]}
2023/11/22 22:11:42 🐳 Terminating container: 19a23df3865d
2023/11/22 22:11:43 🚫 Container terminated: 19a23df3865d
=== RUN   TestPostgres/Timescale
2023/11/22 22:11:43 🐳 Creating container for image docker.io/timescale/timescaledb:2.1.0-pg11
2023/11/22 22:11:43 βœ… Container created: 99ce448dd62e
2023/11/22 22:11:43 🐳 Starting container: 99ce448dd62e
2023/11/22 22:11:43 βœ… Container started: 99ce448dd62e
2023/11/22 22:11:43 🚧 Waiting for container id 99ce448dd62e image: docker.io/timescale/timescaledb:2.1.0-pg11. Waiting for: &{timeout:<nil> deadline:0xc0003868e0 Strategies:[0xc0003cca50]}
2023/11/22 22:11:47 🐳 Terminating container: 99ce448dd62e
2023/11/22 22:11:48 🚫 Container terminated: 99ce448dd62e
=== RUN   TestPostgres/Postgis
2023/11/22 22:11:48 🐳 Creating container for image docker.io/postgis/postgis:12-3.0
2023/11/22 22:11:48 βœ… Container created: 78f6fba31d0d
2023/11/22 22:11:48 🐳 Starting container: 78f6fba31d0d
2023/11/22 22:11:48 βœ… Container started: 78f6fba31d0d
2023/11/22 22:11:48 🚧 Waiting for container id 78f6fba31d0d image: docker.io/postgis/postgis:12-3.0. Waiting for: &{timeout:<nil> deadline:0xc000387160 Strategies:[0xc0003cca80]}
2023/11/22 22:11:54 🐳 Terminating container: 78f6fba31d0d
2023/11/22 22:11:54 🚫 Container terminated: 78f6fba31d0d
--- PASS: TestPostgres (17.13s)
    --- PASS: TestPostgres/Postgres (5.20s)
    --- PASS: TestPostgres/Timescale (5.04s)
    --- PASS: TestPostgres/Postgis (6.89s)
=== RUN   TestContainerWithWaitForSQL
=== RUN   TestContainerWithWaitForSQL/default_query
2023/11/22 22:11:54 🐳 Creating container for image docker.io/postgres:11-alpine
2023/11/22 22:11:55 βœ… Container created: 9b8e2de74b65
2023/11/22 22:11:55 🐳 Starting container: 9b8e2de74b65
2023/11/22 22:11:55 βœ… Container started: 9b8e2de74b65
2023/11/22 22:11:55 🚧 Waiting for container id 9b8e2de74b65 image: docker.io/postgres:11-alpine. Waiting for: &{timeout:<nil> deadline:0xc000387110 Strategies:[0xc000068500]}
=== RUN   TestContainerWithWaitForSQL/custom_query
2023/11/22 22:11:58 🐳 Creating container for image docker.io/postgres:11-alpine
2023/11/22 22:11:58 βœ… Container created: d818076e6cf7
2023/11/22 22:11:58 🐳 Starting container: d818076e6cf7
2023/11/22 22:11:59 βœ… Container started: d818076e6cf7
2023/11/22 22:11:59 🚧 Waiting for container id d818076e6cf7 image: docker.io/postgres:11-alpine. Waiting for: &{timeout:<nil> deadline:0xc0005032e0 Strategies:[0xc000068f00]}
=== RUN   TestContainerWithWaitForSQL/custom_bad_query
2023/11/22 22:12:02 🐳 Creating container for image docker.io/postgres:11-alpine
2023/11/22 22:12:02 βœ… Container created: be441d115de0
2023/11/22 22:12:02 🐳 Starting container: be441d115de0
2023/11/22 22:12:02 βœ… Container started: be441d115de0
2023/11/22 22:12:02 🚧 Waiting for container id be441d115de0 image: docker.io/postgres:11-alpine. Waiting for: &{timeout:<nil> deadline:0xc0001cff88 Strategies:[0xc0002b2690]}
2023/11/22 22:12:07 container logs (Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.43/containers/be441d115de057616a5a47d5bec7258379f090d2f40dc8cd614116e015cb9eb5/json": context deadline exceeded):
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... UTC
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
sh: locale: not found
2023-11-23 06:12:03.828 UTC [30] WARNING:  no usable system locales were found
performing post-bootstrap initialization ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
syncing data to disk ... ok

Success. You can now start the database server using:

    pg_ctl -D /var/lib/postgresql/data -l logfile start

waiting for server to start....2023-11-23 06:12:05.226 UTC [36] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-11-23 06:12:05.238 UTC [37] LOG:  database system was shut down at 2023-11-23 06:12:04 UTC
2023-11-23 06:12:05.245 UTC [36] LOG:  database system is ready to accept connections
 done
server started
CREATE DATABASE


/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*

waiting for server to shut down....2023-11-23 06:12:05.575 UTC [36] LOG:  received fast shutdown request
2023-11-23 06:12:05.575 UTC [36] LOG:  aborting any active transactions
2023-11-23 06:12:05.577 UTC [36] LOG:  background worker "logical replication launcher" (PID 43) exited with exit code 1
2023-11-23 06:12:05.577 UTC [38] LOG:  shutting down
2023-11-23 06:12:05.582 UTC [36] LOG:  database system is shut down
 done
server stopped

PostgreSQL init process complete; ready for start up.

2023-11-23 06:12:05.688 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2023-11-23 06:12:05.688 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2023-11-23 06:12:05.688 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-11-23 06:12:05.700 UTC [51] LOG:  database system was shut down at 2023-11-23 06:12:05 UTC
2023-11-23 06:12:05.707 UTC [1] LOG:  database system is ready to accept connections
2023-11-23 06:12:05.803 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 06:12:05.803 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 06:12:05.885 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 06:12:05.885 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 06:12:05.981 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 06:12:05.981 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 06:12:06.091 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 06:12:06.091 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 06:12:06.189 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 06:12:06.189 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 06:12:06.297 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 06:12:06.297 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 06:12:06.442 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 06:12:06.442 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 06:12:06.481 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 06:12:06.481 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 06:12:06.592 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 06:12:06.592 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 06:12:06.683 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 06:12:06.683 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 06:12:06.793 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 06:12:06.793 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 06:12:06.887 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 06:12:06.887 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 06:12:06.980 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 06:12:06.980 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 06:12:07.103 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 06:12:07.103 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 06:12:07.182 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 06:12:07.182 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 06:12:07.292 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 06:12:07.292 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 06:12:07.386 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 06:12:07.386 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 06:12:07.481 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 06:12:07.481 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 06:12:07.590 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 06:12:07.590 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 06:12:07.686 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 06:12:07.686 UTC [58] STATEMENT:  SELECT 'a' from b

--- PASS: TestContainerWithWaitForSQL (12.83s)
    --- PASS: TestContainerWithWaitForSQL/default_query (3.64s)
    --- PASS: TestContainerWithWaitForSQL/custom_query (3.53s)
    --- PASS: TestContainerWithWaitForSQL/custom_bad_query (5.66s)
=== RUN   TestWithConfigFile
2023/11/22 22:12:07 🐳 Creating container for image docker.io/postgres:11-alpine
2023/11/22 22:12:07 βœ… Container created: 79a029cf3d63
2023/11/22 22:12:07 🐳 Starting container: 79a029cf3d63
2023/11/22 22:12:08 βœ… Container started: 79a029cf3d63
2023/11/22 22:12:08 🚧 Waiting for container id 79a029cf3d63 image: docker.io/postgres:11-alpine. Waiting for: &{timeout:<nil> deadline:0xc00058c3f8 Strategies:[0xc0004b2870]}
2023/11/22 22:12:11 🐳 Terminating container: 79a029cf3d63
2023/11/22 22:12:12 🚫 Container terminated: 79a029cf3d63
--- PASS: TestWithConfigFile (4.65s)
=== RUN   TestWithInitScript
2023/11/22 22:12:12 🐳 Creating container for image docker.io/postgres:15.2-alpine
2023/11/22 22:12:12 βœ… Container created: 279fbec6a8fc
2023/11/22 22:12:12 🐳 Starting container: 279fbec6a8fc
2023/11/22 22:12:13 βœ… Container started: 279fbec6a8fc
2023/11/22 22:12:13 🚧 Waiting for container id 279fbec6a8fc image: docker.io/postgres:15.2-alpine. Waiting for: &{timeout:<nil> deadline:0xc000170a88 Strategies:[0xc0005077a0]}
2023/11/22 22:12:18 container logs (container exited with code 127):
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... UTC
creating configuration files ... ok
running bootstrap script ... ok
sh: locale: not found
2023-11-23 06:12:15.144 UTC [30] WARNING:  no usable system locales were found
performing post-bootstrap initialization ... ok
syncing data to disk ... ok


Success. You can now start the database server using:

    pg_ctl -D /var/lib/postgresql/data -l logfile start

initdb: warning: enabling "trust" authentication for local connections
initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.
waiting for server to start....2023-11-23 06:12:17.119 UTC [36] LOG:  starting PostgreSQL 15.2 on x86_64-pc-linux-musl, compiled by gcc (Alpine 12.2.1_git20220924-r4) 12.2.1 20220924, 64-bit
2023-11-23 06:12:17.119 UTC [36] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-11-23 06:12:17.123 UTC [39] LOG:  database system was shut down at 2023-11-23 06:12:16 UTC
2023-11-23 06:12:17.127 UTC [36] LOG:  database system is ready to accept connections
 done
server started
CREATE DATABASE


/usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/init-user-db.sh
/usr/local/bin/docker-entrypoint.sh: line 170: /docker-entrypoint-initdb.d/init-user-db.sh: cannot execute: required file not found

    postgres_test.go:188: container exited with code 127: failed to start container
--- FAIL: TestWithInitScript (5.60s)
=== RUN   ExampleRunContainer
2023/11/22 22:12:18 🐳 Creating container for image docker.io/postgres:15.2-alpine
2023/11/22 22:12:18 βœ… Container created: 5299fd4d92b4
2023/11/22 22:12:18 🐳 Starting container: 5299fd4d92b4
2023/11/22 22:12:18 βœ… Container started: 5299fd4d92b4
2023/11/22 22:12:18 🚧 Waiting for container id 5299fd4d92b4 image: docker.io/postgres:15.2-alpine. Waiting for: &{timeout:<nil> deadline:0xc00058c268 Strategies:[0xc000506b70]}
2023/11/22 22:12:22 container logs (container exited with code 127):
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... UTC
creating configuration files ... ok
running bootstrap script ... ok
sh: locale: not found
2023-11-23 06:12:19.966 UTC [30] WARNING:  no usable system locales were found
performing post-bootstrap initialization ... ok
initdb: warning: enabling "trust" authentication for local connections
initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.
syncing data to disk ... ok


Success. You can now start the database server using:

    pg_ctl -D /var/lib/postgresql/data -l logfile start

waiting for server to start....2023-11-23 06:12:21.585 GMT [36] LOG:  starting PostgreSQL 15.2 on x86_64-pc-linux-musl, compiled by gcc (Alpine 12.2.1_git20220924-r4) 12.2.1 20220924, 64-bit
2023-11-23 06:12:21.586 GMT [36] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-11-23 06:12:21.588 GMT [39] LOG:  database system was shut down at 2023-11-23 06:12:20 GMT
2023-11-23 06:12:21.596 GMT [36] LOG:  database system is ready to accept connections
 done
server started
CREATE DATABASE


/usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/init-user-db.sh
/usr/local/bin/docker-entrypoint.sh: line 170: /docker-entrypoint-initdb.d/init-user-db.sh: cannot execute: required file not found

--- FAIL: ExampleRunContainer (4.19s)
panic: container exited with code 127: failed to start container [recovered]
        panic: container exited with code 127: failed to start container

goroutine 1 [running]:
testing.(*InternalExample).processRunResult(0xc0002e3bd8, {0x0, 0x0}, 0x0?, 0x0, {0x138a1e0, 0xc000200300})
        C:/Program Files/Go/src/testing/example.go:95 +0x645
testing.runExample.func2()
        C:/Program Files/Go/src/testing/run_example.go:59 +0x11a
panic({0x138a1e0?, 0xc000200300?})
        C:/Program Files/Go/src/runtime/panic.go:914 +0x21f
github.com/testcontainers/testcontainers-go/modules/postgres_test.ExampleRunContainer()
        C:/_code/testcontainers-go/modules/postgres/examples_test.go:35 +0x5e5
testing.runExample({{0x1442b67, 0x13}, 0x1480720, {0x1439cde, 0x5}, 0x0})
        C:/Program Files/Go/src/testing/run_example.go:63 +0x2cd
testing.runExamples(0xc0002e3d98, {0x19116a0?, 0x1, 0x4?})
        C:/Program Files/Go/src/testing/example.go:44 +0x171
testing.(*M).Run(0xc0003dcdc0)
        C:/Program Files/Go/src/testing/testing.go:1927 +0x6e6
main.main()
        _testmain.go:57 +0x19c
exit status 2
FAIL    github.com/testcontainers/testcontainers-go/modules/postgres    45.155s

passes

agosmou@LAPTOP-OTMDJHH9:~/testcontainers-go/modules/postgres$ go test -v
=== RUN   TestPostgres
=== RUN   TestPostgres/Postgres
2023/11/22 21:50:27 github.com/testcontainers/testcontainers-go - Connected to docker:
  Server Version: 24.0.6
  API Version: 1.43
  Operating System: Docker Desktop
  Total Memory: 7865 MB
  Resolved Docker Host: unix:///var/run/docker.sock
  Resolved Docker Socket Path: /var/run/docker.sock
  Test SessionID: b0ddae5d61a095d3b0810acb2df6ad35371a674c4a0d2d7e3c46c9d4b6775385
  Test ProcessID: 66fe4c70-ac81-4e2a-813e-4135b039977d
2023/11/22 21:50:27 🐳 Creating container for image docker.io/testcontainers/ryuk:0.5.1
2023/11/22 21:50:28 βœ… Container created: 17247342d63e
2023/11/22 21:50:28 🐳 Starting container: 17247342d63e
2023/11/22 21:50:28 βœ… Container started: 17247342d63e
2023/11/22 21:50:28 🚧 Waiting for container id 17247342d63e image: docker.io/testcontainers/ryuk:0.5.1. Waiting for: &{Port:8080/tcp timeout:<nil> PollInterval:100ms}
2023/11/22 21:50:28 🐳 Creating container for image docker.io/postgres:15.2-alpine
2023/11/22 21:50:28 βœ… Container created: 3c2a90a2dbf8
2023/11/22 21:50:28 🐳 Starting container: 3c2a90a2dbf8
2023/11/22 21:50:29 βœ… Container started: 3c2a90a2dbf8
2023/11/22 21:50:29 🚧 Waiting for container id 3c2a90a2dbf8 image: docker.io/postgres:15.2-alpine. Waiting for: &{timeout:<nil> deadline:0xc0003afdd0 Strategies:[0xc000470120]}
2023/11/22 21:50:31 🐳 Terminating container: 3c2a90a2dbf8
2023/11/22 21:50:31 🚫 Container terminated: 3c2a90a2dbf8
=== RUN   TestPostgres/Timescale
2023/11/22 21:50:31 🐳 Creating container for image docker.io/timescale/timescaledb:2.1.0-pg11
2023/11/22 21:50:31 βœ… Container created: 7fa1da52318a
2023/11/22 21:50:31 🐳 Starting container: 7fa1da52318a
2023/11/22 21:50:32 βœ… Container started: 7fa1da52318a
2023/11/22 21:50:32 🚧 Waiting for container id 7fa1da52318a image: docker.io/timescale/timescaledb:2.1.0-pg11. Waiting for: &{timeout:<nil> deadline:0xc0006060a8 Strategies:[0xc000470150]}
2023/11/22 21:50:34 🐳 Terminating container: 7fa1da52318a
2023/11/22 21:50:34 🚫 Container terminated: 7fa1da52318a
=== RUN   TestPostgres/Postgis
2023/11/22 21:50:34 🐳 Creating container for image docker.io/postgis/postgis:12-3.0
2023/11/22 21:50:34 βœ… Container created: 53622a63a722
2023/11/22 21:50:34 🐳 Starting container: 53622a63a722
2023/11/22 21:50:35 βœ… Container started: 53622a63a722
2023/11/22 21:50:35 🚧 Waiting for container id 53622a63a722 image: docker.io/postgis/postgis:12-3.0. Waiting for: &{timeout:<nil> deadline:0xc000606410 Strategies:[0xc000470180]}
2023/11/22 21:50:39 🐳 Terminating container: 53622a63a722
2023/11/22 21:50:40 🚫 Container terminated: 53622a63a722
--- PASS: TestPostgres (12.63s)
    --- PASS: TestPostgres/Postgres (3.75s)
    --- PASS: TestPostgres/Timescale (3.17s)
    --- PASS: TestPostgres/Postgis (5.71s)
=== RUN   TestContainerWithWaitForSQL
=== RUN   TestContainerWithWaitForSQL/default_query
2023/11/22 21:50:40 🐳 Creating container for image docker.io/postgres:11-alpine
2023/11/22 21:50:40 βœ… Container created: 23e807d04336
2023/11/22 21:50:40 🐳 Starting container: 23e807d04336
2023/11/22 21:50:41 βœ… Container started: 23e807d04336
2023/11/22 21:50:41 🚧 Waiting for container id 23e807d04336 image: docker.io/postgres:11-alpine. Waiting for: &{timeout:<nil> deadline:0xc00036f960 Strategies:[0xc00035c550]}
=== RUN   TestContainerWithWaitForSQL/custom_query
2023/11/22 21:50:43 🐳 Creating container for image docker.io/postgres:11-alpine
2023/11/22 21:50:43 βœ… Container created: 04d25aedb5af
2023/11/22 21:50:43 🐳 Starting container: 04d25aedb5af
2023/11/22 21:50:43 βœ… Container started: 04d25aedb5af
2023/11/22 21:50:43 🚧 Waiting for container id 04d25aedb5af image: docker.io/postgres:11-alpine. Waiting for: &{timeout:<nil> deadline:0xc000384f68 Strategies:[0xc000160820]}
=== RUN   TestContainerWithWaitForSQL/custom_bad_query
2023/11/22 21:50:45 🐳 Creating container for image docker.io/postgres:11-alpine
2023/11/22 21:50:45 βœ… Container created: 980728c60c7c
2023/11/22 21:50:45 🐳 Starting container: 980728c60c7c
2023/11/22 21:50:46 βœ… Container started: 980728c60c7c
2023/11/22 21:50:46 🚧 Waiting for container id 980728c60c7c image: docker.io/postgres:11-alpine. Waiting for: &{timeout:<nil> deadline:0xc0002f2598 Strategies:[0xc0000910e0]}
2023/11/22 21:50:51 container logs (Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.43/containers/980728c60c7c9befc56efda8f956fe4797afee7ca156358885aab725722447b1/json": context deadline exceeded):
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... UTC
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
sh: locale: not found
2023-11-23 05:50:46.965 UTC [30] WARNING:  no usable system locales were found
performing post-bootstrap initialization ... ok

syncing data to disk ... ok

Success. You can now start the database server using:

    pg_ctl -D /var/lib/postgresql/data -l logfile start

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
waiting for server to start....2023-11-23 05:50:47.916 UTC [36] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-11-23 05:50:47.927 UTC [37] LOG:  database system was shut down at 2023-11-23 05:50:47 UTC
2023-11-23 05:50:47.934 UTC [36] LOG:  database system is ready to accept connections
 done
server started
CREATE DATABASE


/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*

waiting for server to shut down....2023-11-23 05:50:48.260 UTC [36] LOG:  received fast shutdown request
2023-11-23 05:50:48.260 UTC [36] LOG:  aborting any active transactions
2023-11-23 05:50:48.262 UTC [36] LOG:  background worker "logical replication launcher" (PID 43) exited with exit code 1
2023-11-23 05:50:48.262 UTC [38] LOG:  shutting down
2023-11-23 05:50:48.266 UTC [36] LOG:  database system is shut down
 done
server stopped

PostgreSQL init process complete; ready for start up.

2023-11-23 05:50:48.369 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2023-11-23 05:50:48.369 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2023-11-23 05:50:48.369 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-11-23 05:50:48.380 UTC [51] LOG:  database system was shut down at 2023-11-23 05:50:48 UTC
2023-11-23 05:50:48.386 UTC [1] LOG:  database system is ready to accept connections
2023-11-23 05:50:48.455 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:48.455 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:48.543 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:48.543 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:48.642 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:48.642 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:48.741 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:48.741 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:48.843 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:48.843 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:48.942 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:48.942 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:49.042 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:49.042 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:49.141 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:49.141 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:49.242 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:49.242 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:49.341 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:49.341 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:49.442 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:49.442 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:49.543 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:49.543 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:49.643 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:49.643 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:49.771 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:49.771 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:49.857 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:49.857 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:49.971 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:49.971 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:50.049 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:50.049 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:50.141 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:50.141 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:50.239 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:50.239 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:50.346 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:50.346 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:50.443 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:50.443 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:50.544 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:50.544 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:50.643 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:50.643 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:50.742 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:50.742 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:50.871 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:50.871 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:50.964 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:50.964 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:51.081 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:51.081 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:51.142 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:51.142 UTC [58] STATEMENT:  SELECT 'a' from b
2023-11-23 05:50:51.241 UTC [58] ERROR:  relation "b" does not exist at character 17
2023-11-23 05:50:51.241 UTC [58] STATEMENT:  SELECT 'a' from b

--- PASS: TestContainerWithWaitForSQL (10.83s)
    --- PASS: TestContainerWithWaitForSQL/default_query (2.80s)
    --- PASS: TestContainerWithWaitForSQL/custom_query (2.54s)
    --- PASS: TestContainerWithWaitForSQL/custom_bad_query (5.49s)
=== RUN   TestWithConfigFile
2023/11/22 21:50:51 🐳 Creating container for image docker.io/postgres:11-alpine
2023/11/22 21:50:51 βœ… Container created: 942178ee89d2
2023/11/22 21:50:51 🐳 Starting container: 942178ee89d2
2023/11/22 21:50:51 βœ… Container started: 942178ee89d2
2023/11/22 21:50:51 🚧 Waiting for container id 942178ee89d2 image: docker.io/postgres:11-alpine. Waiting for: &{timeout:<nil> deadline:0xc000438008 Strategies:[0xc00049b8c0]}
2023/11/22 21:50:54 🐳 Terminating container: 942178ee89d2
2023/11/22 21:50:54 🚫 Container terminated: 942178ee89d2
--- PASS: TestWithConfigFile (3.30s)
=== RUN   TestWithInitScript
2023/11/22 21:50:54 🐳 Creating container for image docker.io/postgres:15.2-alpine
2023/11/22 21:50:54 βœ… Container created: 4cd2eaa9870f
2023/11/22 21:50:54 🐳 Starting container: 4cd2eaa9870f
2023/11/22 21:50:55 βœ… Container started: 4cd2eaa9870f
2023/11/22 21:50:55 🚧 Waiting for container id 4cd2eaa9870f image: docker.io/postgres:15.2-alpine. Waiting for: &{timeout:<nil> deadline:0xc000244ba8 Strategies:[0xc000527350]}
2023/11/22 21:50:57 🐳 Terminating container: 4cd2eaa9870f
2023/11/22 21:50:58 🚫 Container terminated: 4cd2eaa9870f
--- PASS: TestWithInitScript (3.41s)
=== RUN   ExampleRunContainer
2023/11/22 21:50:58 🐳 Creating container for image docker.io/postgres:15.2-alpine
2023/11/22 21:50:58 βœ… Container created: c189fb0e1377
2023/11/22 21:50:58 🐳 Starting container: c189fb0e1377
2023/11/22 21:50:58 βœ… Container started: c189fb0e1377
2023/11/22 21:50:58 🚧 Waiting for container id c189fb0e1377 image: docker.io/postgres:15.2-alpine. Waiting for: &{timeout:<nil> deadline:0xc000509878 Strategies:[0xc00039b2f0]}
2023/11/22 21:51:01 🐳 Terminating container: c189fb0e1377
2023/11/22 21:51:01 🚫 Container terminated: c189fb0e1377
--- PASS: ExampleRunContainer (3.94s)
PASS
ok      github.com/testcontainers/testcontainers-go/modules/postgres    34.123s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment