MCPcopy Create free account
hub / github.com/cloudtty/cloudtty / TestTruncateAndHashIfExceed

Function TestTruncateAndHashIfExceed

pkg/controllers/utils_test.go:7–32  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

5)
6
7func TestTruncateAndHashIfExceed(t *testing.T) {
8 tests := []struct {
9 input string
10 expected string
11 }{
12 {
13 input: "short-pod-name",
14 expected: "short-pod-name",
15 },
16 {
17 input: "pod-name-with-63-characters-12345678901234567891111111123456789", // 63 characters
18 expected: "pod-name-with-63-characters-12345678901234567891111111123456789",
19 },
20 {
21 input: "another-very-long-pod-name-that-exceeds-63-characters-123456789012345678901111111",
22 expected: "another-very-long-pod-name-that5b2d51014a9e6924828703237fa40bfd",
23 },
24 }
25
26 for _, test := range tests {
27 result := truncateAndHashIfExceed(test.input)
28 if result != test.expected {
29 t.Errorf("For input '%s', expected '%s', but got '%s'", test.input, test.expected, result)
30 }
31 }
32}

Callers

nothing calls this directly

Calls 1

truncateAndHashIfExceedFunction · 0.85

Tested by

no test coverage detected