yangwwei commented on a change in pull request #203:
URL: 
https://github.com/apache/incubator-yunikorn-k8shim/pull/203#discussion_r514615489



##########
File path: pkg/cache/application_test.go
##########
@@ -181,19 +190,192 @@ func TestGetNonTerminatedTaskAlias(t *testing.T) {
        assert.Assert(t, is.Contains(res, "/test-00001"))
        assert.Assert(t, is.Contains(res, "/test-00002"))
 
-       //set two tasks to terminated states
+       // set two tasks to terminated states
        task1.sm.SetState(events.States().Task.Rejected)
        task2.sm.SetState(events.States().Task.Rejected)
        // check the tasks both in terminated states
        // res should retuen empty
        res = app.getNonTerminatedTaskAlias()
        assert.Equal(t, len(res), 0)
 
-       //set two tasks to one is terminated, another is non-terminated
+       // set two tasks to one is terminated, another is non-terminated
        task1.sm.SetState(events.States().Task.Rejected)
        task2.sm.SetState(events.States().Task.Allocated)
        // check the task, should only return task2's alias
        res = app.getNonTerminatedTaskAlias()
        assert.Equal(t, len(res), 1)
        assert.Equal(t, res[0], "/test-00002")
 }
+
+func TestSetTaskGroupsAndSchedulingPolicy(t *testing.T) {
+       app := NewApplication("app01", "root.a", "test-user", 
map[string]string{}, newMockSchedulerAPI())
+       assert.Assert(t, app.getSchedulingPolicy() == nil)
+       assert.Assert(t, app.getTaskGroups() == nil)
+
+       app.setSchedulingPolicy(&v1alpha1.SchedulingPolicy{
+               Type: v1alpha1.TryReserve,
+               Parameters: map[string]string{
+                       "option-1": "value-1",
+                       "option-2": "value-2",
+               },
+       })
+
+       assert.Equal(t, app.getSchedulingPolicy().Type, v1alpha1.TryReserve)
+       assert.Equal(t, len(app.getSchedulingPolicy().Parameters), 2)
+       assert.Equal(t, app.getSchedulingPolicy().Parameters["option-1"], 
"value-1")
+       assert.Equal(t, app.getSchedulingPolicy().Parameters["option-2"], 
"value-2")

Review comment:
       done




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to