From 307b8e442d481b7fc3033dc5f1aecece4b2ac921 Mon Sep 17 00:00:00 2001 From: mickeyzzc Date: Tue, 11 Apr 2023 12:47:08 +0800 Subject: [PATCH] update TestTruncateExtLabels and pass test Signed-off-by: mickeyzzc --- pkg/query/endpointset_test.go | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/pkg/query/endpointset_test.go b/pkg/query/endpointset_test.go index 2edfe01718..70b95c8ab5 100644 --- a/pkg/query/endpointset_test.go +++ b/pkg/query/endpointset_test.go @@ -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 @@ -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) {