예제 #1
0
func TestAssignResourcesToActors_EmptyJobQueues(t *testing.T) {
	jobs := zk.ResourceList([]string{})
	actors := zk.ActorList([]string{"1", "2"})

	decision := assignResourcesToActors(actors, jobs)
	t.Logf("%+v", decision)
}
예제 #2
0
func TestAssignResourcesToActors_Normal(t *testing.T) {
	jobs := zk.ResourceList([]string{"a", "b", "c", "d", "e"})
	actors := zk.ActorList([]string{"1", "2"})

	decision := assignResourcesToActors(actors, jobs)
	t.Logf("%+v", decision)
	assert.Equal(t, 3, len(decision["1"]))
	assert.Equal(t, 2, len(decision["2"]))
}
예제 #3
0
func TestAssignResourcesToActors_ActorMoreThanJobQueues(t *testing.T) {
	jobs := zk.ResourceList([]string{"job1"})
	actors := zk.ActorList([]string{"1", "2"})

	decision := assignResourcesToActors(actors, jobs)
	t.Logf("%+v", decision)
	assert.Equal(t, 0, len(decision["2"]))
	assert.Equal(t, 1, len(decision["1"]))
}