| 542 | } |
| 543 | |
| 544 | func TestMigratingFileSourceMissingSkip(t *testing.T) { |
| 545 | sourceFilename := "some-missing-file" |
| 546 | destinationFile, _ := ioutil.TempFile("", "") |
| 547 | // delete the file so that we'll write to it |
| 548 | os.Remove(destinationFile.Name()) |
| 549 | |
| 550 | loadingRules := ClientConfigLoadingRules{ |
| 551 | MigrationRules: map[string]string{destinationFile.Name(): sourceFilename}, |
| 552 | } |
| 553 | |
| 554 | if _, err := loadingRules.Load(); err != nil { |
| 555 | t.Errorf("unexpected error %v", err) |
| 556 | } |
| 557 | |
| 558 | if _, err := os.Stat(destinationFile.Name()); !os.IsNotExist(err) { |
| 559 | t.Errorf("destination should not exist") |
| 560 | } |
| 561 | } |
| 562 | |
| 563 | func TestFileLocking(t *testing.T) { |
| 564 | f, _ := ioutil.TempFile("", "") |