From 3e7fdd0de969e78fadcd2abf2bf874dcb7953861 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Wed, 16 Oct 2024 17:10:13 +0200 Subject: [PATCH] improve wording of error message --- internal/command/test_test.go | 3 +-- internal/moduletest/eval_context.go | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/command/test_test.go b/internal/command/test_test.go index bf566e3f21..1fe5405382 100644 --- a/internal/command/test_test.go +++ b/internal/command/test_test.go @@ -272,8 +272,7 @@ func TestTest_Runs(t *testing.T) { }, "ephemeral_resource": { expectedOut: []string{"0 passed, 1 failed."}, - // TODO: Improve error message, say something about ephemeral resources not being accessible in tests due to their ephemeral nature - expectedErr: []string{"Ephemeral resource instance has expired", "Ephemeral resources not supported in the context of tests"}, + expectedErr: []string{"Ephemeral resource instance has expired", "Ephemeral resources cannot be asserted"}, code: 1, }, } diff --git a/internal/moduletest/eval_context.go b/internal/moduletest/eval_context.go index 01f081b136..672f1c4ee5 100644 --- a/internal/moduletest/eval_context.go +++ b/internal/moduletest/eval_context.go @@ -211,8 +211,8 @@ func diagsForEphemeralResources(refs []*addrs.Reference) (diags tfdiags.Diagnost if v.Resource.Mode == addrs.EphemeralResourceMode { diags = diags.Append(&hcl.Diagnostic{ Severity: hcl.DiagError, - Summary: "Ephemeral resources not supported in the context of tests", - Detail: "Ephemeral resources are not supported in the context of terraform test.", + Summary: "Ephemeral resources cannot be asserted", + Detail: "Ephemeral resources are closed when the test is finished, and are not available within the test context for assertions.", Subject: ref.SourceRange.ToHCL().Ptr(), }) }