OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2012 The Swarming Authors. All rights reserved. | 2 # Copyright 2012 The Swarming Authors. All rights reserved. |
3 # Use of this source code is governed under the Apache License, Version 2.0 that | 3 # Use of this source code is governed under the Apache License, Version 2.0 that |
4 # can be found in the LICENSE file. | 4 # can be found in the LICENSE file. |
5 | 5 |
6 import json | 6 import json |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import subprocess | 9 import subprocess |
10 import sys | 10 import sys |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 self.assertEqual('Success\n', out, out) | 288 self.assertEqual('Success\n', out, out) |
289 self.assertEqual(0, returncode) | 289 self.assertEqual(0, returncode) |
290 actual = list_files_tree(self.cache) | 290 actual = list_files_tree(self.cache) |
291 self.assertEqual(sorted(set(expected)), actual) | 291 self.assertEqual(sorted(set(expected)), actual) |
292 | 292 |
293 def test_fail_empty_isolated(self): | 293 def test_fail_empty_isolated(self): |
294 isolated_hash = self._store_isolated({}) | 294 isolated_hash = self._store_isolated({}) |
295 expected = ['state.json', isolated_hash] | 295 expected = ['state.json', isolated_hash] |
296 out, err, returncode = self._run(self._cmd_args(isolated_hash)) | 296 out, err, returncode = self._run(self._cmd_args(isolated_hash)) |
297 self.assertEqual('', out) | 297 self.assertEqual('', out) |
298 self.assertIn('No command to run\n', err) | 298 self.assertIn( |
| 299 '<The .isolated doesn\'t declare any command to run!>\n' |
| 300 '<Check your .isolate for missing \'command\' variable>\n', |
| 301 err) |
299 self.assertEqual(1, returncode) | 302 self.assertEqual(1, returncode) |
300 actual = list_files_tree(self.cache) | 303 actual = list_files_tree(self.cache) |
301 self.assertEqual(sorted(expected), actual) | 304 self.assertEqual(sorted(expected), actual) |
302 | 305 |
303 def test_includes(self): | 306 def test_includes(self): |
304 # Loads an .isolated that includes another one. | 307 # Loads an .isolated that includes another one. |
305 | 308 |
306 # References manifest2.isolated and repeated_files.isolated. Maps file3.txt | 309 # References manifest2.isolated and repeated_files.isolated. Maps file3.txt |
307 # as file2.txt. | 310 # as file2.txt. |
308 isolated_hash = self._store('check_files.isolated') | 311 isolated_hash = self._store('check_files.isolated') |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 cached_file_path = self._test_corruption_common( | 382 cached_file_path = self._test_corruption_common( |
380 CONTENTS['file1.txt'][:-1] + ' ') | 383 CONTENTS['file1.txt'][:-1] + ' ') |
381 # TODO(maruel): This corruption is NOT detected. | 384 # TODO(maruel): This corruption is NOT detected. |
382 # This needs to be fixed. | 385 # This needs to be fixed. |
383 self.assertNotEqual(CONTENTS['file1.txt'], read_content(cached_file_path)) | 386 self.assertNotEqual(CONTENTS['file1.txt'], read_content(cached_file_path)) |
384 | 387 |
385 | 388 |
386 if __name__ == '__main__': | 389 if __name__ == '__main__': |
387 fix_encoding.fix_encoding() | 390 fix_encoding.fix_encoding() |
388 test_utils.main() | 391 test_utils.main() |
OLD | NEW |