Added a memfs test for a large file.
To help investigate googlecloudplatform/gcsfuse#27.geesefs-0-30-9
parent
2222e8d053
commit
0e7e9c3f78
|
@ -15,6 +15,7 @@
|
|||
package memfs_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
@ -825,6 +826,27 @@ func (t *MemFSTest) WriteAtDoesntChangeOffset_AppendMode() {
|
|||
ExpectEq(4, offset)
|
||||
}
|
||||
|
||||
func (t *MemFSTest) LargeFile() {
|
||||
var err error
|
||||
|
||||
// Create a file.
|
||||
f, err := os.Create(path.Join(t.Dir, "foo"))
|
||||
t.ToClose = append(t.ToClose, f)
|
||||
AssertEq(nil, err)
|
||||
|
||||
// Copy in large contents.
|
||||
const size = 1 << 24
|
||||
contents := bytes.Repeat([]byte{0x20}, size)
|
||||
|
||||
_, err = io.Copy(f, bytes.NewReader(contents))
|
||||
AssertEq(nil, err)
|
||||
|
||||
// Read the full contents of the file.
|
||||
contents, err = ioutil.ReadFile(f.Name())
|
||||
AssertEq(nil, err)
|
||||
ExpectEq(size, len(contents))
|
||||
}
|
||||
|
||||
func (t *MemFSTest) AppendMode() {
|
||||
var err error
|
||||
var n int
|
||||
|
|
Loading…
Reference in New Issue