def test_add_to_alias_idx_already_in_alias(self): alias = 'testalias' self.create_index('dummy') self.client.indices.put_alias(index='dummy', name=alias) self.create_index('foo') curator.add_to_alias(self.client, 'foo', alias=alias) self.assertTrue(curator.add_to_alias(self.client, 'foo', alias=alias))
def test_add_to_pre_existent_alias(self): alias = 'testalias' self.create_index('dummy') self.client.indices.put_alias(index='dummy', name=alias) self.create_index('foo') curator.add_to_alias(self.client, 'foo', alias=alias) self.assertEquals(2, len(self.client.indices.get_alias(name=alias)))
def test_full_alias_remove_positive(self): alias = 'testalias' self.create_index('dummy') self.client.indices.put_alias(index='dummy', name=alias) self.create_index('foo') curator.add_to_alias(self.client, 'foo', alias=alias) curator.alias(self.client, 'dummy', alias=alias, remove=True) self.assertEquals(1, len(self.client.indices.get_alias(name=alias)))
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_add_to_alias_exception_test(self): client = Mock() client.indices.get_alias.return_value = alias_retval client.indices.exists_alias.return_value = True client.cluster.state.return_value = open_index client.indices.update_aliases.side_effect = fake_fail self.assertFalse(curator.add_to_alias(client, named_index, alias=named_alias))
def test_add_to_alias_alias_not_found(self): client = Mock() client.indices.exists_alias.return_value = False client.cluster.state.return_value = open_index client.info.return_value = {'version': {'number': '1.4.4'}} self.assertTrue( curator.add_to_alias(client, named_index, alias=named_alias))
def test_add_to_alias_negative(self): alias = 'testalias' self.create_index('dummy') self.client.indices.put_alias(index='dummy', name=alias) self.create_index('foo') self.assertFalse(curator.add_to_alias(self.client, 'foo', alias="ooga"))
def test_add_to_alias_alias_not_found(self): client = Mock() client.indices.exists_alias.return_value = False self.assertFalse(curator.add_to_alias(client, named_index, alias=named_alias))
def test_add_to_alias_no_alias_arg(self): client = Mock() self.assertFalse(curator.add_to_alias(client, named_index))
def test_add_to_alias_bad_csv(self): client = Mock() c = "a,b,c,d" self.assertFalse(curator.add_to_alias(client, c))
def test_add_to_alias_alias_not_found(self): client = Mock() client.indices.exists_alias.return_value = False client.cluster.state.return_value = open_index self.assertTrue(curator.add_to_alias(client, named_index, alias=named_alias))
def test_add_to_alias_alias_not_found(self): client = Mock() client.indices.exists_alias.return_value = False client.cluster.state.return_value = open_index client.info.return_value = {"version": {"number": "1.4.4"}} self.assertTrue(curator.add_to_alias(client, named_index, alias=named_alias))
def test_add_to_alias_alias_not_found(self): client = Mock() client.indices.exists_alias.return_value = False client.cluster.state.return_value = open_index self.assertTrue( curator.add_to_alias(client, named_index, alias=named_alias))
def test_add_to_non_existent_alias(self): alias = 'testalias' self.create_index('dummy') self.client.indices.put_alias(index='dummy', name=alias) self.create_index('foo') self.assertTrue(curator.add_to_alias(self.client, 'foo', alias="ooga"))