From d67337e0a7cb82f090d2ac262700a7bb37fce7fc Mon Sep 17 00:00:00 2001 From: 0xWeakSheep Date: Sun, 29 Mar 2026 16:51:45 +0800 Subject: [PATCH] cmd/geth: cover attach header flag order in test --- cmd/geth/attach_test.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd/geth/attach_test.go b/cmd/geth/attach_test.go index 1df25359c5..a2b575022e 100644 --- a/cmd/geth/attach_test.go +++ b/cmd/geth/attach_test.go @@ -42,10 +42,13 @@ func TestAttachWithHeaders(t *testing.T) { } port := ln.Addr().(*net.TCPAddr).Port testReceiveHeaders(t, ln, "attach", "-H", "first: one", "-H", "second: two", fmt.Sprintf("http://localhost:%d", port)) - // This way to do it fails due to flag ordering: - // - // testReceiveHeaders(t, ln, "-H", "first: one", "-H", "second: two", "attach", fmt.Sprintf("http://localhost:%d", port)) - // This is fixed in a follow-up PR. + + ln, err = net.Listen("tcp", "localhost:0") + if err != nil { + t.Fatal(err) + } + port = ln.Addr().(*net.TCPAddr).Port + testReceiveHeaders(t, ln, "-H", "first: one", "-H", "second: two", "attach", fmt.Sprintf("http://localhost:%d", port)) } // TestRemoteDbWithHeaders tests that 'geth db --remotedb' with custom headers works, i.e