File: consumers_test.go

package info (click to toggle)
golang-github-streadway-amqp 0.0~git20200716.e6b33f4-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 560 kB
  • sloc: xml: 495; sh: 180; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 522 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package amqp

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