NewTestClusterTx returns a fresh ClusterTx object, along with a function that can be called to cleanup state when done with it.
(t *testing.T)
| 82 | // NewTestClusterTx returns a fresh ClusterTx object, along with a function that can |
| 83 | // be called to cleanup state when done with it. |
| 84 | func NewTestClusterTx(t *testing.T) (*ClusterTx, func()) { |
| 85 | cluster, clusterCleanup := NewTestCluster(t) |
| 86 | |
| 87 | var err error |
| 88 | |
| 89 | clusterTx := &ClusterTx{nodeID: cluster.nodeID} |
| 90 | clusterTx.tx, err = cluster.db.Begin() |
| 91 | require.NoError(t, err) |
| 92 | |
| 93 | cleanup := func() { |
| 94 | err := clusterTx.tx.Commit() |
| 95 | require.NoError(t, err) |
| 96 | clusterCleanup() |
| 97 | } |
| 98 | |
| 99 | return clusterTx, cleanup |
| 100 | } |
| 101 | |
| 102 | // NewTestCowsqlServer creates a new test cowsql server. |
| 103 | // |
searching dependent graphs…