From e6266d4559d5e19870506af4085fc14b552d6dd4 Mon Sep 17 00:00:00 2001 From: isarns Date: Mon, 9 Sep 2024 13:26:33 +0300 Subject: [PATCH] refactor: fix test with not 'items:' --- api/resource/factory_test.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/api/resource/factory_test.go b/api/resource/factory_test.go index 8695ab036..953caa7dd 100644 --- a/api/resource/factory_test.go +++ b/api/resource/factory_test.go @@ -301,6 +301,17 @@ kind: List t.Fatalf("failed to create new instance with %v: %v", deploymentB, errB) } + deploymentNoItems := "deployment-no-items" + testDeploymentNoItems, errNoItems := factory.FromMap( + map[string]interface{}{ + "apiVersion": "v1", + "kind": "List", + }, + ) + if errNoItems != nil { + t.Fatalf("failed to create new instance with %v: %v", deploymentNoItems, testDeploymentNoItems) + } + fSys := filesys.MakeFsInMemory() fSys.WriteFile(string(patchGood1), []byte(patch1)) fSys.WriteFile(string(patchGood2), []byte(patch2)) @@ -363,7 +374,7 @@ kind: List }, "listWithNoItems": { input: []types.PatchStrategicMerge{patchList4}, - expectedOut: []*Resource{}, + expectedOut: []*Resource{testDeploymentNoItems}, expectedErr: false, }, }