From 6d2dfb0679744f523c88ca36366f2cb4a4e9fb71 Mon Sep 17 00:00:00 2001 From: Lucas Bajolet Date: Thu, 28 Sep 2023 11:21:36 -0400 Subject: [PATCH] hcl2template: don't error if test wants diags The required_plugins parse tests define a `want_diags' flag, but don't actually use it in subtests, so if one was to add a test that is expected to produce errors on this step, this would always fail. --- hcl2template/types.required_plugins_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hcl2template/types.required_plugins_test.go b/hcl2template/types.required_plugins_test.go index 0329d1505..cc77e3cb9 100644 --- a/hcl2template/types.required_plugins_test.go +++ b/hcl2template/types.required_plugins_test.go @@ -138,7 +138,9 @@ func TestPackerConfig_required_plugin_parse(t *testing.T) { if len(diags) > 0 { t.Fatal(diags) } - if diags := cfg.decodeRequiredPluginsBlock(file); len(diags) > 0 { + + diags = cfg.decodeRequiredPluginsBlock(file) + if !tt.wantDiags && len(diags) > 0 { t.Fatal(diags) }