Commit c68c0994 authored by Kirill Smelkov's avatar Kirill Smelkov

go/zodb: tests: Teach tDB.Commit to return committed TID

And use that in the callers.
parent 1d9bbb0b
......@@ -317,7 +317,7 @@ func (t *tDB) Add(oid Oid, value string) {
}
// Commit commits objects queued by Add.
func (t *tDB) Commit() {
func (t *tDB) Commit() Tid {
t.Helper()
head, err := ZPyCommit(t.zurl, t.head, t.commitq...)
......@@ -326,6 +326,7 @@ func (t *tDB) Commit() {
}
t.head = head
t.commitq = nil
return head
}
// Open opens new test transaction/connection.
......@@ -473,13 +474,11 @@ func testPersistentDB(t0 *testing.T, rawcache bool) {
tdb.Add(101, "bonjour")
tdb.Add(102, "monde")
tdb.Commit()
at0 := tdb.head
at0 := tdb.Commit()
tdb.Add(101, "hello")
tdb.Add(102, "world")
tdb.Commit()
at1 := tdb.head
at1 := tdb.Commit()
tdb.Reopen() // so that at0 is not covered by db.δtail
db := tdb.db
......@@ -541,8 +540,7 @@ func testPersistentDB(t0 *testing.T, rawcache bool) {
// commit change to obj2 from external process
tdb.Add(102, "kitty")
tdb.Commit()
at2 := tdb.head
at2 := tdb.Commit()
// new db connection should see the change
t2 := tdb.Open(&ConnOptions{})
......@@ -730,8 +728,7 @@ func TestLiveCache(t0 *testing.T) {
tdb.Add(102, "труд")
tdb.Add(103, "май")
tdb.Add(104, "весна")
tdb.Commit()
at1 := tdb.head
at1 := tdb.Commit()
zcc := &zcacheControl{map[Oid]PCachePolicy{
// obj1 - default (currently: don't pin and don't keep state)
......
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