mirror of https://github.com/status-im/op-geth.git
swarm/storage/mock/test: fix T.Fatal inside a goroutine (#18399)
This commit is contained in:
parent
356c49fa7e
commit
56a3f6c03c
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue