Skip to content

Commit

Permalink
So the travis CI wasn't actually running the tests.
Browse files Browse the repository at this point in the history
Tests were failing if run as root because there was a test for exception
being thrown in case of being asked to read an inaccessible file,
but when runa s root the file was always accessible so this test
always failed.  Added workaround that skips the test if run as root.
=> added tests into travis script (and Dockerfile)
  • Loading branch information
Tim Stickland committed Jun 2, 2020
1 parent ce33161 commit 71ab46e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ ENV PERL5LIB /opt/Bio-ENA-DataSubmission/lib:$PERL5LIB
ENV ENA_SUBMISSIONS_DATA /opt/Bio-ENA-DataSubmission/data
RUN cd /opt/Bio-ENA-DataSubmission && dzil authordeps --missing | cpanm --notest
RUN cd /opt/Bio-ENA-DataSubmission && dzil listdeps --missing | grep -v 'VRTrack::Lane' | cpanm --notest

RUN cd /opt/Bio-ENA-DataSubmission && \
dzil test
2 changes: 2 additions & 0 deletions install-travis-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,7 @@ cd $start_dir
dzil authordeps --missing | cpanm --notest
dzil listdeps --missing | grep -v 'VRTrack::Lane' | cpanm --notest

dzil test

set +eu
set +x
14 changes: 9 additions & 5 deletions t/Bio/ENA/DataSubmission/WEBINCli.t
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,15 @@ sub test_directory_not_a_directory {

# Check manifest validation when file is not readable
{
my $args = { %full_args };
$args->{'manifest'} = $unreadable_manifest;
my $under_test = Bio::ENA::DataSubmission::WEBINCli->new(%$args);
throws_ok {$under_test->run()} 'Bio::ENA::DataSubmission::Exception::CannotReadFile', "dies if manifest is not a readable file";

SKIP: {
skip "running as root, so disabled the test \"Check manifest validation when file is not readable\"", 1
if ('root' eq scalar(getpwuid $>));

my $args = { %full_args };
$args->{'manifest'} = $unreadable_manifest;
my $under_test = Bio::ENA::DataSubmission::WEBINCli->new(%$args);
throws_ok {$under_test->run()} 'Bio::ENA::DataSubmission::Exception::CannotReadFile', "dies if manifest is not a readable file";
}
}

remove_tree($temp_input_dir_name, $temp_output_dir_name, $filename, $manifest_filename, $temp_dir_name, $unreadable_manifest);
Expand Down

0 comments on commit 71ab46e

Please sign in to comment.