lib/model: Improve test utilities (#5584)
This commit is contained in:
committed by
Audrius Butkevicius
parent
3a75b63776
commit
b1564e53e4
@@ -2869,14 +2869,13 @@ func TestIssue2571(t *testing.T) {
|
||||
t.Skip("Scanning symlinks isn't supported on windows")
|
||||
}
|
||||
|
||||
w, tmpDir := tmpDefaultWrapper()
|
||||
w, fcfg := tmpDefaultWrapper()
|
||||
testFs := fcfg.Filesystem()
|
||||
defer func() {
|
||||
os.RemoveAll(tmpDir)
|
||||
os.RemoveAll(testFs.URI())
|
||||
os.Remove(w.ConfigPath())
|
||||
}()
|
||||
|
||||
testFs := fs.NewFilesystem(fs.FilesystemTypeBasic, tmpDir)
|
||||
|
||||
for _, dir := range []string{"toLink", "linkTarget"} {
|
||||
err := testFs.MkdirAll(dir, 0775)
|
||||
if err != nil {
|
||||
@@ -2919,14 +2918,13 @@ func TestIssue4573(t *testing.T) {
|
||||
t.Skip("Can't make the dir inaccessible on windows")
|
||||
}
|
||||
|
||||
w, tmpDir := tmpDefaultWrapper()
|
||||
w, fcfg := tmpDefaultWrapper()
|
||||
testFs := fcfg.Filesystem()
|
||||
defer func() {
|
||||
os.RemoveAll(tmpDir)
|
||||
os.RemoveAll(testFs.URI())
|
||||
os.Remove(w.ConfigPath())
|
||||
}()
|
||||
|
||||
testFs := fs.NewFilesystem(fs.FilesystemTypeBasic, tmpDir)
|
||||
|
||||
err := testFs.MkdirAll("inaccessible", 0755)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -2959,14 +2957,13 @@ func TestIssue4573(t *testing.T) {
|
||||
// TestInternalScan checks whether various fs operations are correctly represented
|
||||
// in the db after scanning.
|
||||
func TestInternalScan(t *testing.T) {
|
||||
w, tmpDir := tmpDefaultWrapper()
|
||||
w, fcfg := tmpDefaultWrapper()
|
||||
testFs := fcfg.Filesystem()
|
||||
defer func() {
|
||||
os.RemoveAll(tmpDir)
|
||||
os.RemoveAll(testFs.URI())
|
||||
os.Remove(w.ConfigPath())
|
||||
}()
|
||||
|
||||
testFs := fs.NewFilesystem(fs.FilesystemTypeBasic, tmpDir)
|
||||
|
||||
testCases := map[string]func(protocol.FileInfo) bool{
|
||||
"removeDir": func(f protocol.FileInfo) bool {
|
||||
return !f.Deleted
|
||||
@@ -3157,15 +3154,14 @@ func TestRemoveDirWithContent(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIssue4475(t *testing.T) {
|
||||
m, conn, tmpDir, w := setupModelWithConnection()
|
||||
m, conn, fcfg, w := setupModelWithConnection()
|
||||
testFs := fcfg.Filesystem()
|
||||
defer func() {
|
||||
m.Stop()
|
||||
os.RemoveAll(tmpDir)
|
||||
os.RemoveAll(testFs.URI())
|
||||
os.Remove(w.ConfigPath())
|
||||
}()
|
||||
|
||||
testFs := fs.NewFilesystem(fs.FilesystemTypeBasic, tmpDir)
|
||||
|
||||
// Scenario: Dir is deleted locally and before syncing/index exchange
|
||||
// happens, a file is create in that dir on the remote.
|
||||
// This should result in the directory being recreated and added to the
|
||||
|
||||
Reference in New Issue
Block a user