diff --git a/test/h2/config.xml b/test/h2/config.xml index 1a456eec..0b6f6858 100644 --- a/test/h2/config.xml +++ b/test/h2/config.xml @@ -7,7 +7,7 @@ false 1 16 - 1 + 0 @@ -16,7 +16,7 @@ false 1 16 - 1 + 0 @@ -25,7 +25,7 @@ false 1 16 - 1 + 0
127.0.0.1:22001
diff --git a/test/sync_test.go b/test/sync_test.go index 941df00b..85dc97fa 100644 --- a/test/sync_test.go +++ b/test/sync_test.go @@ -105,7 +105,7 @@ func testSyncCluster(t *testing.T) { } // We'll use this file for appending data without modifying the time stamp. - fd, err := os.Create("s1/appendfile") + fd, err := os.Create("s1/test-appendfile") if err != nil { t.Fatal(err) } @@ -207,12 +207,12 @@ func testSyncCluster(t *testing.T) { break } - // Alter the "appendfile" without changing it's modification time. Sneaky! - fi, err := os.Stat("s1/appendfile") + // Alter the "test-appendfile" without changing it's modification time. Sneaky! + fi, err := os.Stat("s1/test-appendfile") if err != nil { t.Fatal(err) } - fd, err := os.OpenFile("s1/appendfile", os.O_APPEND|os.O_WRONLY, 0644) + fd, err := os.OpenFile("s1/test-appendfile", os.O_APPEND|os.O_WRONLY, 0644) if err != nil { t.Fatal(err) } @@ -228,7 +228,7 @@ func testSyncCluster(t *testing.T) { if err != nil { t.Fatal(err) } - err = os.Chtimes("s1/appendfile", fi.ModTime(), fi.ModTime()) + err = os.Chtimes("s1/test-appendfile", fi.ModTime(), fi.ModTime()) if err != nil { t.Fatal(err) } diff --git a/test/util.go b/test/util.go index 4342ceba..76edf694 100644 --- a/test/util.go +++ b/test/util.go @@ -116,6 +116,10 @@ func alterFiles(dir string) error { return err } + if strings.HasPrefix(filepath.Base(path), "test-") { + return nil + } + switch filepath.Base(path) { case ".stfolder": return nil @@ -161,6 +165,17 @@ func alterFiles(dir string) error { if err != nil { return err } + case r < 0.3 && comps > 1 && (info.Mode().IsRegular() || rand.Float64() < 0.2): + rpath := filepath.Dir(path) + if rand.Float64() < 0.2 { + for move := rand.Intn(comps - 1); move > 0; move-- { + rpath = filepath.Join(rpath, "..") + } + } + err = os.Rename(path, filepath.Join(rpath, randomName())) + if err != nil { + return err + } } return nil })