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
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