| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The LUCI Authors. All rights reserved. | 2 # Copyright 2014 The LUCI Authors. All rights reserved. |
| 3 # Use of this source code is governed under the Apache License, Version 2.0 | 3 # Use of this source code is governed under the Apache License, Version 2.0 |
| 4 # that can be found in the LICENSE file. | 4 # that can be found in the LICENSE file. |
| 5 | 5 |
| 6 """Integration test for the Swarming server, Swarming bot and Swarming client. | 6 """Integration test for the Swarming server, Swarming bot and Swarming client. |
| 7 | 7 |
| 8 It starts both a Swarming server and a Swarming bot and triggers tasks with the | 8 It starts both a Swarming server and a Swarming bot and triggers tasks with the |
| 9 Swarming client to ensure the system works end to end. | 9 Swarming client to ensure the system works end to end. |
| 10 """ | 10 """ |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 # For the isolated tests that outputs a file named result.txt containing 'hey'. | 51 # For the isolated tests that outputs a file named result.txt containing 'hey'. |
| 52 ISOLATE_HELLO_WORLD = { | 52 ISOLATE_HELLO_WORLD = { |
| 53 'variables': { | 53 'variables': { |
| 54 'command': ['python', '-u', 'hello_world.py'], | 54 'command': ['python', '-u', 'hello_world.py'], |
| 55 'files': ['hello_world.py'], | 55 'files': ['hello_world.py'], |
| 56 }, | 56 }, |
| 57 } | 57 } |
| 58 | 58 |
| 59 RESULT_HEY_ISOLATED_OUT = { | 59 RESULT_HEY_ISOLATED_OUT = { |
| 60 u'isolated': u'f10f4c42b38ca01726610f9575ba695468c32108', | 60 u'isolated': u'b12052452e7246af8bcf135afc8f0b1a883df43c', |
| 61 u'isolatedserver': u'http://localhost:10050', | 61 u'isolatedserver': u'http://localhost:10050', |
| 62 u'namespace': u'default-gzip', | 62 u'namespace': u'default-gzip', |
| 63 u'view_url': | 63 u'view_url': |
| 64 u'http://localhost:10050/browse?namespace=default-gzip' | 64 u'http://localhost:10050/browse?namespace=default-gzip' |
| 65 '&hash=f10f4c42b38ca01726610f9575ba695468c32108', | 65 '&hash=b12052452e7246af8bcf135afc8f0b1a883df43c', |
| 66 } | 66 } |
| 67 | 67 |
| 68 RESULT_HEY_OUTPUTS_REF = { | 68 RESULT_HEY_OUTPUTS_REF = { |
| 69 u'isolated': u'f10f4c42b38ca01726610f9575ba695468c32108', | 69 u'isolated': u'b12052452e7246af8bcf135afc8f0b1a883df43c', |
| 70 u'isolatedserver': u'http://localhost:10050', | 70 u'isolatedserver': u'http://localhost:10050', |
| 71 u'namespace': u'default-gzip', | 71 u'namespace': u'default-gzip', |
| 72 u'view_url': | 72 u'view_url': |
| 73 u'http://localhost:10050/browse?namespace=default-gzip' | 73 u'http://localhost:10050/browse?namespace=default-gzip' |
| 74 '&hash=f10f4c42b38ca01726610f9575ba695468c32108', | 74 '&hash=b12052452e7246af8bcf135afc8f0b1a883df43c', |
| 75 } | 75 } |
| 76 | 76 |
| 77 | 77 |
| 78 class SwarmingClient(object): | 78 class SwarmingClient(object): |
| 79 def __init__(self, swarming_server, isolate_server): | 79 def __init__(self, swarming_server, isolate_server): |
| 80 self._swarming_server = swarming_server | 80 self._swarming_server = swarming_server |
| 81 self._isolate_server = isolate_server | 81 self._isolate_server = isolate_server |
| 82 self._tmpdir = tempfile.mkdtemp(prefix='swarming_client') | 82 self._tmpdir = tempfile.mkdtemp(prefix='swarming_client') |
| 83 self._index = 0 | 83 self._index = 0 |
| 84 | 84 |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 if bot.poll() is None: | 641 if bot.poll() is None: |
| 642 bot.kill() | 642 bot.kill() |
| 643 bot.wait() | 643 bot.wait() |
| 644 finally: | 644 finally: |
| 645 cleanup(bot, client, servers, failed or verbose, leak) | 645 cleanup(bot, client, servers, failed or verbose, leak) |
| 646 return int(failed) | 646 return int(failed) |
| 647 | 647 |
| 648 | 648 |
| 649 if __name__ == '__main__': | 649 if __name__ == '__main__': |
| 650 sys.exit(main()) | 650 sys.exit(main()) |
| OLD | NEW |