forked from rabbitmq/amqp091-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconsumers_test.go
More file actions
25 lines (21 loc) · 764 Bytes
/
Copy pathconsumers_test.go
File metadata and controls
25 lines (21 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright (c) 2021 VMware, Inc. or its affiliates. All Rights Reserved.
// Copyright (c) 2012-2021, Sean Treadway, SoundCloud Ltd.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package amqp091
import (
"strings"
"testing"
)
func TestGeneratedUniqueConsumerTagDoesNotExceedMaxLength(t *testing.T) {
assertCorrectLength := func(commandName string) {
tag := commandNameBasedUniqueConsumerTag(commandName)
if len(tag) > consumerTagLengthMax {
t.Error("Generated unique consumer tag exceeds maximum length:", tag)
}
}
assertCorrectLength("test")
assertCorrectLength(strings.Repeat("z", 249))
assertCorrectLength(strings.Repeat("z", 256))
assertCorrectLength(strings.Repeat("z", 1024))
}