Skip to content

Commit

Permalink
cassandane: general-purpose runtime skip hook
Browse files Browse the repository at this point in the history
  • Loading branch information
elliefm committed Jul 24, 2024
1 parent de6830c commit 08fb999
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cassandane/Cassandane/Unit/TestCase.pm
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,22 @@ sub filter
return 1 if $method !~ m/_slow$/;
return;
},
skip_runtime_check => sub
{
# To use: add a skip_check method to your test suite that
# implements logic to determine whether some test should run or
# not (perhaps by examining $self->{_name}). Return undef if
# the test should run, or a message explaining why the test is
# being skipped
return if not $self->can('skip_check');
my $reason = $self->skip_check();
if ($reason) {
xlog "$self->{_name} will be skipped:",
"skip_check said '$reason'";
return 1;
}
return;
},
};
}

Expand Down
4 changes: 4 additions & 0 deletions cassandane/testrunner.pl
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
local *__ANON__ = "runner_tap";
my $runner = Cassandane::Unit::Runner->new($fh);
my @filters = qw(x skip_version skip_missing_features
skip_runtime_check
enable_wanted_properties);
push @filters, 'skip_slow' if $plan->{skip_slow};
push @filters, 'slow_only' if $plan->{slow_only};
Expand All @@ -157,6 +158,7 @@
local *__ANON__ = "runner_pretty";
my $runner = Cassandane::Unit::RunnerPretty->new({}, $fh);
my @filters = qw(x skip_version skip_missing_features
skip_runtime_check
enable_wanted_properties);
push @filters, 'skip_slow' if $plan->{skip_slow};
push @filters, 'slow_only' if $plan->{slow_only};
Expand All @@ -169,6 +171,7 @@
local *__ANON__ = "runner_prettier";
my $runner = Cassandane::Unit::RunnerPretty->new({quiet=>1}, $fh);
my @filters = qw(x skip_version skip_missing_features
skip_runtime_check
enable_wanted_properties);
push @filters, 'skip_slow' if $plan->{skip_slow};
push @filters, 'slow_only' if $plan->{slow_only};
Expand Down Expand Up @@ -201,6 +204,7 @@

my $runner = Cassandane::Unit::RunnerXML->new($output_dir);
my @filters = qw(x skip_version skip_missing_features
skip_runtime_check
enable_wanted_properties);
push @filters, 'skip_slow' if $plan->{skip_slow};
push @filters, 'slow_only' if $plan->{slow_only};
Expand Down

0 comments on commit 08fb999

Please sign in to comment.