예제 #1
0
    def testMockCall(self):
        """Test mock call does not execute any logic."""
        patch = self.PatchObject(cros_build_lib, 'run')

        request = self._GetInput()
        response = self._Output()
        # VmTest does not return a value, checking mocked value is flagged by lint.
        test_controller.VmTest(request, response, self.mock_call_config)
        patch.assert_not_called()
예제 #2
0
    def testVmTest(self):
        """Call VmTest with valid args and temp dir."""
        request = self._GetInput()
        response = self._Output()
        patch = self.PatchObject(
            cros_build_lib,
            'run',
            return_value=cros_build_lib.CommandResult(returncode=0))

        test_controller.VmTest(request, response, self.api_config)
        patch.assert_called()
예제 #3
0
 def testTastAllOptions(self):
     """Test VmTest for Tast with all options set."""
     test_controller.VmTest(self._GetInput(), None, self.api_config)
     self.assertCommandContains([
         'cros_run_test',
         '--debug',
         '--no-display',
         '--copy-on-write',
         '--board',
         'target',
         '--image-path',
         '/path/to/image.bin',
         '--tast',
         'suite',
         '--ssh-port',
         '1234',
         '--private-key',
         '/path/to/id_rsa',
     ])
예제 #4
0
 def testAutotestAllOptions(self):
     """Test VmTest for Autotest with all options set."""
     input_proto = self._GetInput(
         test_harness=test_pb2.VmTestRequest.AUTOTEST)
     test_controller.VmTest(input_proto, None, self.api_config)
     self.assertCommandContains([
         'cros_run_test',
         '--debug',
         '--no-display',
         '--copy-on-write',
         '--board',
         'target',
         '--image-path',
         '/path/to/image.bin',
         '--autotest',
         'suite',
         '--ssh-port',
         '1234',
         '--private-key',
         '/path/to/id_rsa',
         '--test_that-args=--whitelist-chrome-crashes',
     ])
예제 #5
0
 def testMissingVmTests(self):
     """Test VmTest dies when vm_tests not set."""
     input_proto = self._GetInput(vm_tests=[])
     with self.assertRaises(cros_build_lib.DieSystemExit):
         test_controller.VmTest(input_proto, None, self.api_config)
예제 #6
0
 def testMissingTestHarness(self):
     """Test VmTest dies when test_harness not specified."""
     input_proto = self._GetInput(
         test_harness=test_pb2.VmTestRequest.UNSPECIFIED)
     with self.assertRaises(cros_build_lib.DieSystemExit):
         test_controller.VmTest(input_proto, None, self.api_config)
예제 #7
0
 def testMissingBuildTarget(self):
     """Test VmTest dies when build_target not set."""
     input_proto = self._GetInput(build_target=None)
     with self.assertRaises(cros_build_lib.DieSystemExit):
         test_controller.VmTest(input_proto, None, self.api_config)
예제 #8
0
 def testValidateOnly(self):
     """Sanity check that a validate only call does not execute any logic."""
     test_controller.VmTest(self._GetInput(), None,
                            self.validate_only_config)
     self.assertEqual(0, self.rc.call_count)