| 616 | } |
| 617 | |
| 618 | func removeSomeTestFilesAndFolders(local string, remote string, filesToCheck testCaseList, foldersToCheck testCaseList, removeSuffix string) (testCaseList, testCaseList, error) { |
| 619 | var completeSuffix string |
| 620 | removeIfSuffixMatch := func(path string, f os.FileInfo, err error) error { |
| 621 | if strings.HasSuffix(path, completeSuffix) { |
| 622 | return os.RemoveAll(path) |
| 623 | } |
| 624 | return nil |
| 625 | } |
| 626 | |
| 627 | completeSuffix = "Remote" + removeSuffix |
| 628 | err := filepath.Walk(remote, removeIfSuffixMatch) |
| 629 | if err != nil { |
| 630 | return nil, nil, err |
| 631 | } |
| 632 | completeSuffix = "Local" + removeSuffix |
| 633 | err = filepath.Walk(local, removeIfSuffixMatch) |
| 634 | if err != nil { |
| 635 | return nil, nil, err |
| 636 | } |
| 637 | |
| 638 | for n, f := range filesToCheck { |
| 639 | if strings.HasSuffix(f.path, removeSuffix) { |
| 640 | filesToCheck[n].shouldExistInLocal = false |
| 641 | filesToCheck[n].shouldExistInRemote = false |
| 642 | } |
| 643 | } |
| 644 | |
| 645 | for n, f := range foldersToCheck { |
| 646 | if strings.HasSuffix(f.path, removeSuffix) { |
| 647 | foldersToCheck[n].shouldExistInLocal = false |
| 648 | foldersToCheck[n].shouldExistInRemote = false |
| 649 | } |
| 650 | } |
| 651 | |
| 652 | return filesToCheck, foldersToCheck, nil |
| 653 | } |
| 654 | |
| 655 | func renameSomeTestFilesAndFolders(local string, remote string, outside string, filesToCheck testCaseList, foldersToCheck testCaseList) (testCaseList, testCaseList, error) { |
| 656 | for n, array := range []testCaseList{filesToCheck, foldersToCheck} { |