Skip to content

Commit

Permalink
Removing the cleanup step again as it's causing DB deadlocks by runni…
Browse files Browse the repository at this point in the history
…ng over other tests. Creating followup ticket.
  • Loading branch information
alexcottner committed Dec 11, 2024
1 parent 080344d commit a5ea75f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
6 changes: 1 addition & 5 deletions database/queries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -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 {
Expand Down
12 changes: 0 additions & 12 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"testing"
"time"

"github.com/mozilla-services/autograph/database"
log "github.com/sirupsen/logrus"
)

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a5ea75f

Please sign in to comment.