Пример #1
0
 def test_fix_epoch(self):
     for long_epoch, epoch in [
         (1459287636999, 1459287636),
         (1459287636000000, 1459287636),
         (145928763600000000, 1459287636),
         (145928763600000001, 1459287636),
         (1459287636123456789, 1459287636),
         (1459287636999, 1459287636),
             ]:
         self.assertEqual(epoch, curator.fix_epoch(long_epoch))
Пример #2
0
 def test_fix_epoch(self):
     for long_epoch, epoch in [
         (1459287636999, 1459287636),
         (1459287636000000, 1459287636),
         (145928763600000000, 1459287636),
         (145928763600000001, 1459287636),
         (1459287636123456789, 1459287636),
         (1459287636999, 1459287636),
     ]:
         self.assertEqual(epoch, curator.fix_epoch(long_epoch))
Пример #3
0
 def test_get_name_based_ages_no_match(self):
     client = Mock()
     client.indices.get_settings.return_value = testvars.settings_two
     client.cluster.state.return_value = testvars.clu_state_two
     client.indices.stats.return_value = testvars.stats_two
     nomatch = curator.IndexList(client)
     nomatch._get_name_based_ages('%Y-%m-%d')
     self.assertEqual(
         curator.fix_epoch(testvars.settings_two['index-2016.03.03']
                           ['settings']['index']['creation_date']),
         nomatch.index_info['index-2016.03.03']['age']['creation_date'])
Пример #4
0
 def test_get_field_stats_dates_success(self):
     client = Mock()
     client.indices.get_settings.return_value = testvars.settings_two
     client.cluster.state.return_value = testvars.clu_state_two
     client.indices.stats.return_value = testvars.stats_two
     il = curator.IndexList(client)
     client.field_stats.return_value = testvars.fieldstats_two
     il._get_field_stats_dates(field='timestamp')
     self.assertEqual(
         curator.fix_epoch(
             testvars.fieldstats_two['indices']['index-2016.03.04']
             ['fields']['timestamp']['min_value']),
         il.index_info['index-2016.03.04']['age']['min_value'])
Пример #5
0
 def test_get_name_based_ages_no_match(self):
     client = Mock()
     client.indices.get_settings.return_value = testvars.settings_two
     client.cluster.state.return_value = testvars.clu_state_two
     client.indices.stats.return_value = testvars.stats_two
     nomatch = curator.IndexList(client)
     nomatch._get_name_based_ages('%Y-%m-%d')
     self.assertEqual(
         curator.fix_epoch(
             testvars.settings_two['index-2016.03.03']['settings']['index']['creation_date']
         ),
         nomatch.index_info['index-2016.03.03']['age']['creation_date']
     )
Пример #6
0
 def test_get_field_stats_dates_success(self):
     client = Mock()
     client.indices.get_settings.return_value = testvars.settings_two
     client.cluster.state.return_value = testvars.clu_state_two
     client.indices.stats.return_value = testvars.stats_two
     il = curator.IndexList(client)
     client.field_stats.return_value = testvars.fieldstats_two
     il._get_field_stats_dates(field='timestamp')
     self.assertEqual(
         curator.fix_epoch(
             testvars.fieldstats_two['indices']['index-2016.03.04']['fields']['timestamp']['min_value']
         ),
         il.index_info['index-2016.03.04']['age']['min_value']
     )