From a5ea75f5450b47c66d543636fdd66d93206d239b Mon Sep 17 00:00:00 2001 From: Alex Cottner Date: Wed, 11 Dec 2024 08:25:12 -0700 Subject: [PATCH] Removing the cleanup step again as it's causing DB deadlocks by running over other tests. Creating followup ticket. --- database/queries_test.go | 6 +----- main_test.go | 12 ------------ 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/database/queries_test.go b/database/queries_test.go index 6c95256b6..49502352e 100644 --- a/database/queries_test.go +++ b/database/queries_test.go @@ -28,7 +28,7 @@ func TestConcurrentEndEntityOperations(t *testing.T) { defer db.Close() var wg sync.WaitGroup - concurrency := 273 // took a long time to pick that number! + concurrency := 373 // took a long time to pick that number! wg.Add(concurrency) signerID := fmt.Sprintf("database_unit_testing_%d", time.Now().UnixNano()) labelsSyncMap := sync.Map{} @@ -57,10 +57,6 @@ func TestConcurrentEndEntityOperations(t *testing.T) { func waitAndMakeEE(j int, db *Handler, wg *sync.WaitGroup, t *testing.T, signerID string) string { defer wg.Done() t.Logf("TestConcurrentEndEntityOperations: starting routine %d", j) - // sleep for 5 seconds to wait for test cleanup and for all jobs to run together - nextTime := time.Now().Truncate(5 * time.Second) - nextTime = nextTime.Add(10 * time.Second) - time.Sleep(time.Until(nextTime)) label, _, err := db.GetLabelOfLatestEE(signerID, 15*time.Second) switch err { diff --git a/main_test.go b/main_test.go index 460b0c8b5..ab4a3e2a9 100644 --- a/main_test.go +++ b/main_test.go @@ -12,7 +12,6 @@ import ( "testing" "time" - "github.com/mozilla-services/autograph/database" log "github.com/sirupsen/logrus" ) @@ -52,17 +51,6 @@ func newTestAutographer(t *testing.T) (*autographer, configuration) { t.Cleanup(func() { close(ag.exit) - host := database.GetTestDBHost() - db, err := database.Connect(database.Config{ - Name: "autograph", - User: "myautographdbuser", - Password: "myautographdbpassword", - Host: host + ":5432", - MonitorPollInterval: 10 * time.Second, - }) - if err == nil { - db.Exec("truncate table endentities;") - } }) return ag, conf