Skip to content

Commit

Permalink
getAttrInfo race test
Browse files Browse the repository at this point in the history
  • Loading branch information
kalmant committed Nov 3, 2023
1 parent b349c31 commit 3220b2d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ibmmq/ibmmq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,22 @@ func TestNewMQDLHWithMQMD(t *testing.T) {
t.Fail()
}
}

func TestGetAttrInfoConcurrentCalls(t *testing.T) {
// NOTE: This test should be run with `go test -race`.
attrs := []int32{
MQCA_BACKOUT_REQ_Q_NAME,
MQIA_BACKOUT_THRESHOLD,
}
count := 1_000
doneCh := make(chan struct{}, count)
for i := 0; i < count; i++ {
go func() {
getAttrInfo(attrs)
doneCh <- struct{}{}
}()
}
for i := 0; i < count; i++ {
<-doneCh
}
}

0 comments on commit 3220b2d

Please sign in to comment.