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

Unified Diff: scripts/slave/unittests/run_slavelastic_test.py

Issue 10386096: Get Swarm Bots to Use Network Storage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 8 years, 7 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
« scripts/slave/run_slavelastic.py ('K') | « scripts/slave/run_slavelastic.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/slave/unittests/run_slavelastic_test.py
diff --git a/scripts/slave/unittests/run_slavelastic_test.py b/scripts/slave/unittests/run_slavelastic_test.py
index cb93d68a42d40904bf87381734821e3ab24c6d9a..96fa986c1124fbef2b8a40d1621e103f48f380eb 100755
--- a/scripts/slave/unittests/run_slavelastic_test.py
+++ b/scripts/slave/unittests/run_slavelastic_test.py
@@ -4,11 +4,9 @@
# found in the LICENSE file.
import json
-import os
-import socket
import sys
import unittest
-import urllib
+import urlparse
import test_env # pylint: disable=W0403,W0611
@@ -23,85 +21,82 @@ ENV_VARS = {'GTEST_TOTAL_SHARDS': '%(num_instances)s',
class Switches(object):
M-A Ruel 2012/05/11 15:35:32 Options would be a strictly better name but I don'
csharp 2012/05/11 19:16:41 Done.
def __init__(self, working_dir="swarm_tests", min_shards=1, num_shards=1,
- os_image='win32', url='http://localhost:8080'):
+ os_image='win32', url='http://localhost:8080',
+ data_url='http://www.google.com', data_dest_dir='temp_data'):
self.working_dir = working_dir
self.min_shards = min_shards
self.num_shards = num_shards
self.os_image = os_image
self.url = url
+ self.data_url = data_url
+ self.data_dest_dir = data_dest_dir
-class ManifestTest(unittest.TestCase):
- def setUp(self):
- self.hostname = socket.gethostbyname(socket.gethostname()) + ':8080'
- self.filename_url = urllib.pathname2url(
- os.path.relpath(TEST_NAME + '.zip', '../..'))
- self.correct_data = ['http://%s/%s' % (self.hostname, self.filename_url)]
-
-
- def GenerateExpectedJSON(self, switches):
- platform_mapping = {
- 'win32': 'Windows',
- 'cygwin': 'Windows',
- 'linux2': 'Linux',
- 'darwin': 'Mac'
- }
+def GenerateExpectedJSON(switches):
+ platform_mapping = {
+ 'win32': 'Windows',
M-A Ruel 2012/05/11 15:35:32 sort the list?
csharp 2012/05/11 19:16:41 Done.
+ 'cygwin': 'Windows',
+ 'linux2': 'Linux',
+ 'darwin': 'Mac'
+ }
M-A Ruel 2012/05/11 15:35:32 -2
csharp 2012/05/11 19:16:41 Done.
- expected = {
- 'test_case_name': TEST_NAME,
- 'data': self.correct_data,
- 'tests' : [
- {
- 'action': [
- 'python', 'src/tools/isolate/run_test_from_archive.py',
- '-m', FILE_NAME,
- '-r', 'http://' + self.hostname + '/hashtable/'
- ],
- 'test_name': 'Run Test'
- }
- ],
- 'env_vars': ENV_VARS,
- 'configurations': [
- {
- 'min_instances': 1,
- 'max_instances': 1,
- 'config_name': platform_mapping[switches.os_image],
- 'dimensions': {
- 'os': platform_mapping[switches.os_image],
- },
+ expected = {
+ 'test_case_name': TEST_NAME,
+ 'data': [urlparse.urljoin(switches.data_url, TEST_NAME + '.zip')],
+ 'tests' : [
+ {
+ 'action': [
+ 'python', 'src/tools/isolate/run_test_from_archive.py',
+ '-m', FILE_NAME,
+ '-r', urlparse.urljoin(switches.data_url, 'hashtable')
+ ],
+ 'test_name': 'Run Test'
+ }
+ ],
+ 'env_vars': ENV_VARS,
+ 'configurations': [
+ {
+ 'min_instances': 1,
+ 'max_instances': 1,
+ 'config_name': platform_mapping[switches.os_image],
+ 'dimensions': {
+ 'os': platform_mapping[switches.os_image],
},
- ],
- 'working_dir': switches.working_dir,
- 'cleanup': 'data'
- }
+ },
+ ],
+ 'working_dir': switches.working_dir,
+ 'cleanup': 'data'
+ }
+
+ if switches.os_image == 'win32':
+ expected['tests'].append(
+ {'action': ['del', 'unit_tests.zip'], 'test_name': 'Clean Up'})
+ else:
+ expected['tests'].append(
+ {'action': ['rm', '-rf', 'unit_tests.zip'], 'test_name': 'Clean Up'})
+
+ if switches.os_image == 'win32':
+ expected['tests'].append(
+ {
+ 'action': [
+ sys.executable,
+ '..\\b\\build\\scripts\\slave\\kill_processes.py'
+ ],
+ 'test_name': 'Kill Processes'
+ }
+ )
- if switches.os_image == 'win32':
- expected['tests'].append(
- {'action': ['del', 'unit_tests.zip'], 'test_name': 'Clean Up'})
- else:
- expected['tests'].append(
- {'action': ['rm', '-rf', 'unit_tests.zip'], 'test_name': 'Clean Up'})
-
- if switches.os_image == 'win32':
- expected['tests'].append(
- {
- 'action': [
- sys.executable,
- '..\\b\\build\\scripts\\slave\\kill_processes.py'
- ],
- 'test_name': 'Kill Processes'
- }
- )
-
- return expected
+ return expected
+
+class ManifestTest(unittest.TestCase):
def test_basic_manifest(self):
switches = Switches()
manifest = run_slavelastic.Manifest(FILE_NAME, TEST_NAME, switches)
manifest_json = json.loads(manifest.to_json())
- expected = self.GenerateExpectedJSON(switches)
+ expected = GenerateExpectedJSON(switches)
self.assertEqual(expected, manifest_json)
def test_basic_linux(self):
@@ -114,7 +109,7 @@ class ManifestTest(unittest.TestCase):
manifest_json = json.loads(manifest.to_json())
- expected = self.GenerateExpectedJSON(switches)
+ expected = GenerateExpectedJSON(switches)
self.assertEqual(expected, manifest_json)
« scripts/slave/run_slavelastic.py ('K') | « scripts/slave/run_slavelastic.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698