Skip to content

Commit

Permalink
Merge pull request #11055 from nsoranzo/framework_CI
Browse files Browse the repository at this point in the history
Move framework tests to GitHub workflows + lint test tools
  • Loading branch information
jmchilton authored Jan 5, 2021
2 parents c9ffab3 + 1509cca commit 7b7cc8e
Show file tree
Hide file tree
Showing 114 changed files with 1,975 additions and 1,758 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/framework.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Framework tests
on: [push, pull_request]
env:
GALAXY_TEST_DBURI: 'postgres://postgres:postgres@localhost:5432/galaxy?client_encoding=utf8'
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7']
services:
postgres:
image: postgres:11
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
steps:
- uses: actions/checkout@v2
with:
path: 'galaxy root'
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip dir
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip-cache-${{ matrix.python-version }}-${{ hashFiles('galaxy root/requirements.txt') }}
- name: Run tests
run: ./run_tests.sh --framework
working-directory: 'galaxy root'
- uses: actions/upload-artifact@v2
if: failure()
with:
name: Framework test results (${{ matrix.python-version }})
path: 'galaxy root/run_framework_tests.html'
8 changes: 7 additions & 1 deletion lib/galaxy_test/api/test_tools_upload.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import json

import pytest

from galaxy.tool_util.verify.test_data import TestDataResolver
from galaxy_test.base.constants import (
ONE_TO_SIX_ON_WINDOWS,
Expand Down Expand Up @@ -754,8 +756,12 @@ def test_upload_force_composite(self):
assert extra_file["path"] == "composite"
assert extra_file["class"] == "File"

@skip_if_site_down("https://usegalaxy.org")
def test_upload_from_invalid_url(self):
with pytest.raises(AssertionError):
self._upload('https://foo.invalid', assert_ok=False)

@skip_if_site_down("https://usegalaxy.org")
def test_upload_from_404_url(self):
history_id, new_dataset = self._upload('https://usegalaxy.org/bla123', assert_ok=False)
dataset_details = self.dataset_populator.get_history_dataset_details(history_id, dataset_id=new_dataset["id"], assert_ok=False)
assert dataset_details['state'] == 'error', "expected dataset state to be 'error', but got '%s'" % dataset_details['state']
Expand Down
17 changes: 9 additions & 8 deletions lib/galaxy_test/base/populators.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,20 @@ def wrapped_method(api_test_case, *args, **kwargs):
return method_wrapper


def skip_if_site_down(url):
def is_site_up(url):
try:
response = requests.get(url, timeout=10)
return response.status_code == 200
except Exception:
return False

def site_down():
try:
response = requests.get(url, timeout=10)
return response.status_code != 200
except Exception:
return False

def skip_if_site_down(url):

def method_wrapper(method):
@wraps(method)
def wrapped_method(api_test_case, *args, **kwargs):
_raise_skip_if(site_down(), "Test depends on [%s] being up and it appears to be down." % url)
_raise_skip_if(not is_site_up(url), f"Test depends on [{url}] being up and it appears to be down.")
method(api_test_case, *args, **kwargs)

return wrapped_method
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy_test/selenium/test_workflow_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def test_non_data_connections(self):
# Also the connector should disappear
tool_input.wait_for_absent_or_hidden()

# Now make it connected again and watch the requestss
# Now make it connected again and watch the requests
connect_icon.wait_for_and_click()

tool_input.wait_for_visible()
Expand Down
Loading

0 comments on commit 7b7cc8e

Please sign in to comment.