From 3ce9e517aedf2fdee6ac047d1a1c1be66d7cc9c2 Mon Sep 17 00:00:00 2001 From: Liam Cervante Date: Wed, 17 Jul 2024 13:10:11 +0200 Subject: [PATCH] fix flaky test in views package (#35469) --- internal/command/views/hook_json_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/command/views/hook_json_test.go b/internal/command/views/hook_json_test.go index c8d98c0e90..ed026cde30 100644 --- a/internal/command/views/hook_json_test.go +++ b/internal/command/views/hook_json_test.go @@ -9,11 +9,12 @@ import ( "testing" "time" + "github.com/zclconf/go-cty/cty" + "github.com/hashicorp/terraform/internal/addrs" "github.com/hashicorp/terraform/internal/plans" "github.com/hashicorp/terraform/internal/terminal" "github.com/hashicorp/terraform/internal/terraform" - "github.com/zclconf/go-cty/cty" ) func testJSONHookResourceID(addr addrs.AbsResourceInstance) terraform.HookResourceIdentity { @@ -76,7 +77,7 @@ func TestJSONHook_create(t *testing.T) { now = now.Add(10 * time.Second) after <- now nowMu.Unlock() - time.Sleep(1 * time.Millisecond) + time.Sleep(10 * time.Millisecond) // Travel 10s into the future, notify the progress goroutine, and sleep // briefly to allow it to execute @@ -84,7 +85,7 @@ func TestJSONHook_create(t *testing.T) { now = now.Add(10 * time.Second) after <- now nowMu.Unlock() - time.Sleep(1 * time.Millisecond) + time.Sleep(10 * time.Millisecond) // Travel 2s into the future. We have arrived! nowMu.Lock()