Testcontainers for Go is a Go package that makes it simple to create and clean up container-based dependencies for automated integration/smoke tests. The clean, easy-to-use API enables developers to programmatically define containers that should be run as part of a test and clean up those resources when the test is done.
When running a new postgres container and then attempting to snapshot the container, an error is thrown:
2024/09/23 11:23:27 🔔 Container is ready: 1eb4447734fa
sync_test.go:111: failed to snapshot container: could not execute restore command DROP DATABASE IF EXISTS "": ERROR: zero-length delimited identifier at or near """" (SQLSTATE 42601)
The database name was set using postgres.WithDatabase(<DB_NAME>) and the container uses the docker.io/postgres:16-alpine image.
Relevant log output
2024/09/23 11:23:27 🔔 Container is ready: 1eb4447734fa
sync_test.go:111: failed to snapshot container: could not execute restore command DROP DATABASE IF EXISTS "": ERROR: zero-length delimited identifier at or near """" (SQLSTATE 42601)
Testcontainers version
v0.33.0
Using the latest Testcontainers version?
Yes
Host OS
MacOS
Host arch
ARM
Go version
1.22.5
Docker version
Docker info
What happened?
When running a new postgres container and then attempting to snapshot the container, an error is thrown:
The database name was set using
postgres.WithDatabase(<DB_NAME>)
and the container uses thedocker.io/postgres:16-alpine
image.Relevant log output
Additional information
No response