@@ -56,17 +56,6 @@ func (t singleActorTest) collectionName() base.ScopeAndCollectionName {
5656 return getSingleDsName ()
5757}
5858
59- // getSingleActorTestCase returns a list of test cases in the matrix for all topologies * active peers.
60- func getSingleActorTestCase () []singleActorTest {
61- var tests []singleActorTest
62- for _ , tc := range append (simpleTopologies , Topologies ... ) {
63- for _ , activePeerID := range tc .PeerNames () {
64- tests = append (tests , singleActorTest {topology : tc , activePeerID : activePeerID })
65- }
66- }
67- return tests
68- }
69-
7059// multiActorTest represents a test case for a single actor in a given topology.
7160type multiActorTest struct {
7261 topology Topology
@@ -118,14 +107,19 @@ func startPeerReplications(peerReplications []PeerReplication) {
118107func TestHLVCreateDocumentSingleActor (t * testing.T ) {
119108
120109 base .SetUpTestLogging (t , base .LevelDebug , base .KeyCRUD , base .KeyImport , base .KeyVV )
121- for _ , tc := range getSingleActorTestCase () {
122- t .Run (tc .description (), func (t * testing.T ) {
123- peers , _ := setupTests (t , tc .topology , tc .activePeerID )
124-
125- docID := getDocID (t )
126- docBody := []byte (fmt .Sprintf (`{"peer": "%s", "topology": "%s"}` , tc .activePeerID , tc .description ()))
127- docVersion := peers [tc .activePeerID ].CreateDocument (tc .collectionName (), docID , docBody )
128- waitForVersionAndBody (t , tc , peers , docID , docVersion )
110+ for _ , topology := range append (simpleTopologies , Topologies ... ) {
111+ t .Run (topology .description , func (t * testing.T ) {
112+ peers , _ := setupTests (t , topology )
113+ for _ , activePeerID := range topology .PeerNames () {
114+ t .Run (fmt .Sprintf ("actor=%s" , activePeerID ), func (t * testing.T ) {
115+ updatePeersT (t , peers )
116+ tc := singleActorTest {topology : topology , activePeerID : activePeerID }
117+ docID := getDocID (t )
118+ docBody := []byte (fmt .Sprintf (`{"peer": "%s", "topology": "%s"}` , activePeerID , tc .description ()))
119+ docVersion := peers [activePeerID ].CreateDocument (getSingleDsName (), docID , docBody )
120+ waitForVersionAndBody (t , tc , peers , docID , docVersion )
121+ })
122+ }
129123 })
130124 }
131125}
@@ -135,7 +129,7 @@ func TestHLVCreateDocumentMultiActor(t *testing.T) {
135129
136130 for _ , tc := range getMultiActorTestCases () {
137131 t .Run (tc .description (), func (t * testing.T ) {
138- peers , _ := setupTests (t , tc .topology , "" )
132+ peers , _ := setupTests (t , tc .topology )
139133
140134 var docVersionList []BodyAndVersion
141135
@@ -173,7 +167,7 @@ func TestHLVCreateDocumentMultiActorConflict(t *testing.T) {
173167 t .Skip ("We need to be able to wait for a specific version to arrive over pull replication, CBG-4257" )
174168 }
175169 t .Run (tc .description (), func (t * testing.T ) {
176- peers , replications := setupTests (t , tc .topology , "" )
170+ peers , replications := setupTests (t , tc .topology )
177171
178172 stopPeerReplications (replications )
179173
@@ -196,7 +190,7 @@ func TestHLVUpdateDocumentMultiActor(t *testing.T) {
196190 if strings .Contains (tc .description (), "CBL" ) {
197191 t .Skip ("Skipping Couchbase Lite test, returns unexpected body in proposeChanges: [304], CBG-4257" )
198192 }
199- peers , _ := setupTests (t , tc .topology , "" )
193+ peers , _ := setupTests (t , tc .topology )
200194
201195 // grab sorted peer list and create a list to store expected version,
202196 // doc body and the peer the write came from
@@ -228,25 +222,32 @@ func TestHLVUpdateDocumentMultiActor(t *testing.T) {
228222func TestHLVUpdateDocumentSingleActor (t * testing.T ) {
229223
230224 base .SetUpTestLogging (t , base .LevelDebug , base .KeyCRUD , base .KeyImport , base .KeyVV )
231- for _ , tc := range getSingleActorTestCase () {
232- t .Run (tc .description (), func (t * testing.T ) {
233- if strings .HasPrefix (tc .activePeerID , "cbl" ) {
234- t .Skip ("Skipping Couchbase Lite test, returns unexpected body in proposeChanges: [304], CBG-4257" )
235- }
236- peers , _ := setupTests (t , tc .topology , tc .activePeerID )
237225
238- docID := getDocID (t )
239- body1 := []byte (fmt .Sprintf (`{"peer": "%s", "topology": "%s", "write": 1}` , tc .activePeerID , tc .description ()))
240- createVersion := peers [tc .activePeerID ].CreateDocument (tc .collectionName (), docID , body1 )
226+ for _ , topology := range append (simpleTopologies , Topologies ... ) {
227+ t .Run (topology .description , func (t * testing.T ) {
228+ peers , _ := setupTests (t , topology )
229+ for _ , activePeerID := range topology .PeerNames () {
230+ t .Run (fmt .Sprintf ("actor=%s" , activePeerID ), func (t * testing.T ) {
231+ updatePeersT (t , peers )
232+ tc := singleActorTest {topology : topology , activePeerID : activePeerID }
233+ if strings .HasPrefix (tc .activePeerID , "cbl" ) {
234+ t .Skip ("Skipping Couchbase Lite test, returns unexpected body in proposeChanges: [304], CBG-4257" )
235+ }
236+
237+ docID := getDocID (t )
238+ body1 := []byte (fmt .Sprintf (`{"peer": "%s", "topology": "%s", "write": 1}` , tc .activePeerID , tc .description ()))
239+ createVersion := peers [tc .activePeerID ].CreateDocument (tc .collectionName (), docID , body1 )
241240
242- waitForVersionAndBody (t , tc , peers , docID , createVersion )
241+ waitForVersionAndBody (t , tc , peers , docID , createVersion )
243242
244- body2 := []byte (fmt .Sprintf (`{"peer": "%s", "topology": "%s", "write": 2}` , tc .activePeerID , tc .description ()))
245- updateVersion := peers [tc .activePeerID ].WriteDocument (tc .collectionName (), docID , body2 )
246- t .Logf ("createVersion: %+v, updateVersion: %+v" , createVersion .docMeta , updateVersion .docMeta )
247- t .Logf ("waiting for document version 2 on all peers" )
243+ body2 := []byte (fmt .Sprintf (`{"peer": "%s", "topology": "%s", "write": 2}` , tc .activePeerID , tc .description ()))
244+ updateVersion := peers [tc .activePeerID ].WriteDocument (tc .collectionName (), docID , body2 )
245+ t .Logf ("createVersion: %+v, updateVersion: %+v" , createVersion .docMeta , updateVersion .docMeta )
246+ t .Logf ("waiting for document version 2 on all peers" )
248247
249- waitForVersionAndBody (t , tc , peers , docID , updateVersion )
248+ waitForVersionAndBody (t , tc , peers , docID , updateVersion )
249+ })
250+ }
250251 })
251252 }
252253}
@@ -272,7 +273,7 @@ func TestHLVUpdateDocumentMultiActorConflict(t *testing.T) {
272273 t .Skip ("We need to be able to wait for a specific version to arrive over pull replication + unexpected body in proposeChanges: [304] issue, CBG-4257" )
273274 }
274275 t .Run (tc .description (), func (t * testing.T ) {
275- peers , replications := setupTests (t , tc .topology , "" )
276+ peers , replications := setupTests (t , tc .topology )
276277 stopPeerReplications (replications )
277278
278279 docID := getDocID (t )
@@ -294,23 +295,31 @@ func TestHLVUpdateDocumentMultiActorConflict(t *testing.T) {
294295func TestHLVDeleteDocumentSingleActor (t * testing.T ) {
295296
296297 base .SetUpTestLogging (t , base .LevelDebug , base .KeyImport , base .KeyVV )
297- for _ , tc := range getSingleActorTestCase () {
298- t .Run (tc .description (), func (t * testing.T ) {
299- if strings .HasPrefix (tc .activePeerID , "cbl" ) {
300- t .Skip ("Skipping Couchbase Lite test, does not know how to push a deletion yet CBG-4257" )
301- }
302- peers , _ := setupTests (t , tc .topology , tc .activePeerID )
303298
304- docID := getDocID (t )
305- body1 := []byte (fmt .Sprintf (`{"peer": "%s", "topology": "%s", "write": 1}` , tc .activePeerID , tc .description ()))
306- createVersion := peers [tc .activePeerID ].CreateDocument (tc .collectionName (), docID , body1 )
299+ for _ , topology := range append (simpleTopologies , Topologies ... ) {
300+ t .Run (topology .description , func (t * testing.T ) {
301+ peers , _ := setupTests (t , topology )
302+ for _ , activePeerID := range topology .PeerNames () {
303+ t .Run (fmt .Sprintf ("actor=%s" , activePeerID ), func (t * testing.T ) {
304+ updatePeersT (t , peers )
305+ tc := singleActorTest {topology : topology , activePeerID : activePeerID }
307306
308- waitForVersionAndBody (t , tc , peers , docID , createVersion )
307+ if strings .HasPrefix (tc .activePeerID , "cbl" ) {
308+ t .Skip ("Skipping Couchbase Lite test, does not know how to push a deletion yet CBG-4257" )
309+ }
310+
311+ docID := getDocID (t )
312+ body1 := []byte (fmt .Sprintf (`{"peer": "%s", "topology": "%s", "write": 1}` , tc .activePeerID , tc .description ()))
313+ createVersion := peers [tc .activePeerID ].CreateDocument (tc .collectionName (), docID , body1 )
309314
310- deleteVersion := peers [tc .activePeerID ].DeleteDocument (tc .collectionName (), docID )
311- t .Logf ("createVersion: %+v, deleteVersion: %+v" , createVersion .docMeta , deleteVersion )
312- t .Logf ("waiting for document deletion on all peers" )
313- waitForDeletion (t , tc , peers , docID , tc .activePeerID )
315+ waitForVersionAndBody (t , tc , peers , docID , createVersion )
316+
317+ deleteVersion := peers [tc .activePeerID ].DeleteDocument (tc .collectionName (), docID )
318+ t .Logf ("createVersion: %+v, deleteVersion: %+v" , createVersion .docMeta , deleteVersion )
319+ t .Logf ("waiting for document deletion on all peers" )
320+ waitForDeletion (t , tc , peers , docID , tc .activePeerID )
321+ })
322+ }
314323 })
315324 }
316325}
@@ -323,7 +332,7 @@ func TestHLVDeleteDocumentMultiActor(t *testing.T) {
323332 if strings .Contains (tc .description (), "CBL" ) {
324333 t .Skip ("Skipping Couchbase Lite test, does not know how to push a deletion yet CBG-4257" )
325334 }
326- peers , _ := setupTests (t , tc .topology , "" )
335+ peers , _ := setupTests (t , tc .topology )
327336
328337 for peerName := range peers {
329338 docID := getDocID (t ) + "_" + peerName
@@ -368,7 +377,7 @@ func TestHLVDeleteDocumentMultiActorConflict(t *testing.T) {
368377 t .Skip ("We need to be able to wait for a specific version to arrive over pull replication + unexpected body in proposeChanges: [304] issue, CBG-4257" )
369378 }
370379 t .Run (tc .description (), func (t * testing.T ) {
371- peers , replications := setupTests (t , tc .topology , "" )
380+ peers , replications := setupTests (t , tc .topology )
372381 stopPeerReplications (replications )
373382
374383 docID := getDocID (t )
@@ -408,7 +417,7 @@ func TestHLVUpdateDeleteDocumentMultiActorConflict(t *testing.T) {
408417 }
409418 t .Run (tc .description (), func (t * testing.T ) {
410419 peerList := tc .PeerNames ()
411- peers , replications := setupTests (t , tc .topology , "" )
420+ peers , replications := setupTests (t , tc .topology )
412421 stopPeerReplications (replications )
413422
414423 docID := getDocID (t )
@@ -453,7 +462,7 @@ func TestHLVDeleteUpdateDocumentMultiActorConflict(t *testing.T) {
453462 }
454463 t .Run (tc .description (), func (t * testing.T ) {
455464 peerList := tc .PeerNames ()
456- peers , replications := setupTests (t , tc .topology , "" )
465+ peers , replications := setupTests (t , tc .topology )
457466 stopPeerReplications (replications )
458467
459468 docID := getDocID (t )
@@ -481,38 +490,43 @@ func TestHLVDeleteUpdateDocumentMultiActorConflict(t *testing.T) {
481490func TestHLVResurrectDocumentSingleActor (t * testing.T ) {
482491
483492 base .SetUpTestLogging (t , base .LevelDebug , base .KeyImport , base .KeyVV )
484- for _ , tc := range getSingleActorTestCase () {
485- t .Run (tc .description (), func (t * testing.T ) {
486- if strings .HasPrefix (tc .activePeerID , "cbl" ) {
487- t .Skip ("Skipping Couchbase Lite test, does not know how to push a deletion yet CBG-4257" )
488- }
489- t .Skip ("Skipping resurection tests CBG-4366" )
493+ for _ , topology := range append (simpleTopologies , Topologies ... ) {
494+ t .Run (topology .description , func (t * testing.T ) {
495+ peers , _ := setupTests (t , topology )
496+ for _ , activePeerID := range topology .PeerNames () {
497+ t .Run (fmt .Sprintf ("actor=%s" , activePeerID ), func (t * testing.T ) {
498+ updatePeersT (t , peers )
499+ tc := singleActorTest {topology : topology , activePeerID : activePeerID }
500+
501+ if strings .HasPrefix (tc .activePeerID , "cbl" ) {
502+ t .Skip ("Skipping Couchbase Lite test, does not know how to push a deletion yet CBG-4257" )
503+ }
490504
491- peers , _ := setupTests (t , tc .topology , tc .activePeerID )
505+ docID := getDocID (t )
506+ body1 := []byte (fmt .Sprintf (`{"peer": "%s", "topology": "%s", "write": 1}` , tc .activePeerID , tc .description ()))
507+ createVersion := peers [tc .activePeerID ].CreateDocument (tc .collectionName (), docID , body1 )
508+ waitForVersionAndBody (t , tc , peers , docID , createVersion )
492509
493- docID := getDocID (t )
494- body1 := []byte (fmt .Sprintf (`{"peer": "%s", "topology": "%s", "write": 1}` , tc .activePeerID , tc .description ()))
495- createVersion := peers [tc .activePeerID ].CreateDocument (tc .collectionName (), docID , body1 )
496- waitForVersionAndBody (t , tc , peers , docID , createVersion )
497-
498- deleteVersion := peers [tc .activePeerID ].DeleteDocument (tc .collectionName (), docID )
499- t .Logf ("createVersion: %+v, deleteVersion: %+v" , createVersion , deleteVersion )
500- t .Logf ("waiting for document deletion on all peers" )
501- waitForDeletion (t , tc , peers , docID , tc .activePeerID )
502-
503- body2 := []byte (fmt .Sprintf (`{"peer": "%s", "topology": "%s", "write": "resurrection"}` , tc .activePeerID , tc .description ()))
504- resurrectVersion := peers [tc .activePeerID ].WriteDocument (tc .collectionName (), docID , body2 )
505- t .Logf ("createVersion: %+v, deleteVersion: %+v, resurrectVersion: %+v" , createVersion .docMeta , deleteVersion , resurrectVersion .docMeta )
506- t .Logf ("waiting for document resurrection on all peers" )
507-
508- // Couchbase Lite peers do not know how to push a deletion yet, so we need to filter them out CBG-4257
509- nonCBLPeers := make (map [string ]Peer )
510- for peerName , peer := range peers {
511- if ! strings .HasPrefix (peerName , "cbl" ) {
512- nonCBLPeers [peerName ] = peer
513- }
510+ deleteVersion := peers [tc .activePeerID ].DeleteDocument (tc .collectionName (), docID )
511+ t .Logf ("createVersion: %+v, deleteVersion: %+v" , createVersion , deleteVersion )
512+ t .Logf ("waiting for document deletion on all peers" )
513+ waitForDeletion (t , tc , peers , docID , tc .activePeerID )
514+
515+ body2 := []byte (fmt .Sprintf (`{"peer": "%s", "topology": "%s", "write": "resurrection"}` , tc .activePeerID , tc .description ()))
516+ resurrectVersion := peers [tc .activePeerID ].WriteDocument (tc .collectionName (), docID , body2 )
517+ t .Logf ("createVersion: %+v, deleteVersion: %+v, resurrectVersion: %+v" , createVersion .docMeta , deleteVersion , resurrectVersion .docMeta )
518+ t .Logf ("waiting for document resurrection on all peers" )
519+
520+ // Couchbase Lite peers do not know how to push a deletion yet, so we need to filter them out CBG-4257
521+ nonCBLPeers := make (map [string ]Peer )
522+ for peerName , peer := range peers {
523+ if ! strings .HasPrefix (peerName , "cbl" ) {
524+ nonCBLPeers [peerName ] = peer
525+ }
526+ }
527+ waitForVersionAndBody (t , tc , peers , docID , resurrectVersion )
528+ })
514529 }
515- waitForVersionAndBody (t , tc , peers , docID , resurrectVersion )
516530 })
517531 }
518532}
@@ -524,9 +538,8 @@ func TestHLVResurrectDocumentMultiActor(t *testing.T) {
524538 if strings .Contains (tc .description (), "CBL" ) {
525539 t .Skip ("Skipping Couchbase Lite test, does not know how to push a deletion yet CBG-4257" )
526540 }
527- t .Skip ("skipped resurrection test, intermittent failures CBG-4372" )
528541
529- peers , _ := setupTests (t , tc .topology , "" )
542+ peers , _ := setupTests (t , tc .topology )
530543
531544 var docVersionList []BodyAndVersion
532545 for _ , peerName := range tc .PeerNames () {
@@ -578,7 +591,7 @@ func TestHLVResurrectDocumentMultiActorConflict(t *testing.T) {
578591 t .Skip ("We need to be able to wait for a specific version to arrive over pull replication + unexpected body in proposeChanges: [304] issue, CBG-4257" )
579592 }
580593 t .Run (tc .description (), func (t * testing.T ) {
581- peers , replications := setupTests (t , tc .topology , "" )
594+ peers , replications := setupTests (t , tc .topology )
582595 stopPeerReplications (replications )
583596
584597 docID := getDocID (t )
0 commit comments