diff --git a/run_tests.sh b/run_tests.sh index 76be1823e68..80fadd5cb68 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -35,6 +35,14 @@ Run a specific API test: ./run_tests.sh -api test/api/test_tools.py:ToolsTestCase.test_map_over_with_output_format_actions +External Tests: + +A small subset of tests can be run against an existing Galxy +instance. The external Galaxy instance URL can be configured with +--external_url. If this is set eithre --external_master_key or +--external_user_key must be set as well - more tests can be executed +with --external_master_key than with a user key. + Extra options: --verbose_errors Force some tests produce more verbose error reporting. --no_cleanup Do not delete temp files for Python functional tests (-toolshed, -framework, etc...) @@ -45,6 +53,10 @@ Extra options: --dockerize Run tests in a pre-configured Docker container (must be first argument if present). --db For use with --dockerize, run tests using partially migrated 'postgres', 'mysql', or 'sqlite' databases. + --external_url External URL to use for Galaxy testing (only certain tests). + --external_master_key Master API key used to configure external tests. + --external_user_key User API used for external tests - not required if + external_master_key is specified. Environment Variables: @@ -200,6 +212,18 @@ do with_framework_test_tools_arg="-with_framework_test_tools" shift ;; + --external_url) + GALAXY_TEST_EXTERNAL=$2 + shift 2 + ;; + --external_master_key) + GALAXY_CONFIG_MASTER_KEY=$2 + shift 2 + ;; + --external_user_key) + GALAXY_TEST_USER_API_KEY=$2 + shift 2 + ;; -w|-workflow|--workflow) if [ $# -gt 1 ]; then workflow_file=$2 diff --git a/scripts/functional_tests.py b/scripts/functional_tests.py index 668f3669ae4..db49adfcda8 100644 --- a/scripts/functional_tests.py +++ b/scripts/functional_tests.py @@ -38,14 +38,14 @@ def main(): default_tool_conf = driver_util.FRAMEWORK_SAMPLE_TOOLS_CONF datatypes_conf_override = driver_util.FRAMEWORK_DATATYPES_CONF - start_server = 'GALAXY_TEST_EXTERNAL' not in os.environ + external_galaxy = os.environ.get('GALAXY_TEST_EXTERNAL', None) galaxy_test_tmp_dir = driver_util.get_galaxy_test_tmp_dir() app = None server_wrapper = None - if start_server: + if external_galaxy is None: tempdir = tempfile.mkdtemp( dir=galaxy_test_tmp_dir ) # Configure the database path. galaxy_db_path = driver_util.database_files_path(tempdir) @@ -65,6 +65,8 @@ def main(): galaxy_config, ) log.info("Functional tests will be run against %s:%s" % (server_wrapper.host, server_wrapper.port)) + else: + log.info("Functional tests will be run against %s" % external_galaxy) # ---- Find tests --------------------------------------------------------- success = False @@ -90,19 +92,20 @@ def main(): user_api_key=get_user_api_key(), ) - # We must make sure that functional.test_toolbox is always imported after - # database_contexts.galaxy_content is set (which occurs in this method above). - # If functional.test_toolbox is imported before database_contexts.galaxy_content - # is set, sa_session will be None in all methods that use it. - import functional.test_toolbox - functional.test_toolbox.toolbox = app.toolbox - # When testing data managers, do not test toolbox. - functional.test_toolbox.build_tests( - app=app, - testing_shed_tools=testing_shed_tools, - master_api_key=get_master_api_key(), - user_api_key=get_user_api_key(), - ) + if app is not None: + # We must make sure that functional.test_toolbox is always imported after + # database_contexts.galaxy_content is set (which occurs in this method above). + # If functional.test_toolbox is imported before database_contexts.galaxy_content + # is set, sa_session will be None in all methods that use it. + import functional.test_toolbox + functional.test_toolbox.toolbox = app.toolbox + # When testing data managers, do not test toolbox. + functional.test_toolbox.build_tests( + app=app, + testing_shed_tools=testing_shed_tools, + master_api_key=get_master_api_key(), + user_api_key=get_user_api_key(), + ) success = driver_util.nose_config_and_run() except: log.exception( "Failure running tests" ) diff --git a/test/base/twilltestcase.py b/test/base/twilltestcase.py index 0a9af77d3c6..3fe965d1835 100644 --- a/test/base/twilltestcase.py +++ b/test/base/twilltestcase.py @@ -48,7 +48,8 @@ class TwillTestCase( unittest.TestCase ): self.history_id = os.environ.get( 'GALAXY_TEST_HISTORY_ID', None ) self.host = os.environ.get( 'GALAXY_TEST_HOST' ) self.port = os.environ.get( 'GALAXY_TEST_PORT' ) - self.url = "http://%s:%s" % ( self.host, self.port ) + default_url = "http://%s:%s" % (self.host, self.port) + self.url = os.environ.get('GALAXY_TEST_EXTERNAL', default_url) self.test_data_resolver = TestDataResolver( ) self.tool_shed_test_file = os.environ.get( 'GALAXY_TOOL_SHED_TEST_FILE', None ) if self.tool_shed_test_file: