From 0b39c1757cd191b27513e91967e10134d2b66f93 Mon Sep 17 00:00:00 2001 From: Lee Hicks Date: Thu, 4 Feb 2021 22:39:45 +0000 Subject: [PATCH] Fix CW log group persisting after tf destroy --- test/terraform_aws_sleuth_simple_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/terraform_aws_sleuth_simple_test.go b/test/terraform_aws_sleuth_simple_test.go index 20e3fe50..2e854727 100644 --- a/test/terraform_aws_sleuth_simple_test.go +++ b/test/terraform_aws_sleuth_simple_test.go @@ -48,6 +48,10 @@ func TestTerraformSimpleSanityCheck(t *testing.T) { // lets try to invoke the lambda to ensure proper setup _, err := aws.InvokeFunctionE(t, awsRegion, "iam-sleuth-test", FunctionPayload{ShouldFail: false, Echo: "hi!"}) + // Sleep here to let all the lambda logs in flight write to log group. + // Failing to sleep here will recreate the log group after tf destroy + time.Sleep(60 * time.Second) + // Function-specific errors have their own special return, should be nil functionError, ok := err.(*aws.FunctionError) require.False(t, ok)