lixmgl commented on code in PR #581:
URL: https://github.com/apache/yunikorn-core/pull/581#discussion_r1266230073


##########
pkg/scheduler/objects/application_test.go:
##########
@@ -1990,17 +1980,16 @@ func TestAskEvents(t *testing.T) {
        noEvents := 0
        err = common.WaitFor(10*time.Millisecond, time.Second, func() bool {
                noEvents = eventSystem.Store.CountStoredEvents()
-               return noEvents == 2
+               return noEvents == 5
        })
-       assert.NilError(t, err, "expected 2 events, got %d", noEvents)
+       assert.NilError(t, err, "expected 5 events, got %d", noEvents)
        records := eventSystem.Store.CollectEvents()
-       assert.Equal(t, 2, len(records), "number of events")
-       assert.Equal(t, si.EventRecord_APP, records[0].Type)
-       assert.Equal(t, si.EventRecord_ADD, records[0].EventChangeType)
-       assert.Equal(t, si.EventRecord_APP_REQUEST, 
records[0].EventChangeDetail)
-       assert.Equal(t, si.EventRecord_APP, records[1].Type)
-       assert.Equal(t, si.EventRecord_REMOVE, records[1].EventChangeType)
-       assert.Equal(t, si.EventRecord_REQUEST_CANCEL, 
records[1].EventChangeDetail)
+       assert.Equal(t, 5, len(records), "number of events")
+       isNewApplicationEvent(t, app, records[0])
+       isStateChangeEvent(t, app, si.EventRecord_APP_ACCEPTED, records[1])
+       isNewAllocAskEvent(t, ask, records[2])
+       isAllocCancelEvent(t, ask, records[3])
+       isStateChangeEvent(t, app, si.EventRecord_APP_COMPLETING, records[4])

Review Comment:
   That's a good idea. But it seems disabling the state transits in test will 
break some of the existing tests. Instead, I added a bool to enable/disable 
sending app state event which we can use to disabling state change event in 
test. Thanks.



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to