From 7e14061bcc84da7c4a01c4fd25f5cc04dd2fbb4c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 1 Jan 2025 21:16:47 +0000 Subject: [PATCH] Renovate: Update github.com/sapcc/go-bits digest to 7169321 (#638) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 +-- .../sapcc/go-bits/easypg/testsetup.go | 26 +++++++++++++++---- vendor/modules.txt | 2 +- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index e1b1146e..d888a882 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/prometheus/common v0.61.0 github.com/rs/cors v1.11.1 github.com/sapcc/go-api-declarations v1.13.2 - github.com/sapcc/go-bits v0.0.0-20241213102058-cb5d877d1274 + github.com/sapcc/go-bits v0.0.0-20250101161453-7169321dc311 go.uber.org/automaxprocs v1.6.0 gopkg.in/yaml.v2 v2.4.0 ) diff --git a/go.sum b/go.sum index 6cd3024e..9be8bd86 100644 --- a/go.sum +++ b/go.sum @@ -159,8 +159,8 @@ github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/sapcc/go-api-declarations v1.13.2 h1:dPYYsjwKGObSAm6+K+dYCiLQWunYuWkywlZnuXfjsmk= github.com/sapcc/go-api-declarations v1.13.2/go.mod h1:83R3hTANhuRXt/pXDby37IJetw8l7DG41s33Tp9NXxI= -github.com/sapcc/go-bits v0.0.0-20241213102058-cb5d877d1274 h1:ja3KsSLFDrjtPLqFt6qnPMxMnTuseP5+JpP0IshJSe4= -github.com/sapcc/go-bits v0.0.0-20241213102058-cb5d877d1274/go.mod h1:hhH7PgcPklzzJdx1zMhv3KiMEnoCZV+pnapPRcgI7wk= +github.com/sapcc/go-bits v0.0.0-20250101161453-7169321dc311 h1:V55251w5oFB40UBoT13nDY00sDfwMEu0THgUYlooad0= +github.com/sapcc/go-bits v0.0.0-20250101161453-7169321dc311/go.mod h1:O90mzPqtXgvzkPHFEzO0p3XTknccPxZQH5w1fAd20pM= github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= diff --git a/vendor/github.com/sapcc/go-bits/easypg/testsetup.go b/vendor/github.com/sapcc/go-bits/easypg/testsetup.go index c47a0c41..d43d658b 100644 --- a/vendor/github.com/sapcc/go-bits/easypg/testsetup.go +++ b/vendor/github.com/sapcc/go-bits/easypg/testsetup.go @@ -95,6 +95,14 @@ func WithTestDB(m *testing.M, action func() int) int { } } + // check if a previous connection is still lingering + if _, err := os.Stat(filepath.Join(rootPath, ".testdb/run/pid")); err == nil { + err := stopDatabaseServer(rootPath) + if err != nil { + logg.Error(err.Error()) + } + } + // drop helper scripts that can be used to attach to the test DB for manual debugging and inspection for _, clientTool := range []string{"psql", "pgcli", "pg_dump"} { path := filepath.Join(rootPath, ".testdb", clientTool+".sh") @@ -121,18 +129,26 @@ func WithTestDB(m *testing.M, action func() int) int { hasTestDB = false // stop database process (regardless of whether tests succeeded or failed!) - cmd = exec.Command("pg_ctl", "stop", "--wait", "--silent", //nolint:gosec // rule G204 is overly broad + err = stopDatabaseServer(rootPath) + if err != nil { + logg.Fatal(err.Error()) + } + + return exitCode +} + +func stopDatabaseServer(rootPath string) error { + cmd := exec.Command("pg_ctl", "stop", "--wait", "--silent", //nolint:gosec // rule G204 is overly broad "-D", filepath.Join(rootPath, ".testdb/datadir"), ) cmd.Stdin = nil cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr - err = cmd.Run() + err := cmd.Run() if err != nil { - logg.Fatal("could not run pg_ctl stop: %s", err.Error()) + return fmt.Errorf("could not run pg_ctl stop: %w", err) } - - return exitCode + return nil } func findRepositoryRootDir() (string, error) { diff --git a/vendor/modules.txt b/vendor/modules.txt index e72088b3..14b8fdba 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -150,7 +150,7 @@ github.com/sapcc/go-api-declarations/limes github.com/sapcc/go-api-declarations/limes/rates github.com/sapcc/go-api-declarations/limes/resources github.com/sapcc/go-api-declarations/liquid -# github.com/sapcc/go-bits v0.0.0-20241213102058-cb5d877d1274 +# github.com/sapcc/go-bits v0.0.0-20250101161453-7169321dc311 ## explicit; go 1.23 github.com/sapcc/go-bits/assert github.com/sapcc/go-bits/audittools