Exemple #1
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])
Exemple #2
0
    def test_get_initial_memory2(self):

        mock_db = Mock()
        mock_db.get_best.return_value = None, 0, 0
        mock_model = Mock()
        mock_model.machine = MachineType()
        mock_model.benchmarks = [MockBenchmark()]
        mock_model.memory = MemoryList(MockMemory())
        mock_model.memory.add_memory(Subsystem(1, 8, 0, None))
        dist = Mock()

        result = get_initial_memory(mock_db, mock_model, dist, ".")

        self.assertEqual(len(result), 3)
        expected = "(main (memory (mock)))"
        expected += " (subsystem (id 1)(depth 0)(word_size 8)(memory (mock)))"
        self.assertEqual(str(result[0]), expected)
        self.assertEqual(result[1], 0)
        self.assertEqual(result[2], False)
Exemple #3
0
    def test_get_initial_memory1(self):

        mem_str = "(main (memory (ram (word_size 4)(latency 100))))"

        mock_model = Mock()
        mock_model.memory = MockMemory()
        mock_db = Mock()
        mock_db.get_best.return_value = mem_str, 10, 20
        mock_db.load.return_value = {"use_prefetch": True}
        dist = Mock()

        result = get_initial_memory(mock_db, mock_model, dist, ".")

        self.assertEqual(len(result), 3)
        self.assertEqual(str(result[0]), mem_str)
        self.assertEqual(result[1], 10)
        self.assertEqual(result[2], True)
        dist.load.assert_called_once_with({"use_prefetch": True}, mock_model)
        mock_db.get_best.assert_called_once_with(mock_model)
        mock_db.load.assert_called_once_with(mock_model)