|
|
@@ -34,10 +34,18 @@ func TestCtlV3Snapshot(t *testing.T) { testCtl(t, snapshotTest) }
|
|
|
func snapshotTest(cx ctlCtx) {
|
|
|
maintenanceInitKeys(cx)
|
|
|
|
|
|
+ leaseID, err := ctlV3LeaseGrant(cx, 100)
|
|
|
+ if err != nil {
|
|
|
+ cx.t.Fatalf("snapshot: ctlV3LeaseGrant error (%v)", err)
|
|
|
+ }
|
|
|
+ if err = ctlV3Put(cx, "withlease", "withlease", leaseID); err != nil {
|
|
|
+ cx.t.Fatalf("snapshot: ctlV3Put error (%v)", err)
|
|
|
+ }
|
|
|
+
|
|
|
fpath := "test.snapshot"
|
|
|
defer os.RemoveAll(fpath)
|
|
|
|
|
|
- if err := ctlV3SnapshotSave(cx, fpath); err != nil {
|
|
|
+ if err = ctlV3SnapshotSave(cx, fpath); err != nil {
|
|
|
cx.t.Fatalf("snapshotTest ctlV3SnapshotSave error (%v)", err)
|
|
|
}
|
|
|
|
|
|
@@ -45,11 +53,11 @@ func snapshotTest(cx ctlCtx) {
|
|
|
if err != nil {
|
|
|
cx.t.Fatalf("snapshotTest getSnapshotStatus error (%v)", err)
|
|
|
}
|
|
|
- if st.Revision != 4 {
|
|
|
+ if st.Revision != 5 {
|
|
|
cx.t.Fatalf("expected 4, got %d", st.Revision)
|
|
|
}
|
|
|
- if st.TotalKey < 3 {
|
|
|
- cx.t.Fatalf("expected at least 3, got %d", st.TotalKey)
|
|
|
+ if st.TotalKey < 4 {
|
|
|
+ cx.t.Fatalf("expected at least 4, got %d", st.TotalKey)
|
|
|
}
|
|
|
}
|
|
|
|