feat(): increased test coverage and added simple workflow to build OCI image
This commit is contained in:
35
internal/informer_test.go
Normal file
35
internal/informer_test.go
Normal file
@@ -0,0 +1,35 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user