示例#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')
示例#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)
示例#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'])
示例#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'])
示例#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)
示例#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')