diff options
author | Elad <theman@elad.im> | 2019-01-16 21:33:02 +0800 |
---|---|---|
committer | Rafael Matias <rafael@skyle.net> | 2019-02-19 19:54:56 +0800 |
commit | a3f31f51f38040e0aef76f4da95ae462fb649f81 (patch) | |
tree | 83463e8403270e1803d23609ac5a4ff2ccf61d6f /cmd/swarm/swarm-snapshot/run_test.go | |
parent | e63995b3f36837b97330a7ccaf56277099904d26 (diff) | |
download | dexon-a3f31f51f38040e0aef76f4da95ae462fb649f81.tar dexon-a3f31f51f38040e0aef76f4da95ae462fb649f81.tar.gz dexon-a3f31f51f38040e0aef76f4da95ae462fb649f81.tar.bz2 dexon-a3f31f51f38040e0aef76f4da95ae462fb649f81.tar.lz dexon-a3f31f51f38040e0aef76f4da95ae462fb649f81.tar.xz dexon-a3f31f51f38040e0aef76f4da95ae462fb649f81.tar.zst dexon-a3f31f51f38040e0aef76f4da95ae462fb649f81.zip |
cmd/swarm/swarm-snapshot: swarm snapshot generator (#18453)
* cmd/swarm/swarm-snapshot: add binary to create network snapshots
* cmd/swarm/swarm-snapshot: refactor and extend tests
* p2p/simulations: remove unused triggerChecks func and fix linter
* internal/cmdtest: raise the timeout for killing TestCmd
* cmd/swarm/swarm-snapshot: add more comments and other minor adjustments
* cmd/swarm/swarm-snapshot: remove redundant check in createSnapshot
* cmd/swarm/swarm-snapshot: change comment wording
* p2p/simulations: revert Simulation.Run from master
https://github.com/ethersphere/go-ethereum/pull/1077/files#r247078904
* cmd/swarm/swarm-snapshot: address pr comments
* swarm/network/simulations/discovery: removed snapshot write to file
* cmd/swarm/swarm-snapshot, swarm/network/simulations: removed redundant connection event check, fixed lint error
(cherry picked from commit 34f11e752f61b81c13cdde0649a3c7b14f801c69)
Diffstat (limited to 'cmd/swarm/swarm-snapshot/run_test.go')
-rw-r--r-- | cmd/swarm/swarm-snapshot/run_test.go | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/cmd/swarm/swarm-snapshot/run_test.go b/cmd/swarm/swarm-snapshot/run_test.go new file mode 100644 index 000000000..d9a041597 --- /dev/null +++ b/cmd/swarm/swarm-snapshot/run_test.go @@ -0,0 +1,49 @@ +// Copyright 2018 The go-ethereum Authors +// This file is part of go-ethereum. +// +// go-ethereum is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// go-ethereum is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>. + +package main + +import ( + "fmt" + "os" + "testing" + + "github.com/docker/docker/pkg/reexec" + "github.com/ethereum/go-ethereum/internal/cmdtest" +) + +func init() { + reexec.Register("swarm-snapshot", func() { + if err := newApp().Run(os.Args); err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(1) + } + os.Exit(0) + }) +} + +func runSnapshot(t *testing.T, args ...string) *cmdtest.TestCmd { + tt := cmdtest.NewTestCmd(t, nil) + tt.Run("swarm-snapshot", args...) + return tt +} + +func TestMain(m *testing.M) { + if reexec.Init() { + return + } + os.Exit(m.Run()) +} |