Give the test snapshot a creation time apart from the fake clock in every zone
On the build node, in UTC, the fixture's creation time was the fake clock's own instant, so the test could not tell the list's time from the clock's. A day and a half earlier is apart from it everywhere.
This commit is contained in:
@@ -42,7 +42,7 @@ func TestTheSnapshotCommandIsFixedWordsThroughSudoWithTheNameAfterDashDash(t *te
|
||||
|
||||
func TestASnapshotIsAnsweredFromTheListAfterwardsAndRecorded(t *testing.T) {
|
||||
f := withZFS(t)
|
||||
snapshotting(f, takeLine, "tank/media@before-move\t1791547200\t0\t26938034880512")
|
||||
snapshotting(f, takeLine, "tank/media@before-move\t1791400000\t0\t26938034880512")
|
||||
a, err := f.machine().TakeSnapshot(context.Background(), "tank/media", "before-move", "before moving the library", false)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -50,7 +50,7 @@ func TestASnapshotIsAnsweredFromTheListAfterwardsAndRecorded(t *testing.T) {
|
||||
if !a.Done || len(a.Made) != 1 || a.Made[0].Name != "tank/media@before-move" || a.Made[0].Referenced != 26938034880512 {
|
||||
t.Fatalf("answer: %+v", a)
|
||||
}
|
||||
if a.Made[0].Created != time.Unix(1791547200, 0).Local().Format(time.RFC3339) || a.Made[0].Created == f.now.Format(time.RFC3339) {
|
||||
if a.Made[0].Created != time.Unix(1791400000, 0).Local().Format(time.RFC3339) || a.Made[0].Created == f.now.Format(time.RFC3339) {
|
||||
t.Errorf("the creation time is the list's: %s", a.Made[0].Created)
|
||||
}
|
||||
if len(a.Others) != 0 || !strings.Contains(a.Said, "No other snapshot came or went") || !strings.Contains(a.Said, "Why: before moving the library") {
|
||||
@@ -91,7 +91,7 @@ func TestARefusedSudoIsSaidAndRecorded(t *testing.T) {
|
||||
|
||||
func TestAnUnrecordedActSaysSoLoudly(t *testing.T) {
|
||||
f := withZFS(t)
|
||||
snapshotting(f, takeLine, "tank/media@before-move\t1791547200\t0\t1")
|
||||
snapshotting(f, takeLine, "tank/media@before-move\t1791400000\t0\t1")
|
||||
f.emitErr = errors.New("the bus did not accept it")
|
||||
a, err := f.machine().TakeSnapshot(context.Background(), "tank/media", "before-move", "why", false)
|
||||
if err != nil {
|
||||
@@ -104,7 +104,7 @@ func TestAnUnrecordedActSaysSoLoudly(t *testing.T) {
|
||||
|
||||
func TestAnotherSnapshotMeanwhileIsSaidNotHidden(t *testing.T) {
|
||||
f := withZFS(t)
|
||||
snapshotting(f, takeLine, "tank/media@before-move\t1791547200\t0\t1", "tank/downloads@auto-1200\t1791547201\t0\t1")
|
||||
snapshotting(f, takeLine, "tank/media@before-move\t1791400000\t0\t1", "tank/downloads@auto-1200\t1791547201\t0\t1")
|
||||
a, err := f.machine().TakeSnapshot(context.Background(), "tank/media", "before-move", "why", false)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -157,7 +157,7 @@ func TestRecursiveIsRefusedWhenAChildHasTheNameAlready(t *testing.T) {
|
||||
}
|
||||
// Without recursive, only tank's own name counts.
|
||||
f = withZFS(t)
|
||||
snapshotting(f, "sudo -n zfs snapshot -- tank@weekly", "tank@weekly\t1791547200\t0\t1")
|
||||
snapshotting(f, "sudo -n zfs snapshot -- tank@weekly", "tank@weekly\t1791400000\t0\t1")
|
||||
if a, err := f.machine().TakeSnapshot(context.Background(), "tank", "weekly", "why", false); err != nil || len(a.Made) != 1 {
|
||||
t.Errorf("tank@weekly alone: %v %+v", err, a)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user