From 41e0d3a7df9e3b55a83b6286206e6f4ebaa05936 Mon Sep 17 00:00:00 2001 From: Zhou Hao Date: Mon, 24 Feb 2020 10:53:45 +0800 Subject: [PATCH] pkg/storage: add unit test for keys Signed-off-by: Zhou Hao --- pkg/storage/driver/labels_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/storage/driver/labels_test.go b/pkg/storage/driver/labels_test.go index bfd80911b..636d12176 100644 --- a/pkg/storage/driver/labels_test.go +++ b/pkg/storage/driver/labels_test.go @@ -17,6 +17,8 @@ limitations under the License. package driver // import "helm.sh/helm/v3/pkg/storage/driver" import ( + "reflect" + "sort" "testing" ) @@ -47,3 +49,14 @@ func TestLabelsMatch(t *testing.T) { } } } + +func TestLabelsKeys(t *testing.T) { + var test = labels(map[string]string{"KEY_A": "VAL_A", "KEY_B": "VAL_B"}) + var expect = []string{"KEY_A", "KEY_B"} + + result := test.keys() + sort.Strings(result) + if !reflect.DeepEqual(expect, result) { + t.Fatalf("Expected %v, got %v", expect, result) + } +}