mirror of https://github.com/restic/restic.git
fuse: Fix test for timestamps with same second
This commit is contained in:
parent
7b3e319398
commit
649f789190
|
@ -4,6 +4,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
@ -116,10 +117,28 @@ func TestMount(t *testing.T) {
|
||||||
for _, id := range snapshotIDs {
|
for _, id := range snapshotIDs {
|
||||||
snapshot, err := restic.LoadSnapshot(repo, id)
|
snapshot, err := restic.LoadSnapshot(repo, id)
|
||||||
OK(t, err)
|
OK(t, err)
|
||||||
_, ok := namesMap[snapshot.Time.Format(time.RFC3339)]
|
|
||||||
Assert(t, ok, "Snapshot %s isn't present in fuse dir", snapshot.Time.Format(time.RFC3339))
|
ts := snapshot.Time.Format(time.RFC3339)
|
||||||
namesMap[snapshot.Time.Format(time.RFC3339)] = true
|
present, ok := namesMap[ts]
|
||||||
|
if !ok {
|
||||||
|
t.Errorf("Snapshot %v (%q) isn't present in fuse dir", id.Str(), ts)
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 1; present; i++ {
|
||||||
|
ts = fmt.Sprintf("%s-%d", snapshot.Time.Format(time.RFC3339), i)
|
||||||
|
present, ok = namesMap[ts]
|
||||||
|
if !ok {
|
||||||
|
t.Errorf("Snapshot %v (%q) isn't present in fuse dir", id.Str(), ts)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !present {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namesMap[ts] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, present := range namesMap {
|
for name, present := range namesMap {
|
||||||
Assert(t, present, "Directory %s is present in fuse dir but is not a snapshot", name)
|
Assert(t, present, "Directory %s is present in fuse dir but is not a snapshot", name)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue