1# Copyright 2014 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5
6# TODO(borenet): This module was copied from build.git and heavily modified to
7# remove dependencies on other modules in build.git.  It belongs in a different
8# repo. Remove this once it has been moved.
9
10
11DEPS = [
12  'recipe_engine/properties',
13  'recipe_engine/raw_io',
14  'recipe_engine/step',
15  'swarming_client',
16]
17
18
19def RunSteps(api):
20  # Code coverage for these methods.
21  api.step('client path', [])
22  api.step.active_result.step_text = api.swarming_client.path
23  api.swarming_client.checkout()
24  #api.swarming_client.checkout('master')
25  api.swarming_client.query_script_version('swarming.py')
26  api.swarming_client.ensure_script_version('swarming.py', (0, 4, 4))
27
28  # Coverage for |step_test_data| argument.
29  api.swarming_client.query_script_version(
30      'isolate.py', step_test_data=(0, 3, 1))
31
32  # 'master' had swarming.py at v0.4.4 at the moment of writing this example.
33  assert api.swarming_client.get_script_version('swarming.py') >= (0, 4, 4)
34
35  # Coverage for 'fail' path of ensure_script_version.
36  api.swarming_client.ensure_script_version('swarming.py', (20, 0, 0))
37
38
39def GenTests(api):
40  yield (
41      api.test('basic') +
42      api.properties(parent_got_swarming_client_revision='sample_sha') +
43      api.step_data(
44          'swarming.py --version',
45          stdout=api.raw_io.output_text('0.4.4'))
46  )
47