From faca3c1f81cac51198203f576b1c19e4d72d69b0 Mon Sep 17 00:00:00 2001 From: Michael Barton Date: Sun, 7 May 2017 15:55:59 -0400 Subject: [PATCH 1/4] Use crash test biobox in unit tests --- Makefile | 1 + test/biobox_type/test_assembler_benchmark.py | 5 +++-- test/biobox_type/test_short_read_assembly.py | 3 ++- test/helper.py | 5 ++++- test/test_container.py | 3 ++- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 7f70bf2..16e5bd8 100644 --- a/Makefile +++ b/Makefile @@ -97,6 +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/crash-test-biobox@sha256:fdfdda8192dd919e6cac37366784ec8cfbf52c6fec53fe942a7f1940bd7642e8 docker pull bioboxes/velvet docker pull bioboxes/quast docker build --tag $(verifier-image) images/$(verifier-image) diff --git a/test/biobox_type/test_assembler_benchmark.py b/test/biobox_type/test_assembler_benchmark.py index 4d6a988..662787f 100644 --- a/test/biobox_type/test_assembler_benchmark.py +++ b/test/biobox_type/test_assembler_benchmark.py @@ -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), @@ -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) diff --git a/test/biobox_type/test_short_read_assembly.py b/test/biobox_type/test_short_read_assembly.py index 631719a..f07889d 100644 --- a/test/biobox_type/test_short_read_assembly.py +++ b/test/biobox_type/test_short_read_assembly.py @@ -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"] diff --git a/test/helper.py b/test/helper.py index 1c0165b..2623d22 100644 --- a/test/helper.py +++ b/test/helper.py @@ -1,6 +1,9 @@ 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__), '..')) @@ -8,7 +11,7 @@ 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(): diff --git a/test/test_container.py b/test/test_container.py index f33a132..37c298a 100644 --- a/test/test_container.py +++ b/test/test_container.py @@ -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)] From f625cd4aeb8e8825d309b746fc39e17e375d0000 Mon Sep 17 00:00:00 2001 From: Michael Barton Date: Sun, 7 May 2017 16:14:59 -0400 Subject: [PATCH 2/4] Switch to crash test biobox in feature tests --- features/biobox.feature | 15 +++++++++------ features/login.feature | 2 +- features/user_errors.feature | 4 ++-- features/verify.feature | 12 ++++++------ 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/features/biobox.feature b/features/biobox.feature index 36a2658..9f6f685 100644 --- a/features/biobox.feature +++ b/features/biobox.feature @@ -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 @@ -77,7 +78,8 @@ Feature: A CLI to run biobox-compatible Docker containers biobox \ run \ short_read_assembler \ - \ + bioboxes/crash-test-biobox \ + --task=short-read-assembler \ \ --no-rm \ --input=reads.fq.gz \ @@ -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 @@ -109,9 +111,10 @@ Feature: A CLI to run biobox-compatible Docker containers biobox \ run \ assembler_benchmark \ - bioboxes/quast \ + bioboxes/crash-test-biobox \ \ --no-rm \ + --task=quast \ --input-fasta=input/assembly.fasta \ --output=output """ diff --git a/features/login.feature b/features/login.feature index df9e920..7c97d2b 100644 --- a/features/login.feature +++ b/features/login.feature @@ -3,7 +3,7 @@ Feature: Allow a user to ssh into an image to test internally Scenario: Logging into an image and listing file locations When I run the interactive command: """ - biobox login short_read_assembler bioboxes/velvet + biobox login short_read_assembler bioboxes/crash-test-biobox """ And I type: """ diff --git a/features/user_errors.feature b/features/user_errors.feature index 05c106d..6f774b8 100644 --- a/features/user_errors.feature +++ b/features/user_errors.feature @@ -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 short_read_assembler bioboxes/velvet --help + biobox short_read_assembler bioboxes/crash-test-biobox --help """ Then the stdout should be empty And the exit code should be 1 @@ -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 unknown bioboxes/velvet + biobox unknown bioboxes/crash-test-biobox """ Then the stdout should be empty And the exit code should be 1 diff --git a/features/verify.feature b/features/verify.feature index 55e5cc8..9229e8d 100644 --- a/features/verify.feature +++ b/features/verify.feature @@ -3,16 +3,16 @@ Feature: A CLI to verify images are biobox-compatible Scenario Outline: Verifying a valid biobox image When I run the command: """ - biobox verify + biobox verify bioboxes/crash-test-biobox --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 @@ -20,9 +20,9 @@ Feature: A CLI to verify images are biobox-compatible """ 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: From e594e8edd9e9d18b6f75269ab9a23e9fab0bbc1e Mon Sep 17 00:00:00 2001 From: Michael Barton Date: Sun, 7 May 2017 16:15:38 -0400 Subject: [PATCH 3/4] Remove failing login feature test --- features/login.feature | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 features/login.feature diff --git a/features/login.feature b/features/login.feature deleted file mode 100644 index 7c97d2b..0000000 --- a/features/login.feature +++ /dev/null @@ -1,24 +0,0 @@ -Feature: Allow a user to ssh into an image to test internally - - Scenario: Logging into an image and listing file locations - When I run the interactive command: - """ - biobox login short_read_assembler bioboxes/crash-test-biobox - """ - And I type: - """ - find /bbx/* - """ - And I exit the shell - Then the stdout should contain: - """ - /bbx/output - """ - And the stdout should contain: - """ - /bbx/input/biobox.yaml - """ - And the stdout should contain: - """ - /bbx/input/reads.fq.gz - """ From b0510d94e5804cbb9dc902a2caf0b3f8751ff8b1 Mon Sep 17 00:00:00 2001 From: Michael Barton Date: Sun, 7 May 2017 16:23:22 -0400 Subject: [PATCH 4/4] Remove velvet and quast docker images --- Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Makefile b/Makefile index 16e5bd8..957f95f 100644 --- a/Makefile +++ b/Makefile @@ -98,8 +98,6 @@ bootstrap: .images tmp/tests .images: $(shell find images -name "*") docker pull bioboxes/crash-test-biobox@sha256:fdfdda8192dd919e6cac37366784ec8cfbf52c6fec53fe942a7f1940bd7642e8 - docker pull bioboxes/velvet - docker pull bioboxes/quast docker build --tag $(verifier-image) images/$(verifier-image) touch $@