Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Unified Diff: recipe_engine/unittests/fetch_test.py

Issue 2835593002: Revert of [autoroller] All commits in updates(), only roll interesting ones. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « recipe_engine/package.py ('k') | unittests/autoroll_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipe_engine/unittests/fetch_test.py
diff --git a/recipe_engine/unittests/fetch_test.py b/recipe_engine/unittests/fetch_test.py
index 81bbd2339da490fac2861e4bc6f695f08272e97f..a4e917e2f367d1c55fa9055436c13e99e1798c95 100755
--- a/recipe_engine/unittests/fetch_test.py
+++ b/recipe_engine/unittests/fetch_test.py
@@ -70,8 +70,7 @@
def g_metadata_calls(self, dirname='dir', commit='a'*40,
email='foo@example.com', msg='hello\nworld',
- commit_timestamp=1492131405, config=None,
- diff=('foo', 'bar')):
+ commit_timestamp=1492131405, config=None):
config = config or {'api_version': 2}
return [
@@ -80,11 +79,7 @@
], '%s\n%d\n%s\n' % (email, commit_timestamp, msg)),
self.g([
'-C', dirname, 'cat-file', 'blob', commit+':infra/config/recipes.cfg'
- ], json.dumps(config)),
- self.g([
- '-C', dirname,
- 'diff-tree', '-r', '--no-commit-id', '--name-only', commit+'^!',
- ], '\n'.join(diff))
+ ], json.dumps(config))
]
@mock.patch('os.path.isdir')
@@ -202,8 +197,7 @@
author_email = 'foo@example.com',
commit_timestamp = 1492131405,
message_lines = ('hello', 'world'),
- spec = package_pb2.Package(api_version=2),
- roll_candidate = True,
+ spec = package_pb2.Package(api_version=2)
))
self.assertMultiDone(git)
@@ -226,16 +220,6 @@
'author': {'email': 'foo@example.com'},
'committer': {'time': 'Fri Apr 14 00:56:45 2017'},
'message': 'message',
- 'tree_diff': [
- {
- 'old_path': 'unrelated',
- 'new_path': 'unrelated',
- },
- {
- 'old_path': 'path/to/recipes/foo',
- 'new_path': 'path/to/recipes/bar',
- },
- ]
}
self.a_meta = fetch.CommitMetadata(
@@ -247,8 +231,7 @@
api_version = 2,
project_id = 'foo',
recipes_path = 'path/to/recipes',
- ),
- roll_candidate = True,
+ )
)
def assertMultiDone(self, mocked_call):
@@ -289,8 +272,8 @@
@mock.patch('requests.get')
def test_checkout(self, requests_get, _tarfile_open, makedirs, rmtree):
requests_get.side_effect = multi(
- self.j('repo/+/revision?name-status=1&format=JSON', self.a_dat),
- self.j('repo/+/%s?name-status=1&format=JSON' % self.a, self.a_dat),
+ self.j('repo/+/revision?format=JSON', self.a_dat),
+ self.j('repo/+/%s?format=JSON' % self.a, self.a_dat),
self.d('repo/+/%s/infra/config/recipes.cfg?format=TEXT' % self.a,
self.proto_text),
self.d('repo/+archive/%s/path/to/recipes.tar.gz' % self.a, ''),
@@ -320,7 +303,7 @@
'tree_diff': [
{
'old_path': '/dev/null',
- 'new_path': 'path/to/recipes/path1/foo',
+ 'new_path': 'path1/foo',
},
],
},
@@ -344,7 +327,7 @@
'tree_diff': [
{
'old_path': '/dev/null',
- 'new_path': 'path/to/recipes/path8/foo',
+ 'new_path': 'path8/foo',
},
{
'old_path': 'path2/foo',
@@ -356,14 +339,22 @@
}
requests_get.side_effect = multi(
- self.j('repo/+/reva?name-status=1&format=JSON', log_json['log'][2]),
- self.j('repo/+/revb?name-status=1&format=JSON', log_json['log'][0]),
+ self.j('repo/+/reva?format=JSON', {
+ 'commit': sha_a,
+ 'author': {'email': 'foo@example.com'},
+ 'committer': {'time': 'Fri Apr 14 00:56:45 2017'},
+ 'message': 'message',
+ }),
+ self.j('repo/+/revb?format=JSON', {
+ 'commit': sha_b,
+ 'author': {'email': 'foo@example.com'},
+ 'committer': {'time': 'Fri Apr 14 00:58:45 2017'},
+ 'message': 'message',
+ }),
self.j('repo/+log/%s..%s?name-status=1&format=JSON' % (sha_a, sha_b),
log_json),
self.d('repo/+/%s/infra/config/recipes.cfg?format=TEXT' % sha_a,
self.proto_text),
- self.d('repo/+/%s/infra/config/recipes.cfg?format=TEXT' % 'def456',
- self.proto_text),
self.d('repo/+/%s/infra/config/recipes.cfg?format=TEXT' % sha_b,
self.proto_text),
)
@@ -374,18 +365,6 @@
self.assertEqual(
[self.a_meta,
- fetch.CommitMetadata(
- revision = 'def456',
- author_email = 'foo@example.com',
- commit_timestamp = 1492131465,
- message_lines = ('message',),
- spec = package_pb2.Package(
- api_version = 2,
- project_id = 'foo',
- recipes_path = 'path/to/recipes',
- ),
- roll_candidate = False,
- ),
fetch.CommitMetadata(
revision = sha_b,
author_email = 'foo@example.com',
@@ -395,18 +374,17 @@
api_version = 2,
project_id = 'foo',
recipes_path = 'path/to/recipes',
- ),
- roll_candidate = True,
+ )
)],
- be.updates(sha_a, sha_b))
+ be.updates(sha_a, sha_b, ['path1', 'path2']))
self.assertMultiDone(requests_get)
@mock.patch('requests.get')
def test_commit_metadata(self, requests_get):
requests_get.side_effect = multi(
- self.j('repo/+/revision?name-status=1&format=JSON', self.a_dat),
- self.j('repo/+/%s?name-status=1&format=JSON' % self.a, self.a_dat),
+ self.j('repo/+/revision?format=JSON', self.a_dat),
+ self.j('repo/+/%s?format=JSON' % self.a, self.a_dat),
self.d('repo/+/%s/infra/config/recipes.cfg?format=TEXT' % self.a,
self.proto_text)
)
@@ -419,8 +397,7 @@
@mock.patch('requests.get')
def test_non_transient_error(self, requests_get):
requests_get.side_effect = multi(
- self.r('repo/+/revision?name-status=1&format=JSON',
- fetch.GitilesFetchError(403, '')),
+ self.r('repo/+/revision?format=JSON', fetch.GitilesFetchError(403, '')),
)
with self.assertRaises(fetch.GitilesFetchError):
fetch.GitilesBackend('dir', 'repo', True).commit_metadata(
@@ -432,16 +409,12 @@
@mock.patch('logging.exception')
def test_transient_retry(self, _logging_exception, _time_sleep, requests_get):
requests_get.side_effect = multi(
- self.r('repo/+/revision?name-status=1&format=JSON',
- fetch.GitilesFetchError(500, '')),
- self.r('repo/+/revision?name-status=1&format=JSON',
- fetch.GitilesFetchError(500, '')),
- self.r('repo/+/revision?name-status=1&format=JSON',
- fetch.GitilesFetchError(500, '')),
- self.r('repo/+/revision?name-status=1&format=JSON',
- fetch.GitilesFetchError(500, '')),
- self.j('repo/+/revision?name-status=1&format=JSON', self.a_dat),
- self.j('repo/+/%s?name-status=1&format=JSON' % self.a, self.a_dat),
+ self.r('repo/+/revision?format=JSON', fetch.GitilesFetchError(500, '')),
+ self.r('repo/+/revision?format=JSON', fetch.GitilesFetchError(500, '')),
+ self.r('repo/+/revision?format=JSON', fetch.GitilesFetchError(500, '')),
+ self.r('repo/+/revision?format=JSON', fetch.GitilesFetchError(500, '')),
+ self.j('repo/+/revision?format=JSON', self.a_dat),
+ self.j('repo/+/%s?format=JSON' % self.a, self.a_dat),
self.d('repo/+/%s/infra/config/recipes.cfg?format=TEXT' % self.a,
self.proto_text),
)
« no previous file with comments | « recipe_engine/package.py ('k') | unittests/autoroll_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698