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