accounts/keystore: fix cache update and TestUpdatedKeyfileContents failing on macOS

This commit is contained in:
Gautam Botrel 2017-10-31 22:22:10 -05:00
parent 0131bd6ff9
commit 599ba6032e

View file

@ -23,6 +23,7 @@ import (
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"runtime"
"sort" "sort"
"strings" "strings"
"sync" "sync"
@ -260,7 +261,8 @@ func (fc *fileCache) scanFiles(keyDir string) (set.Interface, set.Interface, set
continue continue
} }
filesNow.Add(path) filesNow.Add(path)
if modTime.After(prevMtime) { // on macOS, we get FS notifications before the actual modTime is updated
if modTime.After(prevMtime) || (modTime.Equal(prevMtime) && runtime.GOOS == "darwin") {
moddedFiles.Add(path) moddedFiles.Add(path)
} }
if modTime.After(newMtime) { if modTime.After(newMtime) {