From 61d998551ff486b9f1fa87d7604a66cc519d9fca Mon Sep 17 00:00:00 2001 From: Tomas Tormo Date: Wed, 28 Jun 2023 23:08:14 +0200 Subject: [PATCH] Add tests for ListEvent function --- modules/k8s/event_test.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/k8s/event_test.go b/modules/k8s/event_test.go index 3e5c8f0ac..55cdff7ec 100644 --- a/modules/k8s/event_test.go +++ b/modules/k8s/event_test.go @@ -18,7 +18,7 @@ import ( _ "k8s.io/client-go/plugin/pkg/client/auth" ) -func TestListEventsInNamespace(t *testing.T) { +func TestListEventsEReturnsNilErrorWhenListingEvents(t *testing.T) { t.Parallel() options := NewKubectlOptions("", "", "kube-system") @@ -27,6 +27,14 @@ func TestListEventsInNamespace(t *testing.T) { require.Greater(t, len(events), 0) } +func TestListEventsInNamespace(t *testing.T) { + t.Parallel() + + options := NewKubectlOptions("", "", "kube-system") + events := ListEvents(t, options, v1.ListOptions{}) + require.Greater(t, len(events), 0) +} + func TestListEventsReturnsZeroEventsIfNoneCreated(t *testing.T) { t.Parallel() ns := "test-ns" @@ -37,7 +45,6 @@ func TestListEventsReturnsZeroEventsIfNoneCreated(t *testing.T) { CreateNamespace(t, options, ns) options.Namespace = ns - events, err := ListEventsE(t, options, v1.ListOptions{}) - require.Nil(t, err) + events := ListEvents(t, options, v1.ListOptions{}) require.Equal(t, 0, len(events)) }