Example #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))
Example #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))
Example #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))
 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")
     )
Example #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'))
 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")
     )
Example #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'))
Example #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'))
Example #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'
         )
     )
Example #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'
         )
     )
Example #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
             )
         )
     )
 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'
         )
     )
 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'
         )
     )
Example #14
0
 def test_create_snapshot_missing_arg_repository(self):
     client = Mock()
     self.assertFalse(curator.create_snapshot(client, name=snap_name))
Example #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))
Example #16
0
 def test_create_snapshot_missing_arg_repository(self):
     client = Mock()
     self.assertFalse(curator.create_snapshot(client, name=snap_name))
 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))
 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))
 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))