From 5fa01d6ab5c26112f15baabafa20eb5cf420e174 Mon Sep 17 00:00:00 2001 From: Fraser Waters Date: Tue, 13 Dec 2022 00:31:46 +0000 Subject: [PATCH] Fix the eject test empty directory check --- pkg/tf2pulumi/convert/eject_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/tf2pulumi/convert/eject_test.go b/pkg/tf2pulumi/convert/eject_test.go index 2c00dee1a..55121babb 100644 --- a/pkg/tf2pulumi/convert/eject_test.go +++ b/pkg/tf2pulumi/convert/eject_test.go @@ -144,10 +144,13 @@ func TestEject(t *testing.T) { // Assert every pcl file is seen infos, err := os.ReadDir(pclPath) - if os.IsNotExist(err) || !assert.NoError(t, err) { - return + if !os.IsNotExist(err) && !assert.NoError(t, err) { + // If the directory was not found then the expected pcl results are the empty set, but if the + // directory could not be read because of filesystem issues than just error out. + assert.FailNow(t, "Could not read expected pcl results") } pclFiles := make(map[string]interface{}) + // infos will just be nil if pclPath did not exist for _, info := range infos { if !info.IsDir() { pclFiles[info.Name()] = nil