diff options
author | Janoš Guljaš <janos@users.noreply.github.com> | 2019-01-07 21:32:01 +0800 |
---|---|---|
committer | Anton Evangelatov <anton.evangelatov@gmail.com> | 2019-01-07 21:32:01 +0800 |
commit | 56a3f6c03cc3c7ae38ab7354f8615c014bb2102a (patch) | |
tree | 5e6ce504c20caecf8ebe7de9ecfdf35eebdbddd1 /swarm/storage/mock/test | |
parent | 356c49fa7ec88632f839226c9b0f1cf172ec6f9d (diff) | |
download | go-tangerine-56a3f6c03cc3c7ae38ab7354f8615c014bb2102a.tar go-tangerine-56a3f6c03cc3c7ae38ab7354f8615c014bb2102a.tar.gz go-tangerine-56a3f6c03cc3c7ae38ab7354f8615c014bb2102a.tar.bz2 go-tangerine-56a3f6c03cc3c7ae38ab7354f8615c014bb2102a.tar.lz go-tangerine-56a3f6c03cc3c7ae38ab7354f8615c014bb2102a.tar.xz go-tangerine-56a3f6c03cc3c7ae38ab7354f8615c014bb2102a.tar.zst go-tangerine-56a3f6c03cc3c7ae38ab7354f8615c014bb2102a.zip |
swarm/storage/mock/test: fix T.Fatal inside a goroutine (#18399)
Diffstat (limited to 'swarm/storage/mock/test')
-rw-r--r-- | swarm/storage/mock/test/test.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/swarm/storage/mock/test/test.go b/swarm/storage/mock/test/test.go index 10180985f..69828b144 100644 --- a/swarm/storage/mock/test/test.go +++ b/swarm/storage/mock/test/test.go @@ -196,17 +196,22 @@ func ImportExport(t *testing.T, outStore, inStore mock.GlobalStorer, n int) { r, w := io.Pipe() defer r.Close() + exportErrChan := make(chan error) go func() { defer w.Close() - if _, err := exporter.Export(w); err != nil { - t.Fatalf("export: %v", err) - } + + _, err := exporter.Export(w) + exportErrChan <- err }() if _, err := importer.Import(r); err != nil { t.Fatalf("import: %v", err) } + if err := <-exportErrChan; err != nil { + t.Fatalf("export: %v", err) + } + for i, addr := range addrs { chunkAddr := storage.Address(append(addr[:], []byte(strconv.FormatInt(int64(i)+1, 16))...)) data := []byte(strconv.FormatInt(int64(i)+1, 16)) |