Add renames to integration tests

This commit is contained in:
Audrius Butkevicius
2014-12-20 23:12:12 +00:00
parent 74d7c8e625
commit e50a8917ec
3 changed files with 23 additions and 8 deletions

View File

@@ -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
})