def test_add_to_alias_with_closed(self): alias = 'testalias' self.create_index('dummy') self.client.indices.put_alias(index='dummy', name=alias) self.create_index('foo') curator.close_indices(self.client, 'foo') self.assertTrue(curator.index_closed(self.client, 'foo')) curator.add_to_alias(self.client, 'foo', alias=alias) self.assertFalse(curator.add_to_alias(self.client, 'foo', alias=alias))
def test_close_indices_positive(self): client = Mock() client.info.return_value = {'version': {'number': '1.6.0'} } client.cluster.state.return_value = open_index client.indices.flush_synced.return_value = synced_pass client.indices.close.return_value = None self.assertTrue(curator.close_indices(client, named_index))
def test_close_indices_negative_presyncflush(self): client = Mock() client.info.return_value = {'version': {'number': '1.3.4'} } client.indices.flush.return_value = None client.indices.close.side_effect = fake_fail client.indices.close.return_value = None self.assertFalse(curator.close_indices(client, named_index))
def test_close_indices_positive(self): client = Mock() client.cluster.state.return_value = open_index client.indices.flush_synced.return_value = synced_pass client.info.return_value = {'version': {'number': '1.6.0'} } client.indices.close.return_value = None self.assertTrue(curator.close_indices(client, named_index))
def test_index_will_be_closed(self): self.create_index('test_index') self.assertTrue(curator.close_indices(self.client, 'test_index')) index_metadata = self.client.cluster.state( index='test_index', metric='metadata', ) self.assertEquals('close', index_metadata['metadata']['indices']['test_index']['state'])
def test_close_indices_negative(self): client = Mock() client.cluster.state.return_value = open_index client.indices.flush_synced.return_value = synced_fail client.info.return_value = {'version': {'number': '1.6.0'} } client.indices.close.side_effect = fake_fail client.indices.close.return_value = None self.assertFalse(curator.close_indices(client, named_index))
def test_close_indices_positive_cat(self): client = Mock() client.cluster.state.side_effect = four_oh_one client.cat.indices.return_value = cat_open_index client.indices.flush_synced.return_value = synced_pass client.info.return_value = {"version": {"number": "1.6.0"}} client.indices.close.return_value = None self.assertTrue(curator.close_indices(client, named_index))
def test_close_indices_negative(self): client = Mock() client.info.return_value = {'version': {'number': '1.6.0'} } client.indices.flush_synced.return_value = synced_fail client.cluster.state.return_value = open_index client.indices.close.side_effect = fake_fail client.indices.close.return_value = None self.assertFalse(curator.close_indices(client, named_index))
def test_index_will_be_closed(self): self.create_index('test_index') self.assertTrue(curator.close_indices(self.client, 'test_index')) index_metadata = self.client.cluster.state( index='test_index', metric='metadata', ) self.assertEquals( 'close', index_metadata['metadata']['indices']['test_index']['state'])
def test_close_indices_negative(self): client = Mock() client.indices.flush.side_effect = fake_fail client.indices.close.return_value = None self.assertFalse(curator.close_indices(client, named_index))
def test_close_indices_positive(self): client = Mock() client.indices.flush.return_value = None client.indices.close.return_value = None self.assertTrue(curator.close_indices(client, named_index))
def test_close_indices_positive_presyncflush(self): client = Mock() client.info.return_value = {'version': {'number': '1.3.4'} } client.indices.flush.return_value = None client.indices.close.return_value = None self.assertTrue(curator.close_indices(client, named_index))