Test with CompareDest set
(t *testing.T)
| 191 | |
| 192 | // Test with CompareDest set |
| 193 | func TestCopyFileCompareDest(t *testing.T) { |
| 194 | ctx := context.Background() |
| 195 | ctx, ci := fs.AddConfig(ctx) |
| 196 | r := fstest.NewRun(t) |
| 197 | |
| 198 | ci.CompareDest = []string{r.FremoteName + "/CompareDest"} |
| 199 | fdst, err := fs.NewFs(ctx, r.FremoteName+"/dst") |
| 200 | require.NoError(t, err) |
| 201 | |
| 202 | // check empty dest, empty compare |
| 203 | file1 := r.WriteFile("one", "one", t1) |
| 204 | r.CheckLocalItems(t, file1) |
| 205 | |
| 206 | err = operations.CopyFile(ctx, fdst, r.Flocal, file1.Path, file1.Path) |
| 207 | require.NoError(t, err) |
| 208 | |
| 209 | file1dst := file1 |
| 210 | file1dst.Path = "dst/one" |
| 211 | |
| 212 | r.CheckRemoteItems(t, file1dst) |
| 213 | |
| 214 | // check old dest, empty compare |
| 215 | file1b := r.WriteFile("one", "onet2", t2) |
| 216 | r.CheckRemoteItems(t, file1dst) |
| 217 | r.CheckLocalItems(t, file1b) |
| 218 | |
| 219 | err = operations.CopyFile(ctx, fdst, r.Flocal, file1b.Path, file1b.Path) |
| 220 | require.NoError(t, err) |
| 221 | |
| 222 | file1bdst := file1b |
| 223 | file1bdst.Path = "dst/one" |
| 224 | |
| 225 | r.CheckRemoteItems(t, file1bdst) |
| 226 | |
| 227 | // check old dest, new compare |
| 228 | file3 := r.WriteObject(ctx, "dst/one", "one", t1) |
| 229 | file2 := r.WriteObject(ctx, "CompareDest/one", "onet2", t2) |
| 230 | file1c := r.WriteFile("one", "onet2", t2) |
| 231 | r.CheckRemoteItems(t, file2, file3) |
| 232 | r.CheckLocalItems(t, file1c) |
| 233 | |
| 234 | err = operations.CopyFile(ctx, fdst, r.Flocal, file1c.Path, file1c.Path) |
| 235 | require.NoError(t, err) |
| 236 | |
| 237 | r.CheckRemoteItems(t, file2, file3) |
| 238 | |
| 239 | // check empty dest, new compare |
| 240 | file4 := r.WriteObject(ctx, "CompareDest/two", "two", t2) |
| 241 | file5 := r.WriteFile("two", "two", t2) |
| 242 | r.CheckRemoteItems(t, file2, file3, file4) |
| 243 | r.CheckLocalItems(t, file1c, file5) |
| 244 | |
| 245 | err = operations.CopyFile(ctx, fdst, r.Flocal, file5.Path, file5.Path) |
| 246 | require.NoError(t, err) |
| 247 | |
| 248 | r.CheckRemoteItems(t, file2, file3, file4) |
| 249 | |
| 250 | // check new dest, new compare |
nothing calls this directly
no test coverage detected
searching dependent graphs…