diff --git a/pkg/util/k8sutil/events_test.go b/pkg/util/k8sutil/events_test.go new file mode 100644 index 000000000..b8513e15b --- /dev/null +++ b/pkg/util/k8sutil/events_test.go @@ -0,0 +1,44 @@ +package k8sutil + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type fakeAPIObject struct { + metav1.Object //getName dies + ownerRef metav1.OwnerReference +} + +func (o fakeAPIObject) AsOwner() metav1.OwnerReference { + return o.ownerRef +} + +func TestMemberAddEvent(t *testing.T) { + event := NewMemberAddEvent("member name", "role", fakeAPIObject{}) + assert.Equal(t, event.Type, v1.EventTypeNormal) +} + +//func TestMemberRemoveEvent(t *testing.T) { +// assert.True(t, false) +//} +// +//func TestPodGoneEvent(t *testing.T) { +// assert.True(t, false) +//} +// +//func TestImmutableFieldEvent(t *testing.T) { +// assert.True(t, false) +//} +// +//func TestErrorEvent(t *testing.T) { +// assert.True(t, false) +//} +// +//func TestDeploymentEvent(t *testing.T) { +// assert.True(t, false) +//}