"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "wal/wal_test.go" between
etcd-3.4.8.tar.gz and etcd-3.4.9.tar.gz

About: etcd is a distributed reliable key-value store for the most critical data of a distributed system (written in "Go").

wal_test.go  (etcd-3.4.8):wal_test.go  (etcd-3.4.9)
skipping to change at line 1006 skipping to change at line 1006
}() }()
walSnaps, serr := ValidSnapshotEntries(zap.NewExample(), p) walSnaps, serr := ValidSnapshotEntries(zap.NewExample(), p)
if serr != nil { if serr != nil {
t.Fatal(serr) t.Fatal(serr)
} }
expected := []walpb.Snapshot{snap0, snap1, snap2, snap3} expected := []walpb.Snapshot{snap0, snap1, snap2, snap3}
if !reflect.DeepEqual(walSnaps, expected) { if !reflect.DeepEqual(walSnaps, expected) {
t.Errorf("expected walSnaps %+v, got %+v", expected, walSnaps) t.Errorf("expected walSnaps %+v, got %+v", expected, walSnaps)
} }
} }
// TestValidSnapshotEntriesAfterPurgeWal ensure that there are many wal files, a
nd after cleaning the first wal file,
// it can work well.
func TestValidSnapshotEntriesAfterPurgeWal(t *testing.T) {
oldSegmentSizeBytes := SegmentSizeBytes
SegmentSizeBytes = 64
defer func() {
SegmentSizeBytes = oldSegmentSizeBytes
}()
p, err := ioutil.TempDir(os.TempDir(), "waltest")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(p)
snap0 := walpb.Snapshot{Index: 0, Term: 0}
snap1 := walpb.Snapshot{Index: 1, Term: 1}
state1 := raftpb.HardState{Commit: 1, Term: 1}
snap2 := walpb.Snapshot{Index: 2, Term: 1}
snap3 := walpb.Snapshot{Index: 3, Term: 2}
state2 := raftpb.HardState{Commit: 3, Term: 2}
func() {
w, werr := Create(zap.NewExample(), p, nil)
if werr != nil {
t.Fatal(werr)
}
defer w.Close()
// snap0 is implicitly created at index 0, term 0
if err = w.SaveSnapshot(snap1); err != nil {
t.Fatal(err)
}
if err = w.Save(state1, nil); err != nil {
t.Fatal(err)
}
if err = w.SaveSnapshot(snap2); err != nil {
t.Fatal(err)
}
if err = w.SaveSnapshot(snap3); err != nil {
t.Fatal(err)
}
for i := 0; i < 128; i++ {
if err = w.Save(state2, nil); err != nil {
t.Fatal(err)
}
}
}()
files, _, ferr := selectWALFiles(nil, p, snap0)
if ferr != nil {
t.Fatal(ferr)
}
os.Remove(p + "/" + files[0])
_, err = ValidSnapshotEntries(zap.NewExample(), p)
if err != nil {
t.Fatal(err)
}
}
 End of changes. 1 change blocks. 
0 lines changed or deleted 0 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)