diff --git a/pkg/cache/application_state_test.go b/pkg/cache/application_state_test.go index 1247a4886..d16e3012c 100644 --- a/pkg/cache/application_state_test.go +++ b/pkg/cache/application_state_test.go @@ -21,6 +21,8 @@ package cache import ( "testing" + "gotest.tools/v3/assert" + "github.com/apache/yunikorn-scheduler-interface/lib/go/si" ) @@ -887,3 +889,20 @@ func TestNewResumingApplicationEvent(t *testing.T) { }) } } + +func TestApplicationEventsAsString(t *testing.T) { + assert.Equal(t, SubmitApplication.String(), "SubmitApplication") + assert.Equal(t, AcceptApplication.String(), "AcceptApplication") + assert.Equal(t, TryReserve.String(), "TryReserve") + assert.Equal(t, UpdateReservation.String(), "UpdateReservation") + assert.Equal(t, RunApplication.String(), "RunApplication") + assert.Equal(t, RejectApplication.String(), "RejectApplication") + assert.Equal(t, CompleteApplication.String(), "CompleteApplication") + assert.Equal(t, FailApplication.String(), "FailApplication") + assert.Equal(t, KillApplication.String(), "KillApplication") + assert.Equal(t, KilledApplication.String(), "KilledApplication") + assert.Equal(t, ReleaseAppAllocation.String(), "ReleaseAppAllocation") + assert.Equal(t, ReleaseAppAllocationAsk.String(), "ReleaseAppAllocationAsk") + assert.Equal(t, ResumingApplication.String(), "ResumingApplication") + assert.Equal(t, AppTaskCompleted.String(), "AppTaskCompleted") +} diff --git a/pkg/cache/task_state_test.go b/pkg/cache/task_state_test.go index 6e66cddea..bca7a2248 100644 --- a/pkg/cache/task_state_test.go +++ b/pkg/cache/task_state_test.go @@ -59,3 +59,15 @@ func TestGetAllocateTaskEventArgs(t *testing.T) { err = events.GetEventArgsAsStrings(nil, args) assert.Assert(t, err != nil) } + +func TestTaskEventsAsString(t *testing.T) { + assert.Equal(t, InitTask.String(), "InitTask") + assert.Equal(t, SubmitTask.String(), "SubmitTask") + assert.Equal(t, TaskAllocated.String(), "TaskAllocated") + assert.Equal(t, TaskRejected.String(), "TaskRejected") + assert.Equal(t, TaskBound.String(), "TaskBound") + assert.Equal(t, CompleteTask.String(), "CompleteTask") + assert.Equal(t, TaskFail.String(), "TaskFail") + assert.Equal(t, KillTask.String(), "KillTask") + assert.Equal(t, TaskKilled.String(), "TaskKilled") +}