From a576a4b183ba3206c2938d4adbb542af7a20760a Mon Sep 17 00:00:00 2001 From: Meow <197331664+Meo597@users.noreply.github.com> Date: Sun, 8 Jun 2025 12:47:04 +0800 Subject: [PATCH] Tests: Real fix for TestCommanderListHandlers (#4792) Completes https://github.com/XTLS/Xray-core/commit/402067d281febb813cea526b1fb83e0eb2a448f0 --- testing/scenarios/command_test.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/testing/scenarios/command_test.go b/testing/scenarios/command_test.go index c7914752..8ee9e4bf 100644 --- a/testing/scenarios/command_test.go +++ b/testing/scenarios/command_test.go @@ -286,7 +286,13 @@ func TestCommanderListHandlers(t *testing.T) { t.Error("unexpected nil response") } - if diff := cmp.Diff(inboundResp.Inbounds, clientConfig.Inbound, protocmp.Transform()); diff != "" { + if diff := cmp.Diff( + inboundResp.Inbounds, + clientConfig.Inbound, + protocmp.Transform(), + cmpopts.SortSlices(func(a, b *core.InboundHandlerConfig) bool { + return a.Tag < b.Tag + })); diff != "" { t.Fatalf("inbound response doesn't match config (-want +got):\n%s", diff) } @@ -296,7 +302,13 @@ func TestCommanderListHandlers(t *testing.T) { t.Error("unexpected nil response") } - if diff := cmp.Diff(outboundResp.Outbounds, clientConfig.Outbound, protocmp.Transform()); diff != "" { + if diff := cmp.Diff( + outboundResp.Outbounds, + clientConfig.Outbound, + protocmp.Transform(), + cmpopts.SortSlices(func(a, b *core.InboundHandlerConfig) bool { + return a.Tag < b.Tag + })); diff != "" { t.Fatalf("outbound response doesn't match config (-want +got):\n%s", diff) } }