do_task should return the task's return value
Open
Nobody has claimed this yet.
info needed
- Dominant language
- Perl
- Stars
- 737
- Forks
- 214
- PR merge metrics
- No merged PRs in 30d
Description
I would expect do_task() to return the task's return value, just like run_task() does.
$ rex -v
(R)?ex 1.2.1
$ uname -a
Darwin user.local 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
Consider the following test:
# file: return_values.t
use Rex -base;
use Test::More tests => 3;
my $got_return_value;
my $expected_return_value = { foo => "bar" };
task "foo" => sub {
return { foo => "bar" };
};
$got_return_value = run_task "foo";
is_deeply( $got_return_value, $expected_return_value, "Calling task with run_task() returns the task's return value" );
$got_return_value = do_task "foo";
is_deeply( $got_return_value, $expected_return_value, "Calling task with do_task() returns the task's return value" );
$got_return_value = foo();
is_deeply( $got_return_value, $expected_return_value, "Calling task by function returns the task's return value" );
$ perl return_values.t
1..3
ok 1 - Calling task with run_task() returns the task's return value
[2015-05-26 11:56:20] INFO - Running task foo on <local>
not ok 2 - Calling task with do_task() returns the task's return value
# Failed test 'Calling task with do_task() returns the task's return value'
# at return_values.t line 15.
# Structures begin differing at:
# $got = undef
# $expected = HASH(0x7fc088804638)
[2015-05-26 11:56:20] INFO - Running task foo on current connection
ok 3 - Calling task by function returns the task's return value
# Looks like you failed 1 test of 3.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the return_values.t example and compare the documented behavior of run_task(), do_task(), and calling the task as a function. Run the three assertions shown in the issue; done means all three return the expected { foo => "bar" } value without changing the other task behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- perl
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100