Skip to content

Commit

Permalink
workflows: add pytest vcr for tests
Browse files Browse the repository at this point in the history
Signed-off-by: Parth Shandilya <[email protected]>
  • Loading branch information
Parth Shandilya committed Mar 14, 2022
1 parent 3a796c1 commit 0e4d198
Show file tree
Hide file tree
Showing 14 changed files with 560 additions and 248 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/web-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Backend tests

on:
push:
branches: [ master, reana ]
branches: [ master ]
paths-ignore:
- 'ui/**'
pull_request:
Expand Down Expand Up @@ -92,7 +92,6 @@ jobs:
runs-on: ubuntu-18.04
env:
REANA_SERVER_URL: https://reana.cern.ch
APP_REANA_CMS_ACCESS_TOKEN: ${{ secrets.APP_REANA_CMS_ACCESS_TOKEN }}
services:
redis:
image: redis
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,5 @@ recursive-include ui *.woff
recursive-include ui *.yarnclean
recursive-include ui *.yml
recursive-include ui *.editorconfig
recursive-include tests *.yaml
prune docs/_build
9 changes: 5 additions & 4 deletions cap/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,11 +760,12 @@ def _(x):

# Reana server url
# ================
REANA_SERVER_URL = os.environ.get('APP_REANA_SERVER_URL', 'https://reana.cern.ch')
REANA_ACCESS_TOKEN = {
'ATLAS': os.environ.get('APP_REANA_ATLAS_ACCESS_TOKEN'),
'ALICE': os.environ.get('APP_REANA_ALICE_ACCESS_TOKEN'),
'CMS': os.environ.get('APP_REANA_CMS_ACCESS_TOKEN'),
'LHCb': os.environ.get('APP_REANA_LHCb_ACCESS_TOKEN')
'ATLAS': os.environ.get('APP_REANA_ATLAS_ACCESS_TOKEN', "default"),
'ALICE': os.environ.get('APP_REANA_ALICE_ACCESS_TOKEN', "default"),
'CMS': os.environ.get('APP_REANA_CMS_ACCESS_TOKEN', "default"),
'LHCb': os.environ.get('APP_REANA_LHCb_ACCESS_TOKEN', "default")
}

# Keytabs
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
'yapf>=0.28.0',
'responses==0.10.6',
'selenium>=3.4.3',
'pytest-vcr',
]

extras_require = {'docs': ['Sphinx>=1.5.1'], 'tests': tests_require}
Expand Down
26 changes: 26 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,3 +833,29 @@ def git_repo_tar():
def file_tar():
return b'\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x03+I-.Q(J-\xc8WH' \
b'\xcb/RHN,\xe0\x02\x00\xeb\xd5!\xe0\x12\x00\x00\x00'


@pytest.fixture(scope="session")
def vcr_config():
return {
"filter_query_parameters": ["access_token"],
"ignore_localhost": True,
"decode_compressed_response": True,
"filter_headers": ("Authorization", "User-Agent"),
"ignore_hosts": (
"cache",
"db",
"elasticsearch",
"flower",
"indexer",
"localhost",
"mq",
"postgres",
"redis",
"ui",
"web-worker",
"web",
"worker",
),
"record_mode": "once",
}
242 changes: 0 additions & 242 deletions tests/integration/test_reana_workflows.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
method: GET
uri: https://reana.cern.ch/api/workflows/4e4e6afc-fd57-4f59-836a-40ae19d2d6d0/logs
response:
body:
string: "{\n \"logs\": \"{\\\"workflow_logs\\\": \\\"\\\", \\\"job_logs\\\"\
: {}, \\\"engine_specific\\\": null}\", \n \"user\": \"63449ef7-be3a-4e77-b503-fb18a2e8a702\"\
, \n \"workflow_id\": \"4e4e6afc-fd57-4f59-836a-40ae19d2d6d0\", \n \"workflow_name\"\
: \"sturdy-wallaby.1\"\n}\n"
headers:
Access-Control-Allow-Origin:
- '*'
Access-Control-Expose-Headers:
- Content-Type, ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
Content-Length:
- '236'
Content-Type:
- application/json
Date:
- Mon, 14 Mar 2022 14:06:15 GMT
Referrer-Policy:
- strict-origin-when-cross-origin
Retry-After:
- '1'
Strict-Transport-Security:
- max-age=31556926; includeSubDomains
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- sameorigin
X-Ratelimit-Limit:
- '20'
X-Ratelimit-Remaining:
- '19'
X-Ratelimit-Reset:
- '1647266777'
X-Xss-Protection:
- 1; mode=block
status:
code: 200
message: OK
version: 1
Loading

0 comments on commit 0e4d198

Please sign in to comment.