Commit 364ddfc0 authored by Sebastian Stark's avatar Sebastian Stark

Test for *SnapshotList.lastGood()

parent b1cf7e04
......@@ -13,6 +13,7 @@ import (
const (
sdate int64 = 1400268377
edate int64 = 1400268387
lastGood = "1400337721-1400337722 Complete"
)
func TestNewSnapshot(t *testing.T) {
......@@ -67,3 +68,23 @@ func TestFindDangling(t *testing.T) {
}
}
}
func TestLastGood(t *testing.T) {
mockConfig()
mockRepositoryDangling()
defer os.RemoveAll(config.repository)
cl := newSkewClock(startAt)
sl, _ := FindSnapshots(cl)
if s := sl.lastGood().String(); s != lastGood {
t.Errorf("lastGood() found %v, should be %v", s, lastGood)
}
// Advance to next snapshot the is not (yet) complete, see if this is
// omitted as it should
os.Mkdir(filepath.Join(config.repository, DATA_SUBDIR, "1400337727-0-incomplete"), 0777)
cl.skew -= schedules["testing2"][0]
sl, _ = FindSnapshots(cl)
if s := sl.lastGood().String(); s != lastGood {
t.Errorf("lastGood() found %v, should be %v", s, lastGood)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment