Пример #1
0
    def test__restart_workers(self):
        app = AppController(None, Settings())
        app.api = Mock()
        app.api.read_workers.return_value = [{'wrk_id': 'wrk1'}]
        app.api.read_worker.return_value = {'wrk_id': 'wrk1', 'command': 'command', 'params': 'params', 'size': 8}

        app._restartWorkers('app', 'dep')

        self.assertTrue(app.api.delete_worker.called)
        self.assertTrue(app.api.create_worker.called)
Пример #2
0
 def test_deploy_restart_workers_no_dep_name(self, time):
     app = AppController(None, Settings())
     app.api = Mock()
     app.api.read_deployment.return_value = {'state': 'deployed'}
     app._restartWorkers = Mock()
     args = Mock()
     args.name = 'app'
     args.memory = False
     app.deploy(args)
     self.assertTrue(app._restartWorkers.called)
     self.assertEqual(call('app', 'default'), app.api.read_deployment.call_args_list[0])
Пример #3
0
 def test_restart_worker_with_all(self):
     app = AppController(None, Settings())
     app._restartWorker = Mock()
     app._restartWorkers = Mock()
     app.api = Mock()
     app.api.read_worker.return_value = {'wrk_id': 'wrk1', 'command': 'command', 'params': 'params', 'size': 'size'}
     args = Mock()
     args.name = 'app/dep'
     args.wrk_id = False
     args.all = True
     app.restartWorker(args)
     self.assertTrue(app._restartWorkers.called)
Пример #4
0
 def test_restart_worker_gone_error(self):
     app = AppController(None, Settings())
     app._restartWorker = Mock()
     app._restartWorkers = Mock()
     app.api = Mock()
     app.api.read_worker.side_effect = GoneError
     args = Mock()
     args.name = 'app/dep'
     args.wrk_id = 'wrkgone'
     args.all = False
     self.assertRaises(InputErrorException, app.restartWorker, args)
     self.assertFalse(app._restartWorker.called)
     self.assertFalse(app._restartWorkers.called)