Test copy with files from
(t *testing.T, noTraverse bool)
| 306 | |
| 307 | // Test copy with files from |
| 308 | func testCopyWithFilesFrom(t *testing.T, noTraverse bool) { |
| 309 | ctx := context.Background() |
| 310 | ctx, ci := fs.AddConfig(ctx) |
| 311 | r := fstest.NewRun(t) |
| 312 | file1 := r.WriteFile("potato2", "hello world", t1) |
| 313 | file2 := r.WriteFile("hello world2", "hello world2", t2) |
| 314 | |
| 315 | // Set the --files-from equivalent |
| 316 | f, err := filter.NewFilter(nil) |
| 317 | require.NoError(t, err) |
| 318 | require.NoError(t, f.AddFile("potato2")) |
| 319 | require.NoError(t, f.AddFile("notfound")) |
| 320 | |
| 321 | // Change the active filter |
| 322 | ctx = filter.ReplaceConfig(ctx, f) |
| 323 | |
| 324 | ci.NoTraverse = noTraverse |
| 325 | |
| 326 | ctx = predictDstFromLogger(ctx) |
| 327 | err = CopyDir(ctx, r.Fremote, r.Flocal, false) |
| 328 | require.NoError(t, err) |
| 329 | testLoggerVsLsf(ctx, r.Fremote, r.Flocal, operations.GetLoggerOpt(ctx).JSON, t) |
| 330 | |
| 331 | r.CheckLocalItems(t, file1, file2) |
| 332 | r.CheckRemoteItems(t, file1) |
| 333 | } |
| 334 | func TestCopyWithFilesFrom(t *testing.T) { testCopyWithFilesFrom(t, false) } |
| 335 | func TestCopyWithFilesFromAndNoTraverse(t *testing.T) { testCopyWithFilesFrom(t, true) } |
| 336 |
no test coverage detected
searching dependent graphs…