1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
Description: Allow override of test config by environment variables
The get_config sub in t/testlib.pl has been modified so that an environment
variable named MEMCACHED_param will override the parameter param in the config
file t/CONFIG. This is useful, for example, when the port number is determined
on the fly during automated testing.
Author: Christopher Hoskin <christopher.hoskin@gmail.com>
Forwarded: https://rt.cpan.org/Public/Bug/Display.html?id=102008
Last-Update: 2015-02-08
--- a/t/testlib.pl
+++ b/t/testlib.pl
@@ -12,8 +12,11 @@
sub get_config {
my ($config, $param) = @_;
- if ($config =~ /^$param\s*?=\s*(.*?)$/m) {
- return $1;
+ if (exists $ENV{"MEMCACHED_$param"}) {
+ return $ENV{"MEMCACHED_$param"};
+ }
+ elsif ($config =~ /^$param\s*?=\s*(.*?)$/m) {
+ return $1;
}
return '';
}
|