Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cmd/geth/consolecmd_cg_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package main

import (
"crypto/sha1"
"fmt"
"os"
"path/filepath"
"regexp"
"strconv"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -165,7 +167,10 @@ func TestGethStartupLogs(t *testing.T) {
},
}
for i, c := range cases {
t.Run(fmt.Sprintf("TestGethStartupLogs/%d: %v", i, c.flags), func(t *testing.T) {
// fix for darwin, where long test names fail with "The ipc endpoint is longer than %d characters."
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@meowsbits another way is to change the test name only if rpc.max_path_size < len([]byte(strings.Join(c.flags, " ")))), for this we have to export the max_path_size in rpc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://unix.stackexchange.com/questions/367008/why-is-socket-path-length-limited-to-a-hundred-chars

If the error you're seeing is because of the IPC path length limit, then we can try to shorten that up by shortening the datadir path, since geth should use the default <datadir>/<alt chain?>/geth/geth.ipc.

But if the error is just because of the test names, I recommend reducing them to a simple Sprintf("%d", i) -- which seems like a reasonable thing to do anyway (shoving the flags in there was a bad idea).

I'm going to push a commit, see whatcha think.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue was because of the IPC path, which was long as part of it was based on test name.
I am going to test your commits

hashedFlags := fmt.Sprintf("%x", sha1.Sum([]byte(strings.Join(c.flags, " "))))

t.Run(fmt.Sprintf("%d:%v", i, hashedFlags[:8]), func(t *testing.T) {
geth := runGeth(t, append(c.flags, "--exec", "admin.nodeInfo.name", "console")...)
geth.KillTimeout = 10 * time.Second
geth.ExpectRegexp("(?ism).*CoreGeth.*")
Expand Down