Added test for checking write at random place using gcsfuse
@@ -51,3 +51,20 @@ func TestWriteAtStartOfFile(t *testing.T){
compareFileContents(t, fileName, "line 4\nline 2\n")
}
+
+func TestWriteAtRandom(t *testing.T){
+ createTempFile()
+
+ f, err := os.OpenFile(fileName, os.O_WRONLY, 0600)
+ if err != nil {
+ t.Errorf("Open file for write at random: %v", err)
+ }
+
+ if _, err = f.WriteAt([]byte("line 5\n"),7); err != nil {
+ t.Errorf("WriteString-Random: %v", err)
+ }
+
+ f.Close()
+
+ compareFileContents(t, fileName, "line 1\nline 5\n")
+}
