Esempio n. 1
0
 def test_optimized_index_will_be_skipped(self, get_segmentcount):
     get_segmentcount.return_value = 1, 4
     self.create_index('test_index')
     self.assertTrue(
         curator.optimize_index(self.client,
                                'test_index',
                                max_num_segments=4))
     get_segmentcount.assert_called_once_with(self.client, 'test_index')
Esempio n. 2
0
 def test_unoptimized_index_will_be_optimized(self, get_segmentcount, index_closed):
     get_segmentcount.return_value = 1, 40
     index_closed.return_value = False
     client = Mock()
     self.create_index('test_index')
     self.assertIsNone(curator.optimize_index(client, 'test_index', max_num_segments=4))
     get_segmentcount.assert_called_once_with(client, 'test_index')
     index_closed.assert_called_once_with(client, 'test_index')
     client.indices.optimize.assert_called_once_with(index='test_index', max_num_segments=4)
Esempio n. 3
0
 def test_closed_index_will_be_skipped(self):
     self.create_index('test_index')
     self.client.indices.close(index='test_index')
     self.assertTrue(curator.optimize_index(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'])
Esempio n. 4
0
 def test_closed_index_will_be_skipped(self):
     self.create_index('test_index')
     self.client.indices.close(index='test_index')
     self.assertTrue(curator.optimize_index(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'])
Esempio n. 5
0
 def test_unoptimized_index_will_be_optimized(self, get_segmentcount,
                                              index_closed):
     get_segmentcount.return_value = 1, 40
     index_closed.return_value = False
     client = Mock()
     self.create_index('test_index')
     self.assertIsNone(
         curator.optimize_index(client, 'test_index', max_num_segments=4))
     get_segmentcount.assert_called_once_with(client, 'test_index')
     index_closed.assert_called_once_with(client, 'test_index')
     client.indices.optimize.assert_called_once_with(index='test_index',
                                                     max_num_segments=4)
Esempio n. 6
0
 def test_optimized_index_will_be_skipped(self, get_segmentcount):
     get_segmentcount.return_value = 1, 4
     self.create_index('test_index')
     self.assertTrue(curator.optimize_index(self.client, 'test_index', max_num_segments=4))
     get_segmentcount.assert_called_once_with(self.client, 'test_index')