...
1 package meta
2
3 import (
4 "testing"
5
6 v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
7
8 "edge-infra.dev/pkg/f8n/warehouse/pallet"
9 )
10
11 func TestIsFromPallet(t *testing.T) {
12 is := IsFromPallet(v1.ObjectMeta{Annotations: map[string]string{
13 pallet.KnnotationName: "shoot",
14 pallet.KnnotationTeam: "ncrvoyix-swt-retail/edge-data-sync",
15 pallet.KnnotationVersion: "0.3.8",
16 pallet.KnnotationRevision: "c018301aldk2",
17 }})
18 if !is {
19 t.Errorf(
20 "returned false when required annotations were present: %v",
21 []string{pallet.KnnotationTeam, pallet.KnnotationName,
22 pallet.KnnotationRevision, pallet.KnnotationVersion},
23 )
24 }
25
26 isnt := IsFromPallet(v1.ObjectMeta{Annotations: map[string]string{}})
27 if isnt {
28 t.Error("empty annotations in object meta returned true")
29 }
30 }
31
View as plain text