Skip to content

Commit

Permalink
split execution and content tests
Browse files Browse the repository at this point in the history
  • Loading branch information
guillomovitch committed Jul 18, 2012
1 parent 49dad45 commit 3304497
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions t/apps/agent.t
Expand Up @@ -50,7 +50,8 @@ my $base_options = "--debug --no-task ocsdeploy,wakeonlan,snmpquery,netdiscovery
);

subtest "first inventory" => sub {
check_execution_ok($out, $err, $rc);
check_execution_ok($err, $rc);
check_content_ok($out);
};

ok(
Expand All @@ -68,8 +69,9 @@ ok(
"$base_options --local - --no-category printer,software"
);

subtest "first inventory" => sub {
check_execution_ok($out, $err, $rc);
subtest "second inventory" => sub {
check_execution_ok($err, $rc);
check_content_ok($out);
};

ok(
Expand Down Expand Up @@ -101,8 +103,9 @@ close($file);
($out, $err, $rc) = run_agent(
"$base_options --local - --no-category printer,software --additional-content $file"
);
subtest "first inventory" => sub {
check_execution_ok($out, $err, $rc);
subtest "third inventory" => sub {
check_execution_ok($err, $rc);
check_content_ok($out);
};

ok(
Expand Down Expand Up @@ -135,8 +138,9 @@ my $value = $ENV{$name};
"$base_options --local - --no-category printer,software"
);

subtest "first inventory" => sub {
check_execution_ok($out, $err, $rc);
subtest "fourth inventory" => sub {
check_execution_ok($err, $rc);
check_content_ok($out);
};

ok(
Expand All @@ -161,8 +165,9 @@ ok(
"$base_options --local - --no-category printer,software,environment"
);

subtest "first inventory" => sub {
check_execution_ok($out, $err, $rc);
subtest "fifth inventory" => sub {
check_execution_ok($err, $rc);
check_content_ok($out);
};

ok(
Expand Down Expand Up @@ -196,7 +201,7 @@ sub run_agent {
}

sub check_execution_ok {
my ($client, $url) = @_;
my ($err, $rc) = @_;

ok($rc == 0, 'exit status');

Expand All @@ -211,6 +216,10 @@ sub check_execution_ok {
qr/unexpected error in \S+/,
'no broken module (execution)'
);
}

sub check_content_ok {
my ($out) = @_;

like(
$out,
Expand Down

0 comments on commit 3304497

Please sign in to comment.