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

Unified Diff: client/tests/run_isolated_smoke_test.py

Issue 2484133002: luci-py/isolateserver.py: Add support for tar archives when downloading. (Closed) Base URL: https://github.com/luci/luci-py.git@master
Patch Set: Rebase onto master. Created 4 years, 1 month 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 | « client/tests/isolateserver_test.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/tests/run_isolated_smoke_test.py
diff --git a/client/tests/run_isolated_smoke_test.py b/client/tests/run_isolated_smoke_test.py
index a74355b67c548753c6232bebb583fbc2bf234682..72c81f33c8f78daf9571a0c7fff9db69db596335 100755
--- a/client/tests/run_isolated_smoke_test.py
+++ b/client/tests/run_isolated_smoke_test.py
@@ -67,7 +67,7 @@ CONTENTS = {
print >> sys.stderr, 'Unexpected content: %s' % actual
sys.exit(1)
print('Success')""",
- 'archive': (
+ 'ar_archive': (
'!<arch>\n'
'#1/5 '
'1447140471 1000 1000 100640 '
@@ -80,6 +80,7 @@ CONTENTS = {
'12 '
'\x60\n'
'More content'),
+ 'tar_archive': open(os.path.join(ROOT_DIR, 'tests', 'archive.tar')).read(),
'archive_files.py': """if True:
import os, sys
ROOT_DIR = os.path.dirname(os.path.abspath(
@@ -152,19 +153,32 @@ CONTENTS['manifest2.isolated'] = json.dumps(
})
-CONTENTS['archive.isolated'] = json.dumps(
+CONTENTS['ar_archive.isolated'] = json.dumps(
{
'command': ['python', 'archive_files.py'],
'files': {
'archive': {
- 'h': isolateserver_mock.hash_content(CONTENTS['archive']),
- 's': len(CONTENTS['archive']),
+ 'h': isolateserver_mock.hash_content(CONTENTS['ar_archive']),
+ 's': len(CONTENTS['ar_archive']),
't': 'ar',
},
'archive_files.py': file_meta('archive_files.py'),
},
})
+CONTENTS['tar_archive.isolated'] = json.dumps(
+ {
+ 'command': ['python', 'archive_files.py'],
+ 'files': {
+ 'archive': {
+ 'h': isolateserver_mock.hash_content(CONTENTS['tar_archive']),
+ 's': len(CONTENTS['tar_archive']),
+ 't': 'tar',
+ },
+ 'archive_files.py': file_meta('archive_files.py'),
+ },
+ })
+
CONTENTS['max_path.isolated'] = json.dumps(
{
@@ -389,13 +403,29 @@ class RunIsolatedTest(unittest.TestCase):
actual = list_files_tree(self.cache)
self.assertEqual(sorted(expected), actual)
- def test_archive(self):
+ def test_ar_archive(self):
+ # Loads an .isolated that includes an ar archive.
+ isolated_hash = self._store('ar_archive.isolated')
+ expected = [
+ 'state.json',
+ isolated_hash,
+ self._store('ar_archive'),
+ self._store('archive_files.py'),
+ ]
+ out, err, returncode = self._run(self._cmd_args(isolated_hash))
+ self.assertEqual('', err)
+ self.assertEqual('Success\n', out)
+ self.assertEqual(0, returncode)
+ actual = list_files_tree(self.cache)
+ self.assertEqual(sorted(expected), actual)
+
+ def test_tar_archive(self):
# Loads an .isolated that includes an ar archive.
- isolated_hash = self._store('archive.isolated')
+ isolated_hash = self._store('tar_archive.isolated')
expected = [
'state.json',
isolated_hash,
- self._store('archive'),
+ self._store('tar_archive'),
self._store('archive_files.py'),
]
out, err, returncode = self._run(self._cmd_args(isolated_hash))
« no previous file with comments | « client/tests/isolateserver_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698