2626-include_lib (" stdlib/include/assert.hrl" ).
2727
2828-define (DEFAULT_RING_SIZE , 8 ).
29- -define (CFG (),
29+ -define (CFG (MetadataVersion ),
3030 [{riak_kv ,
3131 [
3232 % Speedy AAE configuration
3333 {anti_entropy , {off , []}},
34- {tictacaae_active , passive }
34+ {tictacaae_active , passive },
35+ {metadata_version , MetadataVersion }
3536 ]},
3637 {riak_core ,
3738 [
4445-define (N_VAL , 3 ).
4546
4647confirm () ->
47- C0 = rt :build_cluster (? NUM_NODES , ? CFG ()),
48+ C0 = rt :build_cluster (? NUM_NODES , ? CFG (v0 )),
4849 ok = rt :wait_until_nodes_agree_about_ownership (C0 ),
4950 ok = verify_siblingmerge (C0 ),
51+ rt :clean_cluster (C0 ),
52+ C1 = rt :build_cluster (? NUM_NODES , ? CFG (v1 )),
53+ ok = rt :wait_until_nodes_agree_about_ownership (C1 ),
54+ ok = verify_siblingmerge (C1 ),
5055 pass .
5156
5257
@@ -66,6 +71,36 @@ verify_siblingmerge(Cluster) ->
6671 ExpectedValsBoth = [<<1 :8 /integer >>, <<2 :8 /integer >>],
6772 test_replicas (Node1A , ? AMT_BUCKET , to_key (1 ), ExpectedValsBoth ),
6873
74+ ? LOG_INFO (" Test the HTTP API represents siblings as expected" ),
75+
76+ application :ensure_started (inets ),
77+
78+ {ok , _HTTPPid } = inets :start (httpc , [{profile , test_client }]),
79+ URLBase = rt :http_url (Node1A ),
80+ KeyURL =
81+ io_lib :format (
82+ " ~s /buckets/~s /keys/~s " ,
83+ [URLBase , ? AMT_BUCKET , to_key (1 )]
84+ ),
85+ {ok , Result } = httpc :request (KeyURL ),
86+
87+ ? assertMatch (300 , element (2 , element (1 , Result ))),
88+ [" Siblings:" , VT1 , VT2 ] = string :tokens (element (3 , Result ), " \n " ),
89+ ? LOG_INFO (" Vtags of siblings ~s ~s " , [VT1 , VT2 ]),
90+
91+ ? LOG_INFO (" Test that individual siblings can be fetched" ),
92+
93+ {ok , R1 } = httpc :request (io_lib :format (" ~s ?vtag=~s " , [KeyURL , VT1 ])),
94+ {ok , R2 } = httpc :request (io_lib :format (" ~s ?vtag=~s " , [KeyURL , VT2 ])),
95+
96+ ? assertMatch (200 , element (2 , element (1 , R1 ))),
97+ ? assertMatch (200 , element (2 , element (1 , R2 ))),
98+
99+ BothResults = element (3 ,R1 ) ++ element (3 , R2 ),
100+ ? assertMatch ([1 , 2 ], lists :sort (BothResults )),
101+
102+ inets :stop (httpc , test_client ),
103+
69104 ? LOG_INFO (" Testing allow_mult = false" ),
70105 {Node1B , Node2B } =
71106 select_two_different_primarynodes (Cluster , ? AMF_BUCKET , to_key (1 )),
0 commit comments