pbacsko commented on code in PR #579:
URL: https://github.com/apache/yunikorn-core/pull/579#discussion_r1276098617


##########
pkg/events/event_system_test.go:
##########
@@ -116,3 +117,37 @@ func TestGetEvents(t *testing.T) {
        assert.Equal(t, "4", records[1].Message)
        assert.Equal(t, "5", records[2].Message)
 }
+
+func TestConfigUpdate(t *testing.T) {
+       configs.SetConfigMap(map[string]string{configs.CMEventTrackingEnabled: 
"true"})
+       configs.SetConfigMap(map[string]string{})
+       defer configs.SetConfigMap(map[string]string{})
+
+       CreateAndSetEventSystem()
+       eventSystem := GetEventSystem().(*EventSystemImpl) //nolint:errcheck
+       eventSystem.StartService()
+       defer eventSystem.Stop()
+
+       assert.Assert(t, eventSystem.IsEventTrackingEnabled(), "Event tracking 
should be enabled by default")
+       assert.Assert(t, eventSystem.GetRingBufferCapacity() == 
configs.DefaultEventRingBufferCapacity, "Invalid event buffer capacity")
+       assert.Assert(t, eventSystem.GetRequestCapacity() == 
configs.DefaultEventRequestCapacity, "Invalid request capacity")
+       assert.Assert(t, eventSystem.eventBuffer.capacity == 
configs.DefaultEventRingBufferCapacity, "Event buffer capacity mismatch")
+
+       // update config and wait for refresh
+       var newRingBufferCapacity uint64 = 123
+       newRequestCapacity := 555
+
+       configs.SetConfigMap(
+               map[string]string{configs.CMEventTrackingEnabled: "false",
+                       configs.CMEventRingBufferCapacity: 
strconv.FormatUint(newRingBufferCapacity, 10),
+                       configs.CMEventRequestCapacity:    
strconv.Itoa(int(newRequestCapacity)),
+               })
+       err := common.WaitForCondition(func() bool {
+               return eventSystem.IsEventTrackingEnabled() == false

Review Comment:
   Nit: `!eventSystem.IsEventTrackingEnabled()`



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