PostgreSQL backup tool with Point-In-Time-Recovery and restore verification
TypeScript backupbackupsdatabasedatabase-backupdevopsdockergolangkubernetesmariadbmongodbmysqlpgpostgrespostgresqls3self-hostedsystem-administrationtoolsweb-ui
FIX (tests): Wait for sshd before handing out the SFTP container, since the port opens while host keys are still generating
Rostislav Duginc4b6f6a65ca9
diff --git a/backend/internal/util/testing/containers/sftp.go b/backend/internal/util/testing/containers/sftp.goindex c4076b8e..fd560a13 100644--- a/backend/internal/util/testing/containers/sftp.go+++ b/backend/internal/util/testing/containers/sftp.go@@ -15,7 +15,20 @@ const (SftpUploadDir = "upload")-const sftpPort = "22/tcp"+const (+ sftpPort = "22/tcp"+ sftpStartupTimeout = 120 * time.Second+)++// The entrypoint generates host keys before it starts sshd, and the 4096-bit RSA key takes+// seconds. Docker's proxy accepts on the mapped port meanwhile, so a port check alone hands out+// a connection that is reset during the SSH handshake.+func sftpReady() wait.Strategy {+ return wait.ForAll(+ wait.ForLog("Server listening on 0.0.0.0 port 22").WithStartupTimeout(sftpStartupTimeout),+ wait.ForListeningPort(sftpPort).WithStartupTimeout(sftpStartupTimeout),+ )+}func StartSftp(t *testing.T) Endpoint {t.Helper()@@ -24,7 +37,7 @@ func StartSftp(t *testing.T) Endpoint {Image: "atmoz/sftp:latest",ExposedPorts: []string{sftpPort},Cmd: []string{SftpUsername + ":" + SftpPassword + ":1001::" + SftpUploadDir},- WaitingFor: wait.ForListeningPort(sftpPort).WithStartupTimeout(120 * time.Second),+ WaitingFor: sftpReady(),}return start(t, req, sftpPort)