File tree 2 files changed +14
-15
lines changed
2 files changed +14
-15
lines changed Original file line number Diff line number Diff line change @@ -269,21 +269,14 @@ def _clear_cluster_routing(self, verify=False):
269
269
a transient setting once its set without restarting the cluster, so we
270
270
explicitly set the default value (`all`) instead.
271
271
"""
272
- self .adapter .cluster_routing (enabled = True ) # default value
272
+ try :
273
+ self .adapter ._cluster_put_settings ({"cluster.routing.allocation.enable" : None })
274
+ except TransportError :
275
+ # TransportError(400, 'action_request_validation_exception', 'Validation Failed: 1: no settings to update;') # noqa: E501
276
+ pass
273
277
if verify :
274
278
settings = self .adapter ._es .cluster .get_settings (flat_settings = True )
275
- self .assertEqual (settings ["transient" ]["cluster.routing.allocation.enable" ], "all" )
276
- #
277
- # The code below is better. Use it instead when able Elastic v5+
278
- #
279
- #try:
280
- # self.adapter._cluster_put_settings({"cluster.routing.allocation.enable": None})
281
- #except TransportError:
282
- # # TransportError(400, 'action_request_validation_exception', 'Validation Failed: 1: no settings to update;') # noqa: E501
283
- # pass
284
- #if verify:
285
- # settings = self.adapter._es.cluster.get_settings(flat_settings=True)
286
- # self.assertIsNone(settings["transient"].get("cluster.routing.allocation.enable"))
279
+ self .assertIsNone (settings ["transient" ].get ("cluster.routing.allocation.enable" ))
287
280
288
281
def test_get_node_info (self ):
289
282
info = self .adapter ._es .nodes .info ()
Original file line number Diff line number Diff line change @@ -140,7 +140,10 @@ def test_fails_if_index_exists(self):
140
140
migration = TestMigration (CreateIndex (* self .create_index_args ))
141
141
with self .assertRaises (RequestError ) as context :
142
142
migration .apply ()
143
- self .assertEqual (context .exception .error , "index_already_exists_exception" )
143
+ if manager .elastic_major_version >= 6 :
144
+ self .assertEqual (context .exception .error , "resource_already_exists_exception" )
145
+ else :
146
+ self .assertEqual (context .exception .error , "index_already_exists_exception" )
144
147
145
148
def test_reverse_deletes_index (self ):
146
149
migration = TestMigration (CreateIndex (* self .create_index_args ))
@@ -473,7 +476,10 @@ def test_reverse_fails_if_index_exists(self):
473
476
)
474
477
with self .assertRaises (RequestError ) as context :
475
478
migration .unapply ()
476
- self .assertEqual (context .exception .error , "index_already_exists_exception" )
479
+ if manager .elastic_major_version >= 6 :
480
+ self .assertEqual (context .exception .error , "resource_already_exists_exception" )
481
+ else :
482
+ self .assertEqual (context .exception .error , "index_already_exists_exception" )
477
483
478
484
def test_describe (self ):
479
485
operation = DeleteIndex (self .index )
You can’t perform that action at this time.
0 commit comments