Exemplo n.º 1
0
 def test_create_snapshot_empty_arg_indices(self):
     client = Mock()
     self.assertFalse(
         curator.create_snapshot(client,
                                 indices=[],
                                 repository=repo_name,
                                 name=snap_name))
Exemplo n.º 2
0
 def test_create_snapshot_empty_arg_indices(self):
     client = Mock()
     client.info.return_value = {'version': {'number': '1.4.4'}}
     client.snapshot.status.return_value = nosnap_running
     self.assertFalse(
         curator.create_snapshot(client,
                                 indices=[],
                                 repository=repo_name,
                                 name=snap_name))
Exemplo n.º 3
0
 def test_create_snapshot_in_progress_old_version(self):
     client = Mock()
     client.info.return_value = {'version': {'number': '1.0.3'}}
     client.snapshot.status.return_value = snap_running
     self.assertFalse(
         curator.create_snapshot(client,
                                 indices=[],
                                 repository=repo_name,
                                 name=snap_name))
Exemplo n.º 4
0
 def test_create_snapshot_incomplete(self):
     client = Mock()
     client.info.return_value = {"version": {"number": "1.4.4"}}
     client.cluster.state.return_value = open_indices
     client.snapshot.get.return_value = partial
     client.snapshot.verify_repository.return_value = verified_nodes
     client.snapshot.status.return_value = nosnap_running
     self.assertFalse(
         curator.create_snapshot(client, indices=named_indices, repository=repo_name, name="not_snap_name")
     )
Exemplo n.º 5
0
 def test_create_snapshot_verify_nodes_positive(self):
     client = Mock()
     client.info.return_value = {'version': {'number': '1.4.4'}}
     client.cluster.state.return_value = open_indices
     client.snapshot.get.return_value = snapshots
     client.snapshot.verify_repository.return_value = verified_nodes
     self.assertTrue(
         curator.create_snapshot(client,
                                 indices=named_indices,
                                 repository=repo_name,
                                 name='not_snap_name'))
Exemplo n.º 6
0
 def test_create_snapshot_exception(self):
     client = Mock()
     client.info.return_value = {"version": {"number": "1.4.4"}}
     client.cluster.state.return_value = open_indices
     client.snapshot.get.return_value = snapshots
     client.snapshot.verify_repository.return_value = verified_nodes
     client.snapshot.create.side_effect = elasticsearch.TransportError
     client.snapshot.status.return_value = nosnap_running
     self.assertFalse(
         curator.create_snapshot(client, indices=named_indices, repository=repo_name, name="not_snap_name")
     )
Exemplo n.º 7
0
 def test_create_snapshot_incomplete(self):
     client = Mock()
     client.info.return_value = {'version': {'number': '1.4.4'}}
     client.cluster.state.return_value = open_indices
     client.snapshot.get.return_value = partial
     client.snapshot.verify_repository.return_value = verified_nodes
     client.snapshot.status.return_value = nosnap_running
     self.assertFalse(
         curator.create_snapshot(client,
                                 indices=named_indices,
                                 repository=repo_name,
                                 name='not_snap_name'))
Exemplo n.º 8
0
 def test_create_snapshot_exception(self):
     client = Mock()
     client.info.return_value = {'version': {'number': '1.4.4'}}
     client.cluster.state.return_value = open_indices
     client.snapshot.get.return_value = snapshots
     client.snapshot.verify_repository.return_value = verified_nodes
     client.snapshot.create.side_effect = elasticsearch.TransportError
     self.assertFalse(
         curator.create_snapshot(client,
                                 indices=named_indices,
                                 repository=repo_name,
                                 name='not_snap_name'))
Exemplo n.º 9
0
 def test_create_snapshot_verify_nodes_positive(self):
     client = Mock()
     client.cluster.state.return_value = open_indices
     client.snapshot.get.return_value = snapshots
     client.snapshot.verify_repository.return_value = verified_nodes
     self.assertTrue(
         curator.create_snapshot(
             client,
             indices=named_indices,
             repository=repo_name,
             name='not_snap_name'
         )
     )
Exemplo n.º 10
0
 def test_create_snapshot_exception(self):
     client = Mock()
     client.cluster.state.return_value = open_indices
     client.snapshot.get.return_value = snapshots
     client.snapshot.verify_repository.return_value = verified_nodes
     client.snapshot.create.side_effect = elasticsearch.TransportError
     self.assertFalse(
         curator.create_snapshot(
             client,
             indices=named_indices,
             repository=repo_name,
             name='not_snap_name'
         )
     )
Exemplo n.º 11
0
 def test_create_snapshot_name_collision(self):
     client = Mock()
     client.cluster.state.return_value = open_indices
     client.snapshot.get.return_value = snapshots
     client.snapshot.verify_repository.return_value = verified_nodes
     self.assertFalse(
         self.assertFalse(
             curator.create_snapshot(
                 client,
                 indices=named_indices,
                 repository=repo_name,
                 name=snap_name
             )
         )
     )
Exemplo n.º 12
0
 def test_create_snapshot_verify_nodes_negative(self):
     client = Mock()
     client.info.return_value = {'version': {'number': '1.4.4'} }
     client.cluster.state.return_value = open_indices
     client.snapshot.get.return_value = snapshots
     client.snapshot.verify_repository.return_value = verified_nodes
     client.snapshot.verify_repository.side_effect = fake_fail
     self.assertFalse(
         curator.create_snapshot(
             client,
             indices=named_indices,
             repository=repo_name,
             name='not_snap_name'
         )
     )
Exemplo n.º 13
0
 def test_create_snapshot_verify_nodes_positive(self):
     client = Mock()
     client.info.return_value = {'version': {'number': '1.4.4'} }
     client.cluster.state.return_value = open_indices
     client.snapshot.get.return_value = snapshots
     client.snapshot.verify_repository.return_value = verified_nodes
     client.snapshot.status.return_value = nosnap_running
     self.assertTrue(
         curator.create_snapshot(
             client,
             indices=named_indices,
             repository=repo_name,
             name='not_snap_name'
         )
     )
Exemplo n.º 14
0
 def test_create_snapshot_missing_arg_repository(self):
     client = Mock()
     self.assertFalse(curator.create_snapshot(client, name=snap_name))
Exemplo n.º 15
0
 def test_create_snapshot_empty_arg_indices(self):
     client = Mock()
     self.assertFalse(curator.create_snapshot(client, indices=[], repository=repo_name, name=snap_name))
Exemplo n.º 16
0
 def test_create_snapshot_missing_arg_repository(self):
     client = Mock()
     self.assertFalse(curator.create_snapshot(client, name=snap_name))
Exemplo n.º 17
0
 def test_create_snapshot_empty_arg_indices(self):
     client = Mock()
     client.info.return_value = {'version': {'number': '1.4.4'} }
     client.snapshot.status.return_value = nosnap_running
     self.assertFalse(curator.create_snapshot(client, indices=[], repository=repo_name, name=snap_name))
Exemplo n.º 18
0
 def test_create_snapshot_in_progress_old_version(self):
     client = Mock()
     client.info.return_value = {'version': {'number': '1.0.3'} }
     client.snapshot.status.return_value = snap_running
     self.assertFalse(curator.create_snapshot(client, indices=[], repository=repo_name, name=snap_name))
Exemplo n.º 19
0
 def test_create_snapshot_in_progress(self):
     client = Mock()
     client.info.return_value = {"version": {"number": "1.4.4"}}
     client.snapshot.status.return_value = snap_running
     self.assertFalse(curator.create_snapshot(client, indices=[], repository=repo_name, name=snap_name))