Skip to content

Commit

Permalink
Add tests for ListEvent function
Browse files Browse the repository at this point in the history
  • Loading branch information
kaisoz committed Jun 28, 2023
1 parent 4a22239 commit 61d9985
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions modules/k8s/event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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"
Expand All @@ -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))
}

0 comments on commit 61d9985

Please sign in to comment.