From 6219b4541e9f7338937854ab445753e54f372383 Mon Sep 17 00:00:00 2001 From: Elad Date: Thu, 14 Mar 2019 18:24:26 +0700 Subject: [PATCH] cmd/swarm: dont connect to bootnodes in tests --- cmd/swarm/run_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cmd/swarm/run_test.go b/cmd/swarm/run_test.go index 4a6a56d9b8..9681c8990a 100644 --- a/cmd/swarm/run_test.go +++ b/cmd/swarm/run_test.go @@ -82,6 +82,18 @@ func TestMain(m *testing.M) { func runSwarm(t *testing.T, args ...string) *cmdtest.TestCmd { tt := cmdtest.NewTestCmd(t, nil) + found := false + for _, v := range args { + if v == "--bootnodes" { + found = true + break + } + } + + if !found { + args = append([]string{"--bootnodes", ""}, args...) + } + // Boot "swarm". This actually runs the test binary but the TestMain // function will prevent any tests from running. tt.Run("swarm-test", args...) @@ -252,6 +264,7 @@ func existingTestNode(t *testing.T, dir string, bzzaccount string) *testNode { // start the node node.Cmd = runSwarm(t, + "--bootnodes", "", "--port", p2pPort, "--nat", "extip:127.0.0.1", "--datadir", dir, @@ -327,6 +340,7 @@ func newTestNode(t *testing.T, dir string) *testNode { // start the node node.Cmd = runSwarm(t, + "--bootnodes", "", "--port", p2pPort, "--nat", "extip:127.0.0.1", "--datadir", dir,