From bbb0b08576e4a256f21f81d5f927786e4a47acd1 Mon Sep 17 00:00:00 2001 From: isarns Date: Sun, 18 Aug 2024 14:56:54 +0300 Subject: [PATCH] test: add empty list test --- api/krusty/no_list_items_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/api/krusty/no_list_items_test.go b/api/krusty/no_list_items_test.go index b6cc58742..49092b0bd 100644 --- a/api/krusty/no_list_items_test.go +++ b/api/krusty/no_list_items_test.go @@ -211,4 +211,20 @@ spec: ports: - containerPort: 80 `) +} + +// Empty list should result in no resources +func TestEmptyList(t *testing.T) { + th := kusttest_test.MakeHarness(t) + th.WriteK(".", ` +resources: +- emptyList.yaml +`) + th.WriteF("emptyList.yaml", ` +apiVersion: v1 +kind: PodList +items: [] +`) + m := th.Run(".", th.MakeDefaultOptions()) + th.AssertActualEqualsExpected(m, "") } \ No newline at end of file