-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,3 +102,4 @@ | |
./t/nested_prefix.t | ||
./t/keyscan.t | ||
./t/prefixscan.t | ||
./t/touch.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,3 +95,4 @@ | |
./t/nested_prefix.t | ||
./t/keyscan.t | ||
./t/prefixscan.t | ||
./t/touch.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#!/usr/bin/perl | ||
|
||
use strict; | ||
use Test::More tests => 22; # test case 개수 즉 mem_cmd_is 개수 | ||
use FindBin qw($Bin); | ||
use lib "$Bin/lib"; | ||
use MemcachedTest; | ||
|
||
my $engine = shift; | ||
my $server = get_memcached($engine); | ||
my $sock = $server->sock; | ||
|
||
my $cmd; | ||
my $val; | ||
my $rst; | ||
my $expire; | ||
|
||
# Initialize | ||
$cmd = "set key 0 0 3"; $val = "key"; $rst = "STORED"; | ||
mem_cmd_is($sock, $cmd, $val, $rst); | ||
$cmd = "lop create list 0 0 1 error"; $rst = "CREATED"; | ||
mem_cmd_is($sock, $cmd, "", $rst); | ||
$cmd = "sop create set 0 0 1 error"; $rst = "CREATED"; | ||
mem_cmd_is($sock, $cmd, "", $rst); | ||
$cmd = "mop create map 0 0 1 error"; $rst = "CREATED"; | ||
mem_cmd_is($sock, $cmd, "", $rst); | ||
$cmd = "bop create btree 0 0 1 error"; $rst = "CREATED"; | ||
mem_cmd_is($sock, $cmd, "", $rst); | ||
|
||
# Success Cases | ||
$cmd = "touch key 1"; $rst = "TOUCHED"; | ||
mem_cmd_is($sock, $cmd, "", $rst); | ||
$cmd = "getattr key expiretime"; | ||
$rst = "ATTR expiretime=1 | ||
END"; | ||
# list type | ||
mem_cmd_is($sock, $cmd, "", $rst); | ||
$cmd = "touch list 1"; $rst = "TOUCHED"; | ||
mem_cmd_is($sock, $cmd, "", $rst); | ||
$cmd = "getattr list expiretime"; | ||
$rst = "ATTR expiretime=1 | ||
END"; | ||
# set | ||
mem_cmd_is($sock, $cmd, "", $rst); | ||
$cmd = "touch set 1"; $rst = "TOUCHED"; | ||
mem_cmd_is($sock, $cmd, "", $rst); | ||
$cmd = "getattr set expiretime"; | ||
$rst = "ATTR expiretime=1 | ||
END"; | ||
# map | ||
mem_cmd_is($sock, $cmd, "", $rst); | ||
$cmd = "touch map 1"; $rst = "TOUCHED"; | ||
mem_cmd_is($sock, $cmd, "", $rst); | ||
$cmd = "getattr map expiretime"; | ||
$rst = "ATTR expiretime=1 | ||
END"; | ||
# btree | ||
mem_cmd_is($sock, $cmd, "", $rst); | ||
$cmd = "touch btree 1"; $rst = "TOUCHED"; | ||
mem_cmd_is($sock, $cmd, "", $rst); | ||
$cmd = "getattr btree expiretime"; | ||
$rst = "ATTR expiretime=1 | ||
END"; | ||
mem_cmd_is($sock, $cmd, "", $rst); | ||
# set with unix time and expired | ||
$cmd = "set unix_time 0 0 4"; $val = "unix"; $rst = "STORED"; | ||
mem_cmd_is($sock, $cmd, $val, $rst); | ||
$expire = time() - 1; | ||
$cmd = "touch unix_time $expire"; $rst = "TOUCHED"; | ||
mem_cmd_is($sock, $cmd, "", $rst); | ||
$cmd = "get unix_time"; $rst = "END"; | ||
mem_cmd_is($sock, $cmd, "", $rst); | ||
|
||
# Fail Cases | ||
# not exist key | ||
$cmd = "touch not_exist 1"; $rst = "NOT_FOUND"; | ||
mem_cmd_is($sock, $cmd, "", $rst); | ||
# bad value | ||
$cmd = "set bad_value 0 0 3"; $val = "bad"; $rst = "STORED"; | ||
mem_cmd_is($sock, $cmd, $val, $rst); | ||
$cmd = "touch bad_value str"; $rst = "CLIENT_ERROR bad value"; | ||
mem_cmd_is($sock, $cmd, "", $rst); | ||
|
||
# Finalize | ||
$cmd = "delete bad_value"; $rst = "DELETED"; | ||
mem_cmd_is($sock, $cmd, "", $rst); | ||
|
||
# after test | ||
release_memcached($engine, $server); |