Skip to content

Commit

Permalink
tests: configure SHARED_VOLUME_PATH in Travis
Browse files Browse the repository at this point in the history
* Uses latest pytes-reana which allows configuring the
  `tmp_shared_volume_path` fixture through environment variable
  which is needed because of reanahub/reana-commons#217.

* Amends test according to latest changes.
  • Loading branch information
Diego Rodriguez committed Oct 15, 2020
1 parent c7a623d commit c9dc85e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 29 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ install:
- travis_retry pip install -e .[all]

script:
- ./run-tests.sh
- mkdir /tmp/reana
- SHARED_VOLUME_PATH=/tmp/reana ./run-tests.sh

after_success:
- coveralls
1 change: 1 addition & 0 deletions reana_workflow_controller/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import json
import logging
import traceback
import uuid
from datetime import datetime

Expand Down
1 change: 1 addition & 0 deletions reana_workflow_controller/rest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import os
import pprint
import subprocess
import traceback
from collections import OrderedDict
from datetime import datetime
from functools import wraps
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ python-dateutil==2.8.1 # via alembic, bravado, bravado-core, kubernetes
python-editor==1.0.4 # via alembic
pytz==2020.1 # via bravado-core, fs
pyyaml==5.3.1 # via bravado, bravado-core, kubernetes, reana-commons, swagger-spec-validator
reana-commons[kubernetes]==0.8.0a3 # via reana-db, reana-workflow-controller (setup.py)
reana-commons[kubernetes]==0.8.0a4 # via reana-db, reana-workflow-controller (setup.py)
reana-db==0.8.0a5 # via reana-workflow-controller (setup.py)
requests-oauthlib==1.3.0 # via kubernetes
requests==2.20.0 # via bravado, kubernetes, reana-workflow-controller (setup.py), requests-oauthlib
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
history = open("CHANGES.rst").read()

tests_require = [
"pytest-reana>=0.7.0.dev20200707,<0.8.0",
"pytest-reana>=0.8.0a1,<0.9.0",
]

extras_require = {
Expand Down Expand Up @@ -51,7 +51,7 @@
"jsonpickle>=0.9.6",
"marshmallow>2.13.0,<=2.20.1",
"packaging>=18.0",
"reana-commons[kubernetes]>=0.8.0a3,<0.9.0",
"reana-commons[kubernetes]>=0.8.0a4,<0.9.0",
"reana-db>=0.8.0a5,<0.9.0",
"requests==2.20.0",
"sqlalchemy-utils>=0.31.0",
Expand Down
39 changes: 14 additions & 25 deletions tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,6 @@ def test_get_workflow_diff(
sample_yadage_workflow_in_db,
sample_serial_workflow_in_db,
tmp_shared_volume_path,
sample_workflow_workspace,
):
"""Test set workflow status for unknown workflow."""
with app.test_client() as client:
Expand Down Expand Up @@ -1226,34 +1225,24 @@ def test_get_workspace_diff(
sample_yadage_workflow_in_db,
sample_serial_workflow_in_db,
tmp_shared_volume_path,
sample_workflow_workspace,
):
"""Test get workspace differences."""
# create the workspaces for the two workflows
workspace_path_a = next(
sample_workflow_workspace(str(sample_serial_workflow_in_db.workspace_path))
workspace_path_a = os.path.join(
tmp_shared_volume_path, sample_serial_workflow_in_db.workspace_path
)
workspace_path_b = next(
sample_workflow_workspace(str(sample_yadage_workflow_in_db.workspace_path))
workspace_path_b = os.path.join(
tmp_shared_volume_path, sample_yadage_workflow_in_db.workspace_path
)

sample_serial_workflow_in_db.get_workspace = lambda: str(
sample_serial_workflow_in_db.id_
)
sample_yadage_workflow_in_db.get_workspace = lambda: str(
sample_yadage_workflow_in_db.id_
)
# modify the contents in one file
with open(
os.path.join(
workspace_path_a,
"data",
"World_historical_and_predicted_populations_in_percentage.csv",
),
"a",
) as f:
f.write("An extra line")
f.flush()
# Create files that differ in one line
csv_line = "1,2,3,4"
file_name = "test.csv"
for index, workspace in enumerate([workspace_path_a, workspace_path_b]):
with open(os.path.join(workspace, file_name), "w",) as f:
f.write("# File {}".format(index))
f.write(os.linesep)
f.write(csv_line)
f.flush()
with app.test_client() as client:
res = client.get(
url_for(
Expand All @@ -1266,7 +1255,7 @@ def test_get_workspace_diff(
)
assert res.status_code == 200
response_data = json.loads(res.get_data(as_text=True))
assert "An extra line" in response_data["workspace_listing"]
assert "# File" in response_data["workspace_listing"]


def test_create_interactive_session(app, default_user, sample_serial_workflow_in_db):
Expand Down

0 comments on commit c9dc85e

Please sign in to comment.