Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* connect to server in new method

* test against private server only
  • Loading branch information...
commit 927143f10de3cf228852be81c1c34777ea275e40 1 parent 20bdfc8
Yecheng Fu authored
6 lib/Redis.pm
View
@@ -87,10 +87,12 @@ method new(Str $server?, Str :$encoding?, Bool :$decode_response?) {
if $decode_response.defined {
%config<decode_response> = $decode_response;
}
- return self.bless(*, |%config);
+ my $obj = self.bless(*, |%config);
+ $obj.reconnect;
+ return $obj;
}
-method connect {
+method reconnect {
if $.sock.defined {
die "Sorry, connecting via unix sock is currently unsupported!";
} else {
34 t/00-basic.t
View
@@ -1,34 +0,0 @@
-use v6;
-
-BEGIN { @*INC.push('t', 'lib') };
-use Redis;
-use Test;
-
-my @new_tasks =
- \() => {
- 'host' => '127.0.0.1',
- 'port' => 6379,
- }
- , \('192.168.0.1') => {
- 'host' => '192.168.0.1',
- 'port' => 6379,
- }
- , \('192.168.0.1:6379') => {
- 'host' => '192.168.0.1',
- 'port' => 6379,
- }
- , \('/path/to/redis.sock') => {
- 'sock' => '/path/to/redis.sock',
- }
- ;
-
-plan [+] @new_tasks.map({ $_.value.elems });
-
-for @new_tasks -> $p {
- my $r = Redis.new(|$p.key);
- $p.value.map({
- is_deeply $r."{.key}"(), .value;
- });
-}
-
-# vim: ft=perl6
5 t/01-connect.t
View
@@ -6,9 +6,6 @@ use Test;
plan 1;
-{
- my $r = Redis.new('127.0.0.1:0');
- dies_ok { $r.connect }
-}
+dies_ok { Redis.new('127.0.0.1:0') }
# vim: ft=perl6
6 t/02-connection.t
View
@@ -5,11 +5,11 @@ use Redis;
use Test;
my $r = Redis.new("127.0.0.1:63790", decode_response => True);
-$r.connect;
+$r.auth('20bdfc8e73365b2fde82d7b17c3e429a9a94c5c9');
-plan 5;
+plan 4;
-dies_ok { $r.auth("WRONG PASSWORD"); }
+#dies_ok { $r.auth("WRONG PASSWORD"); }
is_deeply $r.echo("Hello World!"), "Hello World!";
is_deeply $r.ping, True;
is_deeply $r.select(2), True;
2  t/02-hashes.t
View
@@ -5,7 +5,7 @@ use Redis;
use Test;
my $r = Redis.new("127.0.0.1:63790", decode_response => True);
-$r.connect;
+$r.auth('20bdfc8e73365b2fde82d7b17c3e429a9a94c5c9');
$r.flushall;
if $r.info<redis_version> gt "2.6" {
2  t/02-keys.t
View
@@ -5,7 +5,7 @@ use Redis;
use Test;
my $r = Redis.new("127.0.0.1:63790", decode_response => True);
-$r.connect;
+$r.auth('20bdfc8e73365b2fde82d7b17c3e429a9a94c5c9');
$r.flushall;
3  t/02-lists.t
View
@@ -3,10 +3,9 @@ use v6;
BEGIN { @*INC.push('t', 'lib') };
use Redis;
use Test;
-use Test::SpawnRedisServer;
my $r = Redis.new("127.0.0.1:63790", decode_response => True);
-$r.connect;
+$r.auth('20bdfc8e73365b2fde82d7b17c3e429a9a94c5c9');
$r.flushall;
plan 16;
3  t/02-pub&sub.t
View
@@ -3,10 +3,9 @@ use v6;
BEGIN { @*INC.push('t', 'lib') };
use Redis;
use Test;
-use Test::SpawnRedisServer;
my $r = Redis.new("127.0.0.1:63790", decode_response => True);
-$r.connect;
+$r.auth('20bdfc8e73365b2fde82d7b17c3e429a9a94c5c9');
$r.flushall;
plan 1;
3  t/02-scripting.t
View
@@ -3,10 +3,9 @@ use v6;
BEGIN { @*INC.push('t', 'lib') };
use Redis;
use Test;
-use Test::SpawnRedisServer;
my $r = Redis.new("127.0.0.1:63790", decode_response => True);
-$r.connect;
+$r.auth('20bdfc8e73365b2fde82d7b17c3e429a9a94c5c9');
$r.flushall;
if $r.info<redis_version> gt "2.6" {
3  t/02-server.t
View
@@ -3,10 +3,9 @@ use v6;
BEGIN { @*INC.push('t', 'lib') };
use Redis;
use Test;
-use Test::SpawnRedisServer;
my $r = Redis.new("127.0.0.1:63790", decode_response => True);
-$r.connect;
+$r.auth('20bdfc8e73365b2fde82d7b17c3e429a9a94c5c9');
plan 3;
3  t/02-sets.t
View
@@ -3,10 +3,9 @@ use v6;
BEGIN { @*INC.push('t', 'lib') };
use Redis;
use Test;
-use Test::SpawnRedisServer;
my $r = Redis.new("127.0.0.1:63790", decode_response => True);
-$r.connect;
+$r.auth('20bdfc8e73365b2fde82d7b17c3e429a9a94c5c9');
$r.flushall;
plan 15;
3  t/02-sortedsets.t
View
@@ -3,10 +3,9 @@ use v6;
BEGIN { @*INC.push('t', 'lib') };
use Redis;
use Test;
-use Test::SpawnRedisServer;
my $r = Redis.new("127.0.0.1:63790", decode_response => True);
-$r.connect;
+$r.auth('20bdfc8e73365b2fde82d7b17c3e429a9a94c5c9');
$r.flushall;
plan 23;
3  t/02-strings.t
View
@@ -3,10 +3,9 @@ use v6;
BEGIN { @*INC.push('t', 'lib') };
use Redis;
use Test;
-use Test::SpawnRedisServer;
my $r = Redis.new("127.0.0.1:63790", decode_response => True);
-$r.connect;
+$r.auth('20bdfc8e73365b2fde82d7b17c3e429a9a94c5c9');
$r.flushall;
if $r.info<redis_version> gt "2.6" {
3  t/02-transactions.t
View
@@ -3,10 +3,9 @@ use v6;
BEGIN { @*INC.push('t', 'lib') };
use Redis;
use Test;
-use Test::SpawnRedisServer;
my $r = Redis.new("127.0.0.1:63790", decode_response => True);
-$r.connect;
+$r.auth('20bdfc8e73365b2fde82d7b17c3e429a9a94c5c9');
$r.flushall;
plan 5;
3  t/03-binary.t
View
@@ -3,10 +3,9 @@ use v6;
BEGIN { @*INC.push('t', 'lib') };
use Redis;
use Test;
-use Test::SpawnRedisServer;
my $r = Redis.new("127.0.0.1:63790");
-$r.connect;
+$r.auth('20bdfc8e73365b2fde82d7b17c3e429a9a94c5c9');
$r.flushall;
plan 2;
3  t/03-multibytes.t
View
@@ -3,10 +3,9 @@ use v6;
BEGIN { @*INC.push('t', 'lib') };
use Redis;
use Test;
-use Test::SpawnRedisServer;
my $r = Redis.new("127.0.0.1:63790", decode_response => True);
-$r.connect;
+$r.auth('20bdfc8e73365b2fde82d7b17c3e429a9a94c5c9');
$r.flushall;
plan 1;
3  t/04-exec-any-commands.t
View
@@ -3,10 +3,9 @@ use v6;
BEGIN { @*INC.push('t', 'lib') };
use Redis;
use Test;
-use Test::SpawnRedisServer;
my $r = Redis.new("127.0.0.1:63790", decode_response => True);
-$r.connect;
+$r.auth('20bdfc8e73365b2fde82d7b17c3e429a9a94c5c9');
plan 1;
1  t/redis.conf
View
@@ -3,3 +3,4 @@ appendonly no
daemonize no
port 63790
bind 127.0.0.1
+requirepass 20bdfc8e73365b2fde82d7b17c3e429a9a94c5c9
Please sign in to comment.
Something went wrong with that request. Please try again.