예제 #1
0
  def test_main_grpc(self):
    def load_and_run(
        manifest, swarming_server, is_grpc, cost_usd_hour, start,
        json_file, run_isolated_flags, bot_file, auth_params_file):
      self.assertEqual('foo', manifest)
      self.assertEqual('http://localhost', swarming_server)
      self.assertTrue(is_grpc)
      self.assertEqual(3600., cost_usd_hour)
      self.assertEqual(time.time(), start)
      self.assertEqual('task_summary.json', json_file)
      self.assertEqual(['--min-free-space', '1'], run_isolated_flags)
      self.assertEqual('/path/to/bot-file', bot_file)
      self.assertEqual('/path/to/auth-params-file', auth_params_file)

    self.mock(task_runner, 'load_and_run', load_and_run)
    cmd = [
      '--swarming-server', 'http://localhost',
      '--in-file', 'foo',
      '--out-file', 'task_summary.json',
      '--cost-usd-hour', '3600',
      '--start', str(time.time()),
      '--bot-file', '/path/to/bot-file',
      '--auth-params-file', '/path/to/auth-params-file',
      '--is-grpc',
      '--',
      '--min-free-space', '1',
    ]
    self.assertEqual(0, task_runner.main(cmd))
예제 #2
0
  def test_main_reboot(self):
    def load_and_run(manifest, swarming_server, cost_usd_hour, start):
      self.assertEqual('foo', manifest)
      self.assertEqual('http://localhost', swarming_server.url)
      self.assertEqual(3600., cost_usd_hour)
      self.assertEqual(time.time(), start)
      return False

    self.mock(task_runner, 'load_and_run', load_and_run)
    cmd = [
      '--swarming-server', 'http://localhost', '--file', 'foo',
      '--cost-usd-hour', '3600', '--start', str(time.time()),
    ]
    self.assertEqual(task_runner.TASK_FAILED, task_runner.main(cmd))
예제 #3
0
  def test_main(self):
    def load_and_run(
        manifest, swarming_server, cost_usd_hour, start, json_file):
      self.assertEqual('foo', manifest)
      self.assertEqual('http://localhost', swarming_server.url)
      self.assertEqual(3600., cost_usd_hour)
      self.assertEqual(time.time(), start)
      self.assertEqual('task_summary.json', json_file)
      return True

    self.mock(task_runner, 'load_and_run', load_and_run)
    cmd = [
      '--swarming-server', 'http://localhost', '--file', 'foo',
      '--cost-usd-hour', '3600', '--start', str(time.time()),
      '--json-file', 'task_summary.json',
    ]
    self.assertEqual(0, task_runner.main(cmd))
예제 #4
0
  def test_main_reboot(self):
    def load_and_run(
        manifest, swarming_server, cost_usd_hour, start, json_file,
        min_free_space):
      self.assertEqual('foo', manifest)
      self.assertEqual('http://localhost', swarming_server)
      self.assertEqual(3600., cost_usd_hour)
      self.assertEqual(time.time(), start)
      self.assertEqual('task_summary.json', json_file)
      self.assertEqual(1, min_free_space)

    self.mock(task_runner, 'load_and_run', load_and_run)
    cmd = [
      '--swarming-server', 'http://localhost',
      '--in-file', 'foo',
      '--out-file', 'task_summary.json',
      '--cost-usd-hour', '3600',
      '--start', str(time.time()),
      '--min-free-space', '1',
    ]
    self.assertEqual(0, task_runner.main(cmd))
예제 #5
0
    def test_main_reboot(self):
        def load_and_run(manifest, swarming_server, cost_usd_hour, start,
                         json_file):
            self.assertEqual('foo', manifest)
            self.assertEqual('http://localhost', swarming_server.url)
            self.assertEqual(3600., cost_usd_hour)
            self.assertEqual(time.time(), start)
            self.assertEqual('task_summary.json', json_file)
            return False

        self.mock(task_runner, 'load_and_run', load_and_run)
        cmd = [
            '--swarming-server',
            'http://localhost',
            '--file',
            'foo',
            '--cost-usd-hour',
            '3600',
            '--start',
            str(time.time()),
            '--json-file',
            'task_summary.json',
        ]
        self.assertEqual(task_runner.TASK_FAILED, task_runner.main(cmd))
예제 #6
0
def CMDtask_runner(args):
    """Internal command to run a swarming task."""
    # TODO(maruel): rename function.
    logging_utils.prepare_logging('task_runner.log')
    import task_runner
    return task_runner.main(args)
예제 #7
0
파일: __main__.py 프로젝트: nodirt/luci-py
def CMDtask_runner(args):
  """Internal command to run a swarming task."""
  # TODO(maruel): rename function.
  logging_utils.prepare_logging('task_runner.log')
  import task_runner
  return task_runner.main(args)
예제 #8
0
def CMDtask_runner(args):
  """Internal command to run a swarming task."""
  logging_utils.prepare_logging('task_runner.log')
  import task_runner
  return task_runner.main(args)