To increase the speed of integration tests through Testcontainers in Go, I want to enable tmpfs but it's missing, unlike Java.
In Kotlin, we can say:
val container = PostgreSQLContainer(postgresDockerImage)
.withDatabaseName("dataBaseName")
.withUsername("username")
.withPassword("password")
.withEnv(mapOf("PGDATA" to "/var/lib/postgresql/data"))
.withTmpFs(mapOf("/var/lib/postgresql/data" to "rw"))
EDIT: I solved this by creating a customizer function as follows:
func WithTmpfs() testcontainers.CustomizeRequestOption {
return func(req *testcontainers.GenericContainerRequest) {
req.Tmpfs = map[string]string{"/var/lib/postgresql/data": "rw"}
req.Env["PGDATA"] = "/var/lib/postgresql/data"
}
}
But I got no performance gain at all.