Example #1
0
 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))
Example #2
0
 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))
Example #3
0
 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)))
Example #4
0
 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)))
Example #5
0
 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)))
Example #6
0
 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)))
Example #7
0
 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))
Example #8
0
 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))
Example #9
0
 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))
Example #10
0
 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))
Example #11
0
 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))
Example #12
0
 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"))
Example #13
0
 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))
Example #14
0
 def test_add_to_alias_no_alias_arg(self):
     client = Mock()
     self.assertFalse(curator.add_to_alias(client, named_index))
Example #15
0
 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))
Example #18
0
 def test_add_to_alias_no_alias_arg(self):
     client = Mock()
     self.assertFalse(curator.add_to_alias(client, named_index))
Example #19
0
 def test_add_to_alias_bad_csv(self):
     client = Mock()
     c = "a,b,c,d"
     self.assertFalse(curator.add_to_alias(client, c))
Example #20
0
 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))
Example #21
0
 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))
Example #22
0
 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"))
Example #23
0
 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"))