Exemplo n.º 1
0
    def test_delete_indices_without_predicate(self):
        self.create_index('test_socorro201801')
        self.create_index('test_socorro201802')
        self.create_index('test_socorro_non_week')

        api = IndexCleaner(self.config)
        api.delete_indices()

        # Without a predicate, all week-based indices should be deleted
        assert not self.index_client.exists('test_socorro201801')
        assert not self.index_client.exists('test_socorro201802')
        assert self.index_client.exists('test_socorro_non_week')
Exemplo n.º 2
0
    def test_delete_indices_without_predicate(self):
        self.create_index('test_socorro201801')
        self.create_index('test_socorro201802')
        self.create_index('test_socorro_non_week')

        api = IndexCleaner(self.config)
        api.delete_indices()

        # Without a predicate, all week-based indices should be deleted
        assert not self.index_client.exists('test_socorro201801')
        assert not self.index_client.exists('test_socorro201802')
        assert self.index_client.exists('test_socorro_non_week')
Exemplo n.º 3
0
    def test_delete_indices_with_predicate(self):
        self.create_index('test_socorro201801')
        self.create_index('test_socorro201802')
        self.create_index('test_socorro_non_week')

        api = IndexCleaner(self.config)
        api.delete_indices(lambda index: index.endswith('2'))

        # Only week-based indices that match the predicate should be
        # deleted.
        assert self.index_client.exists('test_socorro201801')
        assert not self.index_client.exists('test_socorro201802')
        assert self.index_client.exists('test_socorro_non_week')
Exemplo n.º 4
0
    def test_delete_indices_with_predicate(self):
        self.create_index('test_socorro201801')
        self.create_index('test_socorro201802')
        self.create_index('test_socorro_non_week')

        api = IndexCleaner(self.config)
        api.delete_indices(lambda index: index.endswith('2'))

        # Only week-based indices that match the predicate should be
        # deleted.
        assert self.index_client.exists('test_socorro201801')
        assert not self.index_client.exists('test_socorro201802')
        assert self.index_client.exists('test_socorro_non_week')