fix: Move timeout ctx closer to use in tests, increase timeout (#3109)

Some contexts were moved closer to use so that test setup doesn't affect
timeout. And timeout was increased for some others to avoid flakyness
due to slow test runners.
This commit is contained in:
Mathias Fredriksson
2022-07-22 17:42:09 +03:00
committed by GitHub
parent e874d538fb
commit ef7d357e19
3 changed files with 9 additions and 7 deletions

View File

@ -27,8 +27,6 @@ func TestProvisionerJobLogs_Unit(t *testing.T) {
t.Parallel()
t.Run("QueryPubSubDupes", func(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
t.Cleanup(cancel)
logger := slogtest.Make(t, nil).Leveled(slog.LevelDebug)
// mDB := mocks.NewStore(t)
fDB := databasefake.New()
@ -65,6 +63,9 @@ func TestProvisionerJobLogs_Unit(t *testing.T) {
{ID: uuid.New(), JobID: jobID, Stage: "Stage3"},
}
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
// wow there are a lot of DB rows we touch...
_, err = fDB.InsertAPIKey(ctx, database.InsertAPIKeyParams{
ID: keyID,