Skip to content

Commit

Permalink
update TestTruncateExtLabels and pass test
Browse files Browse the repository at this point in the history
Signed-off-by: mickeyzzc <[email protected]>
  • Loading branch information
mickeyzzc committed Apr 11, 2023
1 parent 702b274 commit 307b8e4
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions pkg/query/endpointset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func (e *testEndpoints) CloseOne(addr string) {
}

func TestTruncateExtLabels(t *testing.T) {
const testLength = 5
const testLength = 10

for _, tc := range []struct {
labelToTruncate string
Expand All @@ -283,20 +283,24 @@ func TestTruncateExtLabels(t *testing.T) {
expectedOutput: "{abc}",
},
{
labelToTruncate: "{abcd}",
expectedOutput: "{abc}",
labelToTruncate: "{abcdefgh}",
expectedOutput: "{abcdefgh}",
},
{
labelToTruncate: "{abcde}",
expectedOutput: "{abc}",
labelToTruncate: "{abcdefghij}",
expectedOutput: "{abcdefgh}",
},
{
labelToTruncate: "{abcdef}",
expectedOutput: "{abc}",
labelToTruncate: "{abcde花}",
expectedOutput: "{abcde花}",
},
{
labelToTruncate: "{abcdefghij}",
expectedOutput: "{abc}",
labelToTruncate: "{abcde花朵}",
expectedOutput: "{abcde花}",
},
{
labelToTruncate: "{abcde花fghij}",
expectedOutput: "{abcde花}",
},
} {
t.Run(tc.labelToTruncate, func(t *testing.T) {
Expand Down

0 comments on commit 307b8e4

Please sign in to comment.