Skip to content

Commit

Permalink
cmd/geth/tests: try to fix spurious travis failure in les tests (#21410)
Browse files Browse the repository at this point in the history
* cmd/geth/tests: try to fix spurious travis failure in les tests

* cmd/geth: les_test - remove extraneous option during boot
  • Loading branch information
holiman authored Aug 14, 2020
1 parent 04926db commit 54add42
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions cmd/geth/les_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ func (g *gethrpc) waitSynced() {
}
}

func startGethWithRpc(t *testing.T, name string, args ...string) *gethrpc {
func startGethWithIpc(t *testing.T, name string, args ...string) *gethrpc {
g := &gethrpc{name: name}
args = append([]string{"--networkid=42", "--port=0", "--nousb", "--http", "--http.port=0", "--http.api=admin,eth,les"}, args...)
args = append([]string{"--networkid=42", "--port=0", "--nousb"}, args...)
t.Logf("Starting %v with rpc: %v", name, args)
g.geth = runGeth(t, args...)
// wait before we can attach to it. TODO: probe for it properly
Expand All @@ -112,23 +112,23 @@ func startGethWithRpc(t *testing.T, name string, args ...string) *gethrpc {
}

func initGeth(t *testing.T) string {
g := runGeth(t, "--networkid=42", "init", "./testdata/clique.json")
g := runGeth(t, "--nousb", "--networkid=42", "init", "./testdata/clique.json")
datadir := g.Datadir
g.WaitExit()
return datadir
}

func startLightServer(t *testing.T) *gethrpc {
datadir := initGeth(t)
runGeth(t, "--datadir", datadir, "--password", "./testdata/password.txt", "account", "import", "./testdata/key.prv").WaitExit()
runGeth(t, "--nousb", "--datadir", datadir, "--password", "./testdata/password.txt", "account", "import", "./testdata/key.prv").WaitExit()
account := "0x02f0d131f1f97aef08aec6e3291b957d9efe7105"
server := startGethWithRpc(t, "lightserver", "--allow-insecure-unlock", "--datadir", datadir, "--password", "./testdata/password.txt", "--unlock", account, "--mine", "--light.serve=100", "--light.maxpeers=1", "--nodiscover", "--nat=extip:127.0.0.1")
server := startGethWithIpc(t, "lightserver", "--allow-insecure-unlock", "--datadir", datadir, "--password", "./testdata/password.txt", "--unlock", account, "--mine", "--light.serve=100", "--light.maxpeers=1", "--nodiscover", "--nat=extip:127.0.0.1")
return server
}

func startClient(t *testing.T, name string) *gethrpc {
datadir := initGeth(t)
return startGethWithRpc(t, name, "--datadir", datadir, "--nodiscover", "--syncmode=light", "--nat=extip:127.0.0.1")
return startGethWithIpc(t, name, "--datadir", datadir, "--nodiscover", "--syncmode=light", "--nat=extip:127.0.0.1")
}

func TestPriorityClient(t *testing.T) {
Expand Down Expand Up @@ -166,6 +166,7 @@ func TestPriorityClient(t *testing.T) {
freeCli.getNodeInfo().ID: freeCli,
prioCli.getNodeInfo().ID: prioCli,
}
time.Sleep(1 * time.Second)
lightServer.callRPC(&peers, "admin_peers")
peersWithNames := make(map[string]string)
for _, p := range peers {
Expand Down

0 comments on commit 54add42

Please sign in to comment.