0
0
Fork 0
mirror of https://github.com/strukturag/nextcloud-spreed-signaling.git synced 2025-04-17 16:52:32 +00:00

Don't redefine built-in id "max".

This commit is contained in:
Joachim Bauch 2024-11-11 10:20:34 +01:00
parent 119b1ff39d
commit c642319514
No known key found for this signature in database
GPG key ID: 77C1D22D53E15F02

View file

@ -64,7 +64,7 @@ func testNatsClient_Subscribe(t *testing.T, client NatsClient) {
ch := make(chan struct{}) ch := make(chan struct{})
var received atomic.Int32 var received atomic.Int32
max := int32(20) maxPublish := int32(20)
ready := make(chan struct{}) ready := make(chan struct{})
quit := make(chan struct{}) quit := make(chan struct{})
defer close(quit) defer close(quit)
@ -74,7 +74,7 @@ func testNatsClient_Subscribe(t *testing.T, client NatsClient) {
select { select {
case <-dest: case <-dest:
total := received.Add(1) total := received.Add(1)
if total == max { if total == maxPublish {
if err := sub.Unsubscribe(); !assert.NoError(err) { if err := sub.Unsubscribe(); !assert.NoError(err) {
return return
} }
@ -86,7 +86,7 @@ func testNatsClient_Subscribe(t *testing.T, client NatsClient) {
} }
}() }()
<-ready <-ready
for i := int32(0); i < max; i++ { for i := int32(0); i < maxPublish; i++ {
assert.NoError(client.Publish("foo", []byte("hello"))) assert.NoError(client.Publish("foo", []byte("hello")))
// Allow NATS goroutines to process messages. // Allow NATS goroutines to process messages.
@ -94,7 +94,7 @@ func testNatsClient_Subscribe(t *testing.T, client NatsClient) {
} }
<-ch <-ch
require.EqualValues(max, received.Load(), "Received wrong # of messages") require.EqualValues(maxPublish, received.Load(), "Received wrong # of messages")
} }
func TestNatsClient_Subscribe(t *testing.T) { func TestNatsClient_Subscribe(t *testing.T) {