From 9fb0529036058a2ef1370cdf8b6e82e5e928d4bc Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Tue, 13 Aug 2013 14:03:31 -0400 Subject: [PATCH] Sauce can only connect on certain ports --- cms/envs/acceptance.py | 11 ++++++++--- common/djangoapps/terrain/browser.py | 7 ++++--- lms/envs/acceptance.py | 16 ++++++++++------ 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/cms/envs/acceptance.py b/cms/envs/acceptance.py index 94d6d7697a..24a5a02533 100644 --- a/cms/envs/acceptance.py +++ b/cms/envs/acceptance.py @@ -18,7 +18,12 @@ DEBUG = True import logging logging.disable(logging.ERROR) import os -import random +from random import choice +PORTS = [80, 443, 888, 2000, 2001, 2020, 2109, 2222, 2310, 3000, 3001, + 3030, 3210, 3333, 4000, 4001, 4040, 4321, 4502, 4503, 5000, 5001, + 5050, 5555, 5432, 6000, 6001, 6060, 6666, 6543, 7000, 7070, 7774, + 7777, 8000, 8001, 8003, 8031, 8080, 8081, 8765, 8888, 9000, 9001, + 9080, 9090, 9876, 9999, 49221, 55001] def seed(): @@ -92,11 +97,11 @@ MITX_FEATURES['SAUCE'] = { 'DEVICE' : '', 'SESSION' : 'Lettuce Tests', 'BUILD' : 'CMS TESTS', - 'TAGS' : '' + 'CUSTOM_TAGS' : {} } # Include the lettuce app for acceptance testing, including the 'harvest' django-admin command INSTALLED_APPS += ('lettuce.django',) LETTUCE_APPS = ('contentstore',) -LETTUCE_SERVER_PORT = random.randint(1024, 65535) +LETTUCE_SERVER_PORT = choice(PORTS) LETTUCE_BROWSER = 'chrome' diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index 9b4885e160..62e9cde9c0 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -62,7 +62,7 @@ desired_capabilities['version'] = SAUCE.get('VERSION', '') desired_capabilities['device-type'] = SAUCE.get('DEVICE', '') desired_capabilities['name'] = SAUCE.get('SESSION', 'Lettuce Tests') desired_capabilities['build'] = SAUCE.get('BUILD', 'edX Plaform') -desired_capabilities['tags'] = SAUCE.get('TAGS', '') +desired_capabilities['custom-data'] = SAUCE.get('CUSTOM_TAGS', '') desired_capabilities['video-upload-on-pass'] = False desired_capabilities['sauce-advisor'] = False desired_capabilities['record-screenshots'] = False @@ -104,12 +104,13 @@ def initial_setup(server): url="http://{}:{}@ondemand.saucelabs.com:80/wd/hub".format(config['username'],config['access-key']), **desired_capabilities ) + global jobid + jobid = world.browser.driver.session_id else: world.browser = Browser(browser_driver) world.browser.driver.implicitly_wait(30) - global jobid - jobid = world.browser.driver.session_id + # Try to visit the main page # If the browser session is invalid, this will # raise a WebDriverException diff --git a/lms/envs/acceptance.py b/lms/envs/acceptance.py index e9b7163d24..f908c31bdc 100644 --- a/lms/envs/acceptance.py +++ b/lms/envs/acceptance.py @@ -19,8 +19,12 @@ DEBUG = True import logging logging.disable(logging.ERROR) import os -import random - +from random import choice +PORTS = [80, 443, 888, 2000, 2001, 2020, 2109, 2222, 2310, 3000, 3001, + 3030, 3210, 3333, 4000, 4001, 4040, 4321, 4502, 4503, 5000, 5001, + 5050, 5555, 5432, 6000, 6001, 6060, 6666, 6543, 7000, 7070, 7774, + 7777, 8000, 8001, 8003, 8031, 8080, 8081, 8765, 8888, 9000, 9001, + 9080, 9090, 9876, 9999, 49221, 55001] def seed(): return os.getppid() @@ -67,7 +71,7 @@ DATABASES = { # Set up XQueue information so that the lms will send # requests to a mock XQueue server running locally -XQUEUE_PORT = random.randint(1024, 65535) +XQUEUE_PORT = choice(PORTS) XQUEUE_INTERFACE = { "url": "http://127.0.0.1:%d" % XQUEUE_PORT, "django_auth": { @@ -99,12 +103,12 @@ MITX_FEATURES['SAUCE'] = { 'VERSION' : '', 'DEVICE' : '', 'SESSION' : 'Lettuce Tests', - 'BUILD' : 'LMS TESTS', - 'TAGS' : '' + 'BUILD' : 'CMS TESTS', + 'CUSTOM_TAGS' : {} } # Include the lettuce app for acceptance testing, including the 'harvest' django-admin command INSTALLED_APPS += ('lettuce.django',) LETTUCE_APPS = ('courseware',) -LETTUCE_SERVER_PORT = random.randint(1024, 65535) +LETTUCE_SERVER_PORT = choice(PORTS) LETTUCE_BROWSER = 'chrome'