From 7319114cddaf811662cd8795beda06197e4bb00b Mon Sep 17 00:00:00 2001 From: Mengjiao Liu Date: Tue, 21 Dec 2021 17:33:02 +0800 Subject: [PATCH] Improve test coverage: pkg/api/persistentvolume --- pkg/api/persistentvolume/util_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/api/persistentvolume/util_test.go b/pkg/api/persistentvolume/util_test.go index f44b3235764e..d23d047a77ee 100644 --- a/pkg/api/persistentvolume/util_test.go +++ b/pkg/api/persistentvolume/util_test.go @@ -76,6 +76,13 @@ func TestDropDisabledFields(t *testing.T) { oldSpec: specWithCSISecrets(nil), expectOldSpec: specWithCSISecrets(nil), }, + "disabled csi expansion clears secrets when old pv did not had secrets": { + csiExpansionEnabled: false, + newSpec: specWithCSISecrets(secretRef), + expectNewSpec: specWithCSISecrets(nil), + oldSpec: specWithCSISecrets(nil), + expectOldSpec: specWithCSISecrets(nil), + }, } for name, tc := range tests {