@@ -44,7 +44,7 @@ public void checkScyllaVersion() {
4444 public void should_not_ignore_zero_token_peer_when_option_is_enabled () {
4545 CqlSession session = null ;
4646 CcmBridge .Builder ccmBridgeBuilder = CcmBridge .builder ();
47- try (CcmBridge ccmBridge = ccmBridgeBuilder .withNodes (3 ).withIpPrefix ( "127.0.1." ). build ()) {
47+ try (CcmBridge ccmBridge = ccmBridgeBuilder .withNodes (3 ).build ()) {
4848 ccmBridge .create ();
4949 ccmBridge .startWithArgs ("--wait-for-binary-proto" );
5050 ccmBridge .addWithoutStart (4 , "dc1" );
@@ -63,8 +63,13 @@ public void should_not_ignore_zero_token_peer_when_option_is_enabled() {
6363 Collection <Node > nodes = session .getMetadata ().getNodes ().values ();
6464 Set <String > toStrings =
6565 nodes .stream ().map (Node ::getEndPoint ).map (EndPoint ::toString ).collect (Collectors .toSet ());
66+
6667 assertThat (toStrings )
67- .containsOnly ("/127.0.1.1:9042" , "/127.0.1.2:9042" , "/127.0.1.3:9042" , "/127.0.1.4:9042" );
68+ .containsOnly (
69+ String .format ("/%s:9042" , ccmBridge .getNodeIpAddress (1 )),
70+ String .format ("/%s:9042" , ccmBridge .getNodeIpAddress (2 )),
71+ String .format ("/%s:9042" , ccmBridge .getNodeIpAddress (3 )),
72+ String .format ("/%s:9042" , ccmBridge .getNodeIpAddress (4 )));
6873 } finally {
6974 if (session != null ) session .close ();
7075 }
@@ -74,7 +79,7 @@ public void should_not_ignore_zero_token_peer_when_option_is_enabled() {
7479 public void should_not_discover_zero_token_DC_when_option_is_disabled () {
7580 CqlSession session = null ;
7681 CcmBridge .Builder ccmBridgeBuilder = CcmBridge .builder ();
77- try (CcmBridge ccmBridge = ccmBridgeBuilder .withNodes (2 , 2 ).withIpPrefix ( "127.0.1." ). build ()) {
82+ try (CcmBridge ccmBridge = ccmBridgeBuilder .withNodes (2 , 2 ).build ()) {
7883 ccmBridge .create ();
7984 ccmBridge .updateNodeConfig (3 , "join_ring" , false );
8085 ccmBridge .updateNodeConfig (4 , "join_ring" , false );
@@ -97,11 +102,13 @@ public void should_not_discover_zero_token_DC_when_option_is_disabled() {
97102 Objects .requireNonNull (rs .one ()).getInetAddress ("rpc_address" );
98103 landedOn .add (Objects .requireNonNull (broadcastRpcInetAddress ).toString ());
99104 }
100- assertThat (landedOn ).containsOnly ("/127.0.1.1" , "/127.0.1.2" );
105+ assertThat (landedOn )
106+ .containsOnly ("/" + ccmBridge .getNodeIpAddress (1 ), "/" + ccmBridge .getNodeIpAddress (2 ));
101107 Collection <Node > nodes = session .getMetadata ().getNodes ().values ();
102108 Set <String > toStrings =
103109 nodes .stream ().map (Node ::getEndPoint ).map (EndPoint ::toString ).collect (Collectors .toSet ());
104- assertThat (toStrings ).containsOnly ("/127.0.1.1:9042" , "/127.0.1.2:9042" );
110+ assertThat (toStrings )
111+ .containsOnly ("/" + ccmBridge .getNodeIpAddress (1 ), "/" + ccmBridge .getNodeIpAddress (2 ));
105112 } finally {
106113 if (session != null ) session .close ();
107114 }
@@ -111,7 +118,7 @@ public void should_not_discover_zero_token_DC_when_option_is_disabled() {
111118 public void should_discover_zero_token_DC_when_option_is_enabled () {
112119 CqlSession session = null ;
113120 CcmBridge .Builder ccmBridgeBuilder = CcmBridge .builder ();
114- try (CcmBridge ccmBridge = ccmBridgeBuilder .withNodes (2 , 2 ).withIpPrefix ( "127.0.1." ). build ()) {
121+ try (CcmBridge ccmBridge = ccmBridgeBuilder .withNodes (2 , 2 ).build ()) {
115122 ccmBridge .create ();
116123 ccmBridge .updateNodeConfig (3 , "join_ring" , false );
117124 ccmBridge .updateNodeConfig (4 , "join_ring" , false );
@@ -136,13 +143,18 @@ public void should_discover_zero_token_DC_when_option_is_enabled() {
136143 landedOn .add (Objects .requireNonNull (broadcastRpcInetAddress ).toString ());
137144 }
138145 // LBP should still target local datacenter:
139- assertThat (landedOn ).containsOnly ("/127.0.1.1" , "/127.0.1.2" );
146+ assertThat (landedOn )
147+ .containsOnly ("/" + ccmBridge .getNodeIpAddress (1 ), "/" + ccmBridge .getNodeIpAddress (2 ));
140148 Collection <Node > nodes = session .getMetadata ().getNodes ().values ();
141149 Set <String > toStrings =
142150 nodes .stream ().map (Node ::getEndPoint ).map (EndPoint ::toString ).collect (Collectors .toSet ());
143151 // Metadata should have all nodes:
144152 assertThat (toStrings )
145- .containsOnly ("/127.0.1.1:9042" , "/127.0.1.2:9042" , "/127.0.1.3:9042" , "/127.0.1.4:9042" );
153+ .containsOnly (
154+ "/" + ccmBridge .getNodeIpAddress (1 ),
155+ "/" + ccmBridge .getNodeIpAddress (2 ),
156+ "/" + ccmBridge .getNodeIpAddress (3 ),
157+ "/" + ccmBridge .getNodeIpAddress (4 ));
146158 } finally {
147159 if (session != null ) session .close ();
148160 }
@@ -152,7 +164,7 @@ public void should_discover_zero_token_DC_when_option_is_enabled() {
152164 public void should_connect_to_zero_token_contact_point () {
153165 CqlSession session = null ;
154166 CcmBridge .Builder ccmBridgeBuilder = CcmBridge .builder ();
155- try (CcmBridge ccmBridge = ccmBridgeBuilder .withNodes (2 ).withIpPrefix ( "127.0.1." ). build ()) {
167+ try (CcmBridge ccmBridge = ccmBridgeBuilder .withNodes (2 ).build ()) {
156168 ccmBridge .create ();
157169 ccmBridge .startWithArgs ("--wait-for-binary-proto" );
158170 ccmBridge .addWithoutStart (3 , "dc1" );
@@ -169,7 +181,11 @@ public void should_connect_to_zero_token_contact_point() {
169181 Collection <Node > nodes = session .getMetadata ().getNodes ().values ();
170182 Set <String > toStrings =
171183 nodes .stream ().map (Node ::getEndPoint ).map (EndPoint ::toString ).collect (Collectors .toSet ());
172- assertThat (toStrings ).containsOnly ("/127.0.1.1:9042" , "/127.0.1.2:9042" , "/127.0.1.3:9042" );
184+ assertThat (toStrings )
185+ .containsOnly (
186+ "/" + ccmBridge .getNodeIpAddress (1 ),
187+ "/" + ccmBridge .getNodeIpAddress (2 ),
188+ "/" + ccmBridge .getNodeIpAddress (3 ));
173189 } finally {
174190 if (session != null ) session .close ();
175191 }
@@ -182,7 +198,7 @@ public void should_connect_to_zero_token_DC() {
182198 // method.
183199 CqlSession session = null ;
184200 CcmBridge .Builder ccmBridgeBuilder = CcmBridge .builder ();
185- try (CcmBridge ccmBridge = ccmBridgeBuilder .withNodes (2 , 2 ).withIpPrefix ( "127.0.1." ). build ()) {
201+ try (CcmBridge ccmBridge = ccmBridgeBuilder .withNodes (2 , 2 ).build ()) {
186202 ccmBridge .create ();
187203 ccmBridge .updateNodeConfig (3 , "join_ring" , false );
188204 ccmBridge .updateNodeConfig (4 , "join_ring" , false );
@@ -207,12 +223,17 @@ public void should_connect_to_zero_token_DC() {
207223 landedOn .add (Objects .requireNonNull (broadcastRpcInetAddress ).toString ());
208224 }
209225 // LBP should still target local datacenter:
210- assertThat (landedOn ).containsOnly ("/127.0.1.1" , "/127.0.1.2" );
226+ assertThat (landedOn )
227+ .containsOnly ("/" + ccmBridge .getNodeIpAddress (1 ), "/" + ccmBridge .getNodeIpAddress (2 ));
211228 Collection <Node > nodes = session .getMetadata ().getNodes ().values ();
212229 Set <String > toStrings =
213230 nodes .stream ().map (Node ::getEndPoint ).map (EndPoint ::toString ).collect (Collectors .toSet ());
214231 // Metadata should have valid ordinary peers plus zero-token contact point:
215- assertThat (toStrings ).containsOnly ("/127.0.1.1:9042" , "/127.0.1.2:9042" , "/127.0.1.3:9042" );
232+ assertThat (toStrings )
233+ .containsOnly (
234+ "/" + ccmBridge .getNodeIpAddress (1 ),
235+ "/" + ccmBridge .getNodeIpAddress (2 ),
236+ "/" + ccmBridge .getNodeIpAddress (3 ));
216237 } finally {
217238 if (session != null ) session .close ();
218239 }
0 commit comments