v.io/v23/syncbase: call context.CancelFunc functions

In a previous cleanup, we made sure to call all context.CancelFunc
functions where we would otherwise leak memory.

The check in change 22953 is now more strict.  It enforces the spec of
Go's context package, which requires that the context.CancelFunc
be called, even if the context will be cancelled by other means.

This change fixes up the places in syncbase that the new check
reveals.

MultiPart: 1/2
Change-Id: I4b3671302f5916be1899342cdcacce70f3122b14
diff --git a/syncbase/cr_connection_test.go b/syncbase/cr_connection_test.go
index dae860a..618655e 100644
--- a/syncbase/cr_connection_test.go
+++ b/syncbase/cr_connection_test.go
@@ -50,7 +50,7 @@
 	db.c = crtestutil.MockDbClient(db.c, crStream)
 	db.crState.reconnectWaitTime = 10 * time.Millisecond
 
-	ctx, _ := context.RootContext()
+	ctx, cancel := context.RootContext()
 	st.Mu.Lock()                                     // causes Advance() to block
 	db.EnforceSchema(ctx)                            // kicks off the CR thread
 	for i := 0; i < 100 && !st.GetIsBlocked(); i++ { // wait till Advance() call is blocked
@@ -70,6 +70,7 @@
 	if st.GetIsBlocked() {
 		t.Error("Error: The conflict resolution routine did not die")
 	}
+	cancel()
 }
 
 // TestCrConnectionReestablish tests if the CR thread reestablishes a broken
@@ -105,7 +106,7 @@
 	db.c = crtestutil.MockDbClient(db.c, crStream)
 	db.crState.reconnectWaitTime = 10 * time.Millisecond
 
-	ctx, _ := context.RootContext()
+	ctx, cancel := context.RootContext()
 	st.Mu.Lock() // causes Advance() to block
 	db.EnforceSchema(ctx)
 	for i := 0; i < 100 && !st.GetIsBlocked(); i++ {
@@ -122,6 +123,7 @@
 	// Shutdown the cr routine
 	db.Close()
 	st.Mu.Unlock()
+	cancel()
 }
 
 func getSchema(cr ConflictResolver) *Schema {
diff --git a/syncbase/cr_test.go b/syncbase/cr_test.go
index 8691057..b127e30 100644
--- a/syncbase/cr_test.go
+++ b/syncbase/cr_test.go
@@ -294,8 +294,9 @@
 	st.Mu.Lock() // causes Advance() to block
 	defer st.Mu.Unlock()
 
-	ctx, _ := context.RootContext()
+	ctx, cancel := context.RootContext()
 	db.EnforceSchema(ctx)
+	defer cancel()
 	defer db.Close()
 	for i := 0; i < 100 && (len(st.GetResult()) != len(expResult)); i++ {
 		time.Sleep(time.Millisecond) // wait till Advance() call is blocked