(t *testing.T)
| 5 | ) |
| 6 | |
| 7 | func 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 | } |
nothing calls this directly
no test coverage detected