From af9b7671fb718d48e38091055a4f1c1a6c95e36e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 1 Jan 2025 22:40:23 +0000 Subject: [PATCH] Renovate: Update github.com/sapcc (#309) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- go.mod | 4 +-- go.sum | 8 +++--- .../sapcc/go-bits/easypg/testsetup.go | 26 +++++++++++++++---- vendor/modules.txt | 4 +-- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index 007210ae..9f70f90a 100644 --- a/go.mod +++ b/go.mod @@ -10,8 +10,8 @@ require ( github.com/prometheus/client_golang v1.20.5 github.com/prometheus/common v0.61.0 github.com/rs/cors v1.11.1 - github.com/sapcc/go-api-declarations v1.13.1 - github.com/sapcc/go-bits v0.0.0-20241212142854-05ca4ed3590b + github.com/sapcc/go-api-declarations v1.13.2 + 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 4e216f82..094f49c9 100644 --- a/go.sum +++ b/go.sum @@ -153,10 +153,10 @@ github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= 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.1 h1:rovCnLscnoZaIZPWhohSYHzwwYjOnCPsRw3zwtu4tLI= -github.com/sapcc/go-api-declarations v1.13.1/go.mod h1:83R3hTANhuRXt/pXDby37IJetw8l7DG41s33Tp9NXxI= -github.com/sapcc/go-bits v0.0.0-20241212142854-05ca4ed3590b h1:cM4EQms/mIYmB9/ZhxsbVHpINlDBAAf/PZ/ymXiiLXo= -github.com/sapcc/go-bits v0.0.0-20241212142854-05ca4ed3590b/go.mod h1:DrcK3N8lISMoxhS+e3pnrSyRZl83OGyNJdohpk9hjHo= +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-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 e15a6983..a970a760 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -116,12 +116,12 @@ github.com/rabbitmq/amqp091-go ## explicit; go 1.13 github.com/rs/cors github.com/rs/cors/internal -# github.com/sapcc/go-api-declarations v1.13.1 +# github.com/sapcc/go-api-declarations v1.13.2 ## explicit; go 1.21 github.com/sapcc/go-api-declarations/bininfo github.com/sapcc/go-api-declarations/cadf github.com/sapcc/go-api-declarations/castellum -# github.com/sapcc/go-bits v0.0.0-20241212142854-05ca4ed3590b +# 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