cmd/geth: cover attach header flag order in test

This commit is contained in:
0xWeakSheep 2026-03-29 16:51:45 +08:00
parent d1369b69f5
commit d67337e0a7

View file

@ -42,10 +42,13 @@ func TestAttachWithHeaders(t *testing.T) {
} }
port := ln.Addr().(*net.TCPAddr).Port port := ln.Addr().(*net.TCPAddr).Port
testReceiveHeaders(t, ln, "attach", "-H", "first: one", "-H", "second: two", fmt.Sprintf("http://localhost:%d", 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:
// ln, err = net.Listen("tcp", "localhost:0")
// testReceiveHeaders(t, ln, "-H", "first: one", "-H", "second: two", "attach", fmt.Sprintf("http://localhost:%d", port)) if err != nil {
// This is fixed in a follow-up PR. 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 // TestRemoteDbWithHeaders tests that 'geth db --remotedb' with custom headers works, i.e