local: add --local-no-check-updated to disable update checks #2206

This disables the `can't copy - source file is being updated` checks.
This commit is contained in:
Nick Craig-Wood 2018-04-09 15:27:58 +01:00
parent aeedacfb50
commit d5b2ec32f1
3 changed files with 40 additions and 11 deletions

View file

@ -29,8 +29,10 @@ func TestMapper(t *testing.T) {
})
assert.Equal(t, "potato", m.Load("potato"))
assert.Equal(t, "-r?'a´o¨", m.Load("-r'áö"))
}
// Test copy with source file that's updating
// Test copy with source file that's updating
func TestUpdatingCheck(t *testing.T) {
r := fstest.NewRun(t)
defer r.Finalise()
filePath := "sub dir/local test"
@ -59,4 +61,16 @@ func TestMapper(t *testing.T) {
r.WriteFile(filePath, "content updated", time.Now())
_, err = in.Read(buf)
require.Errorf(t, err, "can't copy - source file is being updated")
// turn the checking off and try again
*noCheckUpdated = true
defer func() {
*noCheckUpdated = false
}()
r.WriteFile(filePath, "content updated", time.Now())
_, err = in.Read(buf)
require.NoError(t, err)
}