Commit efe4f897 authored by Edward Lemur's avatar Edward Lemur Committed by Commit Bot

gclient: Add a test to make sure we're syncing CIPD dependencies.

Bug: 849374
Change-Id: I5654ed65843c6dae6b7dbee10a40aa35e16803dc
Reviewed-on: https://chromium-review.googlesource.com/1087390
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: 's avatarAaron Gable <agable@chromium.org>
parent e89dcf7d
#!/usr/bin/env bash
# Copyright (c) 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
base_dir=$(dirname "$0")
exec python "$base_dir/fake_cipd.py" "$@"
echo off
:: Copyright (c) 2018 The Chromium Authors. All rights reserved.
:: Use of this source code is governed by a BSD-style license that can be
:: found in the LICENSE file.
setlocal
:: Defer control.
python "%~dp0fake_cipd.py" %*
#!/usr/bin/env python
# Copyright (c) 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import os
import shutil
import sys
def main():
assert sys.argv[1] == 'ensure'
parser = argparse.ArgumentParser()
parser.add_argument('-ensure-file')
parser.add_argument('-root')
args, _ = parser.parse_known_args()
cipd_root = os.path.join(args.root, '.cipd')
if not os.path.isdir(cipd_root):
os.makedirs(cipd_root)
if args.ensure_file:
shutil.copy(args.ensure_file, os.path.join(cipd_root, 'ensure'))
return 0
if __name__ == '__main__':
sys.exit(main())
......@@ -736,6 +736,19 @@ deps = {
],
'dep_type': 'cipd',
},
'src/another_cipd_dep': {
'packages': [
{
'package': 'package1',
'version': '1.1-cr0',
},
{
'package': 'package2',
'version': '1.13',
},
],
'dep_type': 'cipd',
},
}"""),
'origin': 'git/repo_14@2\n'
})
......
......@@ -1349,6 +1349,21 @@ class GClientSmokeGIT(GClientSmokeBase):
' "url": "' + self.git_base + 'repo_14",',
' },',
'',
' # src -> src/another_cipd_dep:package1',
' "src/another_cipd_dep": {',
' "packages": [',
' {',
' "package": "package1",',
' "version": "1.1-cr0",',
' },',
' {',
' "package": "package2",',
' "version": "1.13",',
' },',
' ],',
' "dep_type": "cipd",',
' },',
'',
' # src -> src/cipd_dep:package0',
' "src/cipd_dep": {',
' "packages": [',
......@@ -1711,6 +1726,31 @@ class BlinkDEPSTransitionSmokeTest(GClientSmokeBase):
['git', 'show-ref', '-q', '--verify', 'refs/heads/foo'], cwd=self.blink)
class GClientSmokeCipd(GClientSmokeBase):
def setUp(self):
super(GClientSmokeCipd, self).setUp()
self.enabled = self.FAKE_REPOS.set_up_git()
self.env['PATH'] = (os.path.join(ROOT_DIR, 'testing_support')
+ os.pathsep + self.env['PATH'])
def testSyncCipd(self):
self.gclient(['config', self.git_base + 'repo_14', '--name', 'src'])
self.gclient(['sync'])
with open(os.path.join(self.root_dir, '.cipd', 'ensure')) as f:
contents = f.read()
self.assertEqual([
'@Subdir src/another_cipd_dep',
'package1 1.1-cr0',
'package2 1.13',
'',
'@Subdir src/cipd_dep',
'package0 0.1',
'',
], contents.splitlines())
if __name__ == '__main__':
if '-v' in sys.argv:
logging.basicConfig(level=logging.DEBUG)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment