adamantal commented on a change in pull request #96: [YUNIKORN-72] data race in
unit test: TestTaskStateTransitions
URL:
https://github.com/apache/incubator-yunikorn-k8shim/pull/96#discussion_r403921396
##########
File path: pkg/conf/schedulerconf_test.go
##########
@@ -37,3 +39,34 @@ func TestDefaultValues(t *testing.T) {
assert.Equal(t, conf.KubeBurst, DefaultKubeBurst)
assert.Equal(t, conf.Predicates, "")
}
+
+// run some concurrent write/read
+// if the Get and Set function is not thread safe,
+// this will give data race warnings when running with -race flag
+func TestConcurrency(t *testing.T) {
+ wg := sync.WaitGroup{}
+
+ wg.Add(1)
+ go func() {
+ for i := 0; i < 10; i++ {
Review comment:
Can you move the `10` to a constant and use it here and above in the other
goroutine?
----------------------------------------------------------------
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]
With regards,
Apache Git Services