def test_snapshot_cast(self, mocked_rpc): task = self.env.create_task(name="dump") DumpTask.execute(task) message = { "method": "dump_environment", "respond_to": "dump_environment_resp", "args": {"task_uuid": task.uuid, "lastdump": "LASTDUMP"}, } args, kwargs = nailgun.task.task.rpc.cast.call_args self.assertEquals(len(args), 2) self.datadiff(args[1], message)
def test_snapshot_cast(self, mocked_rpc): task = self.env.create_task(name='dump') DumpTask.execute(task) message = { 'method': 'dump_environment', 'respond_to': 'dump_environment_resp', 'args': { 'task_uuid': task.uuid, 'lastdump': 'LASTDUMP' } } args, kwargs = nailgun.task.task.rpc.cast.call_args self.assertEquals(len(args), 2) self.datadiff(args[1], message)
def test_snapshot_cast(self, mocked_rpc): task = self.env.create_task(name='dump') DumpTask.execute(task) message = { 'api_version': '1', 'method': 'dump_environment', 'respond_to': 'dump_environment_resp', 'args': { 'task_uuid': task.uuid, 'settings': DumpTask.conf() } } args, kwargs = nailgun.task.task.rpc.cast.call_args self.assertEqual(len(args), 2) self.datadiff(args[1], message)
def test_snapshot_conf(self): self.env.create_node( status='ready', name='node1', fqdn='node1.domain.tld' ) conf = { 'dump': { 'local': { 'hosts': [], 'objects': [], }, 'master': { 'hosts': [], 'objects': [{ 'type': 'subs', 'path': '/var/log/remote', 'subs': {} }], }, 'slave': { 'hosts': [{ 'address': 'node1.domain.tld', 'ssh-key': '/root/.ssh/id_rsa', }], 'objects': [], }, }, } self.datadiff(DumpTask.conf(), conf)
def test_snapshot_conf(self): self.env.create_node( status='ready', name='node1', fqdn='node1.domain.tld' ) self.env.create_rh_account( username='******', password='******' ) conf = { 'dump_roles': { 'master': [], 'slave': ['node1.domain.tld'] }, 'dump_objects': { 'master': [ { 'type': 'subs', 'path': '/var/log/remote', 'subs': { 'RHUSER': '******', 'RHPASS': '******' } } ], 'slave': [] } } self.datadiff(DumpTask.conf(), conf)
def test_snapshot_conf(self): self.env.create_node( status='ready', hostname='node111', ip='10.109.0.2', ) conf = { 'dump': { 'local': { 'hosts': [], 'objects': [], }, 'master': { 'hosts': [], 'objects': [{ 'type': 'dir', 'path': '/var/log/remote', }], }, 'slave': { 'hosts': [{ 'hostname': 'node111', 'address': '10.109.0.2', 'ssh-key': '/root/.ssh/id_rsa', }], 'objects': [], }, }, 'target': '/path/to/save', 'lastdump': '/path/to/latest', 'timestamp': True, 'compression_level': 3, 'timeout': 60, } self.datadiff(DumpTask.conf(), conf)
def test_snapshot_conf(self): self.env.create_node(status='ready', name='node1', fqdn='node1.domain.tld') conf = { 'dump': { 'local': { 'hosts': [], 'objects': [], }, 'master': { 'hosts': [], 'objects': [{ 'type': 'subs', 'path': '/var/log/remote', 'subs': {} }], }, 'slave': { 'hosts': [{ 'address': 'node1.domain.tld', 'ssh-key': '/root/.ssh/id_rsa', }], 'objects': [], }, }, } self.datadiff(DumpTask.conf(), conf)
def test_snapshot_conf(self): self.env.create_node(status='ready', name='node1', fqdn='node1.domain.tld') self.env.create_rh_account(username='******', password='******') conf = { 'dump': { 'local': { 'hosts': [], 'objects': [], }, 'master': { 'hosts': [], 'objects': [{ 'type': 'subs', 'path': '/var/log/remote', 'subs': { 'RHUSER': '******', 'RHPASS': '******' } }], }, 'slave': { 'hosts': [{ 'address': 'node1.domain.tld', 'ssh-key': '/root/.ssh/id_rsa', }], 'objects': [], }, }, } self.datadiff(DumpTask.conf(), conf)
def test_snapshot_conf(self): self.env.create_node(status="ready", name="node1", fqdn="node1.domain.tld") conf = { "dump": { "local": {"hosts": [], "objects": []}, "master": {"hosts": [], "objects": [{"type": "subs", "path": "/var/log/remote", "subs": {}}]}, "slave": {"hosts": [{"address": "node1.domain.tld", "ssh-key": "/root/.ssh/id_rsa"}], "objects": []}, } } self.datadiff(DumpTask.conf(), conf)
def test_snapshot_conf(self): self.env.create_node(status="ready", hostname="node111") conf = { "dump": { "local": {"hosts": [], "objects": []}, "master": {"hosts": [], "objects": [{"type": "subs", "path": "/var/log/remote", "subs": {}}]}, "slave": {"hosts": [{"address": "node111.example.com", "ssh-key": "/root/.ssh/id_rsa"}], "objects": []}, }, "target": "/path/to/save", "lastdump": "/path/to/latest", "timestamp": True, "compression_level": 3, "timeout": 60, } self.datadiff(DumpTask.conf(), conf)
def test_snapshot_conf(self): self.env.create_node(status="ready", name="node1", fqdn="node1.domain.tld") self.env.create_rh_account(username="******", password="******") conf = { "dump_roles": {"master": [], "slave": ["node1.domain.tld"]}, "dump_objects": { "master": [ { "type": "subs", "path": "/var/log/remote", "subs": {"RHUSER": "******", "RHPASS": "******"}, } ], "slave": [], }, } self.datadiff(DumpTask.conf(), conf)
def test_snapshot_conf(self): self.env.create_node( status='ready', name='node1', fqdn='node1.domain.tld' ) self.env.create_rh_account( username='******', password='******' ) conf = { 'dump': { 'local': { 'hosts': [], 'objects': [], }, 'master': { 'hosts': [], 'objects': [{ 'type': 'subs', 'path': '/var/log/remote', 'subs': { 'RHUSER': '******', 'RHPASS': '******' } }], }, 'slave': { 'hosts': [{ 'address': 'node1.domain.tld', 'ssh-key': '/root/.ssh/id_rsa', }], 'objects': [], }, }, } self.datadiff(DumpTask.conf(), conf)
def GET(self): """Generates default config for snapshot :http: * 200 """ return DumpTask.conf()