Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(test): add test command skeleton (#720) #720

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
The list of contributors in alphabetical order:

- [Adelina Lintuluoto](https://orcid.org/0000-0002-0726-1452)
- [Alastair Lyall] (https://orcid.org/0009-0000-4955-8935)
- [Anton Khodak](https://orcid.org/0000-0003-3263-4553)
- [Audrius Mecionis](https://orcid.org/0000-0002-3759-1663)
- [Camila Diaz](https://orcid.org/0000-0001-5543-797X)
Expand Down
4 changes: 4 additions & 0 deletions docs/cmd_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@ Secret management commands:
secrets-add Add secrets from literal string or from file.
secrets-delete Delete user secrets by name.
secrets-list List user secrets.

Workflow run test commands:
test Test workflow execution, based on a given Gherkin file.

11 changes: 10 additions & 1 deletion reana_client/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@
import click
from urllib3 import disable_warnings

from reana_client.cli import workflow, files, ping, secrets, quotas, retention_rules
from reana_client.cli import (
workflow,
files,
ping,
secrets,
quotas,
retention_rules,
test,
)
from reana_client.utils import get_api_url

DEBUG_LOG_FORMAT = (
Expand Down Expand Up @@ -45,6 +53,7 @@ class ReanaCLI(click.Group):
files.files_group,
retention_rules.retention_rules_group,
secrets.secrets_group,
test.test_group,
]

def __init__(self, name=None, commands=None, **attrs):
Expand Down
43 changes: 43 additions & 0 deletions reana_client/cli/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"""REANA client test commands."""

import click
from reana_client.cli.utils import add_access_token_options, check_connection
from reana_client.validation.utils import validate_workflow_name_parameter


@click.group(help="Workflow run test commands")
def test_group():
"""Workflow run test commands."""


@test_group.command("test")
@click.option(
"-w",
"--workflow",
default="",
callback=validate_workflow_name_parameter,
help="Name of workflow to be tested",
)
@click.option(
"-n",
"--test_file",
default="test.feature",
help="Gherkin file for testing properties of a workflow execution",
)
@click.pass_context
@add_access_token_options
@check_connection
def test(ctx, workflow, test_file, access_token):
r"""
Test workflow execution, based on a given Gherkin file.

The ``test`` command allows for testing of a workflow execution,
by assessing whether it meets certain properties specified in a
chosen feature file.

Example: \n
\t $ reana-client test -w myanalysis -n test_analysis.feature\n
"""
click.echo(

Check warning on line 41 in reana_client/cli/test.py

View check run for this annotation

Codecov / codecov/patch

reana_client/cli/test.py#L41

Added line #L41 was not covered by tests
f"Checked {workflow} using {test_file}, and everything works!"
) # to be changed/implemented of course
Loading