PostgreSQL backup tool with Point-In-Time-Recovery and restore verification
TypeScript backupbackupsdatabasedatabase-backupdevopsdockergolangkubernetesmariadbmongodbmysqlpgpostgrespostgresqls3self-hostedsystem-administrationtoolsweb-ui
FIX (tests): Start test mongod with glibc rseq disabled and print a failed container's output, so MongoDB 9 boots on GitHub runners with Linux 7.0 and a boot failure shows its cause
Rostislav Dugin8a5c14e17d92
diff --git a/backend/internal/util/testing/containers/containers.go b/backend/internal/util/testing/containers/containers.goindex 3934f3bd..5d898a27 100644--- a/backend/internal/util/testing/containers/containers.go+++ b/backend/internal/util/testing/containers/containers.go@@ -6,6 +6,7 @@ package containersimport ("context"+ "io""strconv""strings""testing"@@ -26,6 +27,8 @@ const loopbackIP = "127.0.0.1"// load spike. More would only delay the report of a genuinely broken image.const containerBootAttempts = 3+const failedContainerOutputTailBytes = 8 * 1024+// Endpoint is the reachable address of a started container's primary port.type Endpoint struct {Host string@@ -133,6 +136,7 @@ func bootContainer(t *testing.T, req testcontainers.ContainerRequest) testcontailastErr = errt.Logf("attempt %d/%d to start %s container failed: %v", attempt, containerBootAttempts, req.Image, err)+ logContainerOutputTail(t, container, req.Image)// GenericContainer hands back the half-started container alongside the error.if err := testcontainers.TerminateContainer(container); err != nil {@@ -145,6 +149,35 @@ func bootContainer(t *testing.T, req testcontainers.ContainerRequest) testcontaireturn nil}+// A container that exits during boot surfaces only as "exited with code N"; the reason sits in its+// own output, which is gone once the container is terminated.+func logContainerOutputTail(t *testing.T, container testcontainers.Container, image string) {+ t.Helper()++ if container == nil {+ return+ }++ logs, err := container.Logs(context.Background())+ if err != nil {+ t.Logf("failed to read %s container output: %v", image, err)+ return+ }+ defer func() { _ = logs.Close() }()++ output, err := io.ReadAll(logs)+ if err != nil {+ t.Logf("failed to read %s container output: %v", image, err)+ return+ }++ if len(output) > failedContainerOutputTailBytes {+ output = output[len(output)-failedContainerOutputTailBytes:]+ }++ t.Logf("%s container output tail:\n%s", image, output)+}+// The MySQL client resolves the name "localhost" to a unix socket rather than TCP, and the server// lives in a container where no such socket exists.func endpointOf(t *testing.T, container testcontainers.Container, mappedPort string) Endpoint {diff --git a/backend/internal/util/testing/containers/mongodb.go b/backend/internal/util/testing/containers/mongodb.goindex a8e3ce0e..9f6e72bd 100644--- a/backend/internal/util/testing/containers/mongodb.go+++ b/backend/internal/util/testing/containers/mongodb.go@@ -34,11 +34,15 @@ func mongodbReady() wait.Strategy {)}+// GLIBC_TUNABLES stops glibc from registering rseq, which the TCMalloc bundled in mongod needs for+// itself; on Linux 6.19+ (GitHub runners ship 7.0) mongod otherwise exits at startup, see+// SERVER-121912.func mongodbEnv() map[string]string {return map[string]string{"MONGO_INITDB_ROOT_USERNAME": MongodbUsername,"MONGO_INITDB_ROOT_PASSWORD": MongodbPassword,"MONGO_INITDB_DATABASE": MongodbDatabase,+ "GLIBC_TUNABLES": "glibc.pthread.rseq=0",}}