Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ensembl-gh-mirror
ensembl-hive
Commits
0082bb91
Commit
0082bb91
authored
Jun 04, 2019
by
Carla Cummins
Committed by
ens-bwalts
Dec 16, 2020
Browse files
Added unit test for peekJob.pl
parent
b1e82d7c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
2 deletions
+69
-2
modules/Bio/EnsEMBL/Hive/Scripts/PeekJob.pm
modules/Bio/EnsEMBL/Hive/Scripts/PeekJob.pm
+1
-1
modules/Bio/EnsEMBL/Hive/Utils/Test.pm
modules/Bio/EnsEMBL/Hive/Utils/Test.pm
+19
-1
t/03.scripts/peekJob_output.t
t/03.scripts/peekJob_output.t
+49
-0
No files found.
modules/Bio/EnsEMBL/Hive/Scripts/PeekJob.pm
View file @
0082bb91
...
...
@@ -37,7 +37,7 @@ sub peek {
$job
->
load_parameters
;
my
$unsub_params
=
$job
->
{'
_unsubstituted_param_hash
'};
print
D
umper
$unsub_params
;
print
D
ata::
Dumper
->
Dump
(
[
$unsub_params
],
[
qw(*unsubstituted_param_hash)
]
)
;
# my @ordered_params = sort { lc($a) cmp lc($b) } keys %$unsub_params;
# print "{\n";
...
...
modules/Bio/EnsEMBL/Hive/Utils/Test.pm
View file @
0082bb91
...
...
@@ -46,7 +46,7 @@ use Bio::EnsEMBL::Hive::Scripts::StandaloneJob;
our
@ISA
=
qw(Exporter)
;
our
@EXPORT
=
();
our
%EXPORT_TAGS
=
();
our
@EXPORT_OK
=
qw( standaloneJob init_pipeline runWorker beekeeper generate_graph visualize_jobs db_cmd seed_pipeline get_test_urls get_test_url_or_die run_sql_on_db load_sql_in_db make_new_db_from_sqls make_hive_db safe_drop_database all_source_files)
;
our
@EXPORT_OK
=
qw( standaloneJob init_pipeline runWorker beekeeper generate_graph visualize_jobs db_cmd seed_pipeline
tweak_pipeline peekJob
get_test_urls get_test_url_or_die run_sql_on_db load_sql_in_db make_new_db_from_sqls make_hive_db safe_drop_database all_source_files)
;
our
$VERSION
=
'
0.00
';
...
...
@@ -345,6 +345,24 @@ sub visualize_jobs {
return
_test_ehive_script
('
visualize_jobs
',
@
_
);
}
=head2 peekJob
Arg[1] : String $url. The location of the database
Arg[2] : Arrayref $args. Extra arguments given to peekJob.pl
Arg[3] : String $test_name (optional). The name of the test
Example : peekJob($url, [-job_id => 1], 'Check params for job 1');
Description : Very generic function to run peekJob.pl on the given database with the given arguments
Returntype : None
Exceptions : TAP-style
Caller : general
Status : Stable
=cut
sub
peekJob
{
return
_test_ehive_script
('
peekJob
',
@
_
);
}
=head2 db_cmd
...
...
t/03.scripts/peekJob_output.t
0 → 100644
View file @
0082bb91
#!/usr/bin/env perl
# Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
# Copyright [2016-2019] EMBL-European Bioinformatics Institute
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
use
strict
;
use
warnings
;
use
Test::
More
;
use
Data::
Dumper
;
use
Test::
JSON
;
use
JSON
qw(decode_json)
;
use
Capture::
Tiny
'
:all
';
use
Bio::EnsEMBL::Hive::Utils::
Test
qw(init_pipeline runWorker beekeeper get_test_url_or_die run_sql_on_db peekJob)
;
# eHive needs this to initialize the pipeline (and run db_cmd.pl)
$ENV
{'
EHIVE_ROOT_DIR
'}
||=
File::Basename::
dirname
(
File::Basename::
dirname
(
File::Basename::
dirname
(
Cwd::
realpath
(
$
0
)
)
)
);
my
$pipeline_url
=
get_test_url_or_die
();
# Starting a first set of checks with a "GCPct" pipeline
init_pipeline
('
Bio::EnsEMBL::Hive::Examples::FailureTest::PipeConfig::FailureTest_conf
',
$pipeline_url
);
my
$hive_dba
=
Bio::EnsEMBL::Hive::DBSQL::
DBAdaptor
->
new
(
-
url
=>
$pipeline_url
);
my
$stdout
=
capture_stdout
{
peekJob
(
$pipeline_url
,
["
-job_id
"
=>
1
]);
};
$stdout
=~
s/\s+//g
;
my
$exp_stdout
=
"
%unsubstituted_param_hash=('column_names'=>['value'],'inputlist'=>'#expr([0..#job_count#-1])expr#','job_count'=>10);
";
is
(
$stdout
,
$exp_stdout
,
'
Correct params reported
'
);
done_testing
();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment