From d5ad1f078a22bad46afd930a2f952e29b3bb4f63 Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Wed, 24 May 2023 15:37:22 -0400 Subject: [PATCH] Fix test timing (#3241) --- internal/daemon/worker/testing.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/daemon/worker/testing.go b/internal/daemon/worker/testing.go index 49f73872f4..2ef891a951 100644 --- a/internal/daemon/worker/testing.go +++ b/internal/daemon/worker/testing.go @@ -445,6 +445,10 @@ func NewTestMultihopWorkers(t testing.TB, WorkerAuthDebuggingEnabled: enableAuthDebugging, DownstreamWorkerAuthKms: childDownstreamWrapper, }) + t.Cleanup(kmsWorker.Shutdown) + + // Give time for it to be inserted into the database + time.Sleep(2 * time.Second) // names should not be set when using pki workers pkiWorkerConf, err := config.DevWorker() @@ -497,6 +501,7 @@ func NewTestMultihopWorkers(t testing.TB, Config: childPkiWorkerConf, WorkerAuthDebuggingEnabled: enableAuthDebugging, }) + t.Cleanup(childPkiWorker.Shutdown) // Give time for it to be inserted into the database time.Sleep(2 * time.Second) @@ -532,9 +537,10 @@ func NewTestMultihopWorkers(t testing.TB, WorkerAuthKms: childDownstreamWrapper2, WorkerAuthDebuggingEnabled: enableAuthDebugging, }) + t.Cleanup(childKmsWorker.Shutdown) // Sleep so that workers can startup and connect. - time.Sleep(10 * time.Second) + time.Sleep(12 * time.Second) return kmsWorker, pkiWorker, childPkiWorker, childKmsWorker }