ethersphere / swarm

Swarm: Censorship resistant storage and communication infrastructure for a truly sovereign digital society
https://swarm.ethereum.org/
GNU Lesser General Public License v3.0
488 stars 110 forks source link

fix tests that call t.Fatal inside goroutines outside of the test #1055

Open nonsense opened 5 years ago

nonsense commented 5 years ago
$ megacheck ./cmd/swarm/... ./swarm/... | grep "T.Fatal"
swarm/network/simulation/events_test.go:84:2: the goroutine calls T.Fatal, which must be called in the same goroutine as the test (SA2002)
swarm/network/simulation/http_test.go:76:2: the goroutine calls T.Fatalf, which must be called in the same goroutine as the test (SA2002)
swarm/network/simulation/http_test.go:76:2: the goroutine calls T.Fatalf, which must be called in the same goroutine as the test (SA2002)
swarm/network/stream/delivery_test.go:556:3: the goroutine calls T.Fatalf, which must be called in the same goroutine as the test (SA2002)
swarm/network/stream/delivery_test.go:573:3: the goroutine calls T.Fatal, which must be called in the same goroutine as the test (SA2002)
swarm/network/stream/delivery_test.go:705:3: the goroutine calls T.Fatal, which must be called in the same goroutine as the test (SA2002)
swarm/network/stream/intervals_test.go:166:3: the goroutine calls T.Fatal, which must be called in the same goroutine as the test (SA2002)
swarm/network/stream/snapshot_sync_test.go:218:2: the goroutine calls T.Fatal, which must be called in the same goroutine as the test (SA2002)
swarm/network/stream/snapshot_sync_test.go:401:2: the goroutine calls T.Fatal, which must be called in the same goroutine as the test (SA2002)
swarm/network/stream/syncer_test.go:147:3: the goroutine calls T.Fatal, which must be called in the same goroutine as the test (SA2002)
swarm/storage/mock/test/test.go:199:2: the goroutine calls T.Fatalf, which must be called in the same goroutine as the test (SA2002)
swarm/storage/netstore_test.go:117:2: the goroutine calls T.Fatal, which must be called in the same goroutine as the test (SA2002)
swarm/storage/netstore_test.go:117:2: the goroutine calls T.Fatalf, which must be called in the same goroutine as the test (SA2002)
swarm/storage/netstore_test.go:203:2: the goroutine calls T.Fatal, which must be called in the same goroutine as the test (SA2002)
swarm/storage/netstore_test.go:246:2: the goroutine calls T.Fatal, which must be called in the same goroutine as the test (SA2002)
swarm/storage/netstore_test.go:289:2: the goroutine calls T.Fatal, which must be called in the same goroutine as the test (SA2002)
swarm/storage/netstore_test.go:289:2: the goroutine calls T.Fatalf, which must be called in the same goroutine as the test (SA2002)
swarm/storage/netstore_test.go:306:3: the goroutine calls T.Fatalf, which must be called in the same goroutine as the test (SA2002)
swarm/storage/netstore_test.go:306:3: the goroutine calls T.Fatalf, which must be called in the same goroutine as the test (SA2002)
swarm/storage/netstore_test.go:549:3: the goroutine calls T.Fatalf, which must be called in the same goroutine as the test (SA2002)
swarm/storage/netstore_test.go:613:3: the goroutine calls T.Fatalf, which must be called in the same goroutine as the test (SA2002)

cc @janos @justelad

jpeletier commented 5 years ago

Next Tuesday in the roundtable I will present a solution to this. In particular, the test framework I will propose supports throwing errors inside a test goroutine.