Files
k8s-cilium-node-label/internal/informer_test.go

36 lines
712 B
Go

package internal
import (
"testing"
coordv1 "k8s.io/api/coordination/v1"
)
func TestHandleLease_DryRun(t *testing.T) {
l := &coordv1.Lease{}
l.Name = "cilium-l2announce-abc"
hi := "xx-yy-node-a"
l.Spec.HolderIdentity = &hi
cfg := &Config{CiliumLabel: "lbl", DryRun: true}
handleLease(l, cfg)
}
func TestHandleLease_NonCilium(t *testing.T) {
l := &coordv1.Lease{}
l.Name = "other-lease"
hi := "xx-yy-node-a"
l.Spec.HolderIdentity = &hi
cfg := &Config{CiliumLabel: "lbl", DryRun: true}
handleLease(l, cfg)
}
func TestHandleLease_NoHolderIdentity(t *testing.T) {
l := &coordv1.Lease{}
l.Name = "cilium-l2announce-123"
cfg := &Config{CiliumLabel: "lbl", DryRun: true}
handleLease(l, cfg)
}