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

Speed up tests using crash test biobox #113

Open
wants to merge 4 commits into
base: version/0.6.1
Choose a base branch
from
Open
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
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ $(dist): $(shell find biobox_cli) requirements/default.txt setup.py MANIFEST.in
bootstrap: .images tmp/tests

.images: $(shell find images -name "*")
docker pull bioboxes/velvet
docker pull bioboxes/quast
docker pull bioboxes/crash-test-biobox@sha256:fdfdda8192dd919e6cac37366784ec8cfbf52c6fec53fe942a7f1940bd7642e8
docker build --tag $(verifier-image) images/$(verifier-image)
touch $@

Expand Down
15 changes: 9 additions & 6 deletions features/biobox.feature
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ Feature: A CLI to run biobox-compatible Docker containers
biobox \
run \
short_read_assembler \
bioboxes/velvet \
bioboxes/crash-test-biobox \
--task=short-read-assembler \
--no-rm \
--input=$(realpath reads.fq.gz) \
--output=$(realpath .)/contigs.fa
Expand All @@ -77,7 +78,8 @@ Feature: A CLI to run biobox-compatible Docker containers
biobox \
run \
short_read_assembler \
<assembler> \
bioboxes/crash-test-biobox \
--task=short-read-assembler \
<resources> \
--no-rm \
--input=reads.fq.gz \
Expand All @@ -90,9 +92,9 @@ Feature: A CLI to run biobox-compatible Docker containers
And the file "contigs.fa" should not be empty

Examples:
| assembler | resources |
| bioboxes/velvet | --memory=1g |
| bioboxes/velvet | --cpu-shares=512 |
| resources |
| --memory=1g |
| --cpu-shares=512 |


Scenario Outline: Running a biobox assembler benchmark container
Expand All @@ -109,9 +111,10 @@ Feature: A CLI to run biobox-compatible Docker containers
biobox \
run \
assembler_benchmark \
bioboxes/quast \
bioboxes/crash-test-biobox \
<resources> \
--no-rm \
--task=quast \
--input-fasta=input/assembly.fasta \
--output=output
"""
Expand Down
24 changes: 0 additions & 24 deletions features/login.feature

This file was deleted.

4 changes: 2 additions & 2 deletions features/user_errors.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Feature: Providing useful errors to a user when they run the tool incorrectly
Scenario Outline: Trying to run an unknown command
When I run the command:
"""
biobox <cmd> short_read_assembler bioboxes/velvet --help
biobox <cmd> short_read_assembler bioboxes/crash-test-biobox --help
"""
Then the stdout should be empty
And the exit code should be 1
Expand All @@ -23,7 +23,7 @@ Feature: Providing useful errors to a user when they run the tool incorrectly
Scenario Outline: Trying to use an unknown biobox type
When I run the command:
"""
biobox <command> unknown bioboxes/velvet
biobox <command> unknown bioboxes/crash-test-biobox
"""
Then the stdout should be empty
And the exit code should be 1
Expand Down
12 changes: 6 additions & 6 deletions features/verify.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@ Feature: A CLI to verify images are biobox-compatible
Scenario Outline: Verifying a valid biobox image
When I run the command:
"""
biobox verify <type> <image> <args>
biobox verify <type> bioboxes/crash-test-biobox --task=<task>
"""
Then the stdout should be empty
And the stderr should be empty
And the exit code should be 0

Examples:
| type | image | args |
| short_read_assembler | bioboxes/velvet | --task=default |
| assembler_benchmark | bioboxes/quast | |
| type | task |
| short_read_assembler | short-read-assembler |
| assembler_benchmark | quast |


Scenario: Generating a verbose output of biobox image verification
When I run the command:
"""
biobox verify \
short_read_assembler \
bioboxes/velvet \
bioboxes/crash-test-biobox \
--verbose \
--t default
--t short-read-assembler
"""
Then the stderr should be empty
And the stdout should equal:
Expand Down
5 changes: 3 additions & 2 deletions test/biobox_type/test_assembler_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
def create_args(output):
return ["run",
"assembler_benchmark",
"bioboxes/quast",
helper.test_image(),
"--task=quast",
"--input-fasta={}".format(helper.verification_file('assembler_benchmark/assembly.fasta')),
"--input-ref={}".format(helper.verification_file('assembler_benchmark/references')),
"--output={}".format(output),
Expand All @@ -31,7 +32,7 @@ def test_assembly_benchmark_with_refs_and_non_existing_output():
def test_assembly_benchmark_with_no_refs():
path = os.path.join(tempfile.mkdtemp(), "quast")
args = create_args(path)
del args[4] # Delete the reference from the input arg list
del args[5] # Delete the reference from the input arg list
biobox.run(args)
expected = os.path.join(path, "biobox.yaml")
assert os.path.isfile(expected)
3 changes: 2 additions & 1 deletion test/biobox_type/test_short_read_assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
def create_args(output):
return ["run",
"short_read_assembler",
"bioboxes/velvet",
helper.test_image(),
"--task=short-read-assembler",
"--input={}".format(helper.verification_file('short_read_assembler/genome_paired_reads.fq.gz')),
"--output={}".format(output),
"--no-rm"]
Expand Down
5 changes: 4 additions & 1 deletion test/helper.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import os, os.path
import biobox_cli.container as ctn

def test_image():
return 'bioboxes/crash-test-biobox@sha256:fdfdda8192dd919e6cac37366784ec8cfbf52c6fec53fe942a7f1940bd7642e8'

def project_root():
return os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))

def verification_file(path):
return os.path.join(project_root(), "biobox_cli", "verification", "data", path)

def is_ci_server():
return "CIRCLECI" in os.environ.keys()
return "CI" in os.environ.keys()

def remove_container(container):
if not is_ci_server():
Expand Down
3 changes: 2 additions & 1 deletion test/test_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
def create_args(output):
return ["run",
"short_read_assembler",
"bioboxes/velvet",
helper.test_image(),
"--task=short-read-assembler",
"--input={}".format(helper.verification_file('short_read_assembler/genome_paired_reads.fq.gz')),
"--output={}".format(output)]

Expand Down