Skip to content

Commit

Permalink
Code review
Browse files Browse the repository at this point in the history
  • Loading branch information
pbacsko committed May 3, 2024
1 parent e8cf3fd commit 32559be
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pkg/cache/application_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ package cache
import (
"testing"

"gotest.tools/v3/assert"

"github.com/apache/yunikorn-scheduler-interface/lib/go/si"
)

Expand Down Expand Up @@ -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")
}
12 changes: 12 additions & 0 deletions pkg/cache/task_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

0 comments on commit 32559be

Please sign in to comment.