Permalink
Browse files

T::SpawnRedisServer::redis() accepts requires_version => VER now

If the server version is lower than VER, all tests are skipped.

Signed-off-by: Pedro Melo <melo@simplicidade.org>
  • Loading branch information...
1 parent 76b19fb commit 11ca249f4d707310dc1c3273aadfb118dfdbf557 @melo melo committed Jan 15, 2013
Showing with 16 additions and 0 deletions.
  1. +16 −0 t/tlib/Test/SpawnRedisServer.pm
View
16 t/tlib/Test/SpawnRedisServer.pm
@@ -50,6 +50,22 @@ sub redis {
return;
}
+ if (my $rvs = $params{requires_version}) {
+ if (!defined $ver) {
+ $c->();
+ Test::More::plan skip_all => "This tests require at least redis-server $rvs, could not determine server version";
+ return;
+ }
+
+ my ($v1, $v2, $v3) = split(/[.]/, $ver);
+ my ($r1, $r2, $r3) = split(/[.]/, $rvs);
+ if ($v1 < $r1 or $v1 == $r1 and $v2 < $r2 or $v1 == $r1 and $v2 == $r2 and $v3 < $r3) {
+ $c->();
+ Test::More::plan skip_all => "This tests require at least redis-server $rvs, server found is $ver";
+ return;
+ }
+ }
+
return ($c, $addr, $ver, split(/[.]/, $ver));
}

0 comments on commit 11ca249

Please sign in to comment.