mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-23 13:44:27 +08:00
Merge pull request #5262 from schomatis/fix/mfs/test/seek-before-read
mfs: seek to 0 before reading in `TestTruncateAndWrite`
This commit is contained in:
@ -1167,12 +1167,18 @@ func TestTruncateAndWrite(t *testing.T) {
|
|||||||
if l != len("test") {
|
if l != len("test") {
|
||||||
t.Fatal("incorrect write length")
|
t.Fatal("incorrect write length")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_, err = fd.Seek(0, io.SeekStart)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
data, err := ioutil.ReadAll(fd)
|
data, err := ioutil.ReadAll(fd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if string(data) != "test" {
|
if string(data) != "test" {
|
||||||
t.Errorf("read error at read %d, read: %v", i, data)
|
t.Fatalf("read error at read %d, read: %v", i, data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user