line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Couchbase::Test::ClientSync; |
2
|
2
|
|
|
2
|
|
1500
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
74
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
62
|
|
4
|
2
|
|
|
2
|
|
12
|
use base qw(Couchbase::Test::Common); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
194
|
|
5
|
2
|
|
|
2
|
|
12
|
use Test::More; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
16
|
|
6
|
2
|
|
|
2
|
|
1894
|
use Couchbase::Client; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
70
|
|
7
|
2
|
|
|
2
|
|
20
|
use Couchbase::Client::Errors; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
272
|
|
8
|
2
|
|
|
2
|
|
16
|
use Data::Dumper; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
284
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub setup_client :Test(startup) |
11
|
|
|
|
|
|
|
{ |
12
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
13
|
0
|
|
|
|
|
0
|
$self->mock_init(); |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
0
|
my %options = ( |
16
|
0
|
|
|
|
|
0
|
%{$self->common_options}, |
17
|
|
|
|
|
|
|
compress_threshold => 100 |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
0
|
my $o = Couchbase::Client->new(\%options); |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
0
|
$self->cbo( $o ); |
23
|
0
|
|
|
|
|
0
|
$self->{basic_keys} = [qw( |
24
|
|
|
|
|
|
|
Foo Bar Baz Blargh Bleh Meh Grr Gah)]; |
25
|
2
|
|
|
2
|
|
14
|
} |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
42
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub cbo { |
28
|
0
|
0
|
|
0
|
0
|
|
if(@_ == 1) { |
|
|
0
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
return $_[0]->{object}; |
30
|
|
|
|
|
|
|
} elsif (@_ == 2) { |
31
|
0
|
|
|
|
|
|
$_[0]->{object} = $_[1]; |
32
|
0
|
|
|
|
|
|
return $_[1]; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub err_ok { |
37
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
38
|
0
|
|
|
|
|
|
my $errors = $self->cbo->get_errors; |
39
|
0
|
|
|
|
|
|
my $nerr = 0; |
40
|
0
|
|
|
|
|
|
foreach my $errinfo (@$errors) { |
41
|
0
|
|
|
|
|
|
$nerr++; |
42
|
|
|
|
|
|
|
} |
43
|
0
|
|
|
|
|
|
ok($nerr == 0, "Got no errors"); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub k2v { |
47
|
0
|
|
|
0
|
0
|
|
my ($self,$k) = @_; |
48
|
0
|
|
|
|
|
|
reverse($k); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub v2k { |
52
|
0
|
|
|
0
|
0
|
|
my ($self,$v) = @_; |
53
|
0
|
|
|
|
|
|
reverse($v); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub set_ok { |
57
|
0
|
|
|
0
|
0
|
|
my ($self,$msg,@args) = @_; |
58
|
0
|
|
|
|
|
|
my $ret = $self->cbo->set(@args); |
59
|
0
|
|
|
|
|
|
ok($ret->is_ok, $msg); |
60
|
0
|
|
|
|
|
|
$self->err_ok(); |
61
|
0
|
0
|
|
|
|
|
if(!$ret->is_ok) { |
62
|
0
|
|
|
|
|
|
diag($ret->errstr); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub get_ok { |
67
|
0
|
|
|
0
|
0
|
|
my ($self,$key,$expected) = @_; |
68
|
0
|
|
|
|
|
|
my $ret = $self->cbo->get($key); |
69
|
0
|
|
|
|
|
|
ok($ret->is_ok, "Status OK for GET($key)"); |
70
|
0
|
|
|
|
|
|
ok($ret->value eq $expected, "Got expected value for $key"); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub T00_set_values_simple :Test(no_plan) { |
74
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
75
|
0
|
|
|
|
|
0
|
$self->err_ok(); |
76
|
0
|
|
|
|
|
0
|
foreach my $k (@{$self->{basic_keys}}) { |
|
0
|
|
|
|
|
0
|
|
77
|
0
|
|
|
|
|
0
|
$self->set_ok("Key '$k'", $k, $self->k2v($k)); |
78
|
0
|
|
|
|
|
0
|
$self->get_ok($k, $self->k2v($k)) |
79
|
|
|
|
|
|
|
} |
80
|
2
|
|
|
2
|
|
1492
|
} |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
8
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub T01_get_nonexistent :Test(no_plan) { |
83
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
84
|
0
|
|
|
|
|
0
|
my $v = $self->cbo->get('NonExistent'); |
85
|
0
|
|
|
|
|
0
|
is($v->errnum, COUCHBASE_KEY_ENOENT, "Got ENOENT for nonexistent key"); |
86
|
0
|
|
|
|
|
0
|
$self->err_ok(); |
87
|
2
|
|
|
2
|
|
534
|
} |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
8
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub T02_mutators :Test(no_plan) { |
90
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
91
|
0
|
|
|
|
|
0
|
my $o = $self->cbo; |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
0
|
my $key = "mutate_key"; |
94
|
0
|
|
|
|
|
0
|
$o->remove($key); #if it already exists |
95
|
0
|
|
|
|
|
0
|
is($o->add($key, "BASE")->errnum, 0, "No error for add on new key"); |
96
|
0
|
|
|
|
|
0
|
is($o->prepend($key, "PREFIX_")->errnum, 0, "No error for prepend"); |
97
|
0
|
|
|
|
|
0
|
is($o->append($key, "_SUFFIX")->errnum, 0, "No error for append"); |
98
|
0
|
|
|
|
|
0
|
is($o->get($key)->value, "PREFIX_BASE_SUFFIX", "Got expected mutated value"); |
99
|
2
|
|
|
2
|
|
620
|
} |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
8
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub T03_arithmetic :Test(no_plan) { |
102
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
103
|
0
|
|
|
|
|
0
|
my $o = $self->cbo; |
104
|
0
|
|
|
|
|
0
|
my $key = "ArithmeticKey"; |
105
|
0
|
|
|
|
|
0
|
$o->remove($key); |
106
|
0
|
|
|
|
|
0
|
my $wv; |
107
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
0
|
$wv = $o->arithmetic($key, -12, 42); |
109
|
0
|
|
|
|
|
0
|
ok($wv->is_ok, "Set arithmetic with initial value"); |
110
|
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
0
|
$o->remove($key); |
112
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
0
|
$wv = $o->arithmetic($key, -12, undef); |
114
|
0
|
|
|
|
|
0
|
is($wv->errnum, COUCHBASE_KEY_ENOENT, "Error without initial value (undef)"); |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
0
|
$wv = $o->arithmetic($key, -12, 0, 120); |
117
|
0
|
|
|
|
|
0
|
ok($wv->is_ok, "No error with initial value=0"); |
118
|
0
|
|
|
|
|
0
|
is($wv->value, 0, "Initial value is 0"); |
119
|
|
|
|
|
|
|
|
120
|
0
|
|
|
|
|
0
|
$wv = $o->incr($key); |
121
|
0
|
|
|
|
|
0
|
is($wv->value, 1, "incr() == 1"); |
122
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
0
|
$wv = $o->decr($key); |
124
|
0
|
|
|
|
|
0
|
is($wv->value, 0, "decr() == 0"); |
125
|
2
|
|
|
2
|
|
646
|
} |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
8
|
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub T04_atomic :Test(no_plan) { |
128
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
129
|
0
|
|
|
|
|
0
|
my $o = $self->cbo; |
130
|
0
|
|
|
|
|
0
|
my $key = "AtomicKey"; |
131
|
0
|
|
|
|
|
0
|
$o->delete($key); |
132
|
|
|
|
|
|
|
|
133
|
0
|
|
|
|
|
0
|
is($o->replace($key, "blargh")->errnum, COUCHBASE_KEY_ENOENT, |
134
|
|
|
|
|
|
|
"Can't replace non-existent value"); |
135
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
0
|
my $wv = $o->set($key, "initial"); |
137
|
0
|
|
|
|
|
0
|
ok($wv->errnum == 0, "No error"); |
138
|
0
|
|
|
|
|
0
|
ok(length($wv->cas), "Have cas"); |
139
|
0
|
|
|
|
|
0
|
$o->set($key, "next"); |
140
|
0
|
|
|
|
|
0
|
my $newv = $o->cas($key, "my_next", $wv->cas); |
141
|
|
|
|
|
|
|
|
142
|
0
|
|
|
|
|
0
|
is($newv->errnum, |
143
|
|
|
|
|
|
|
COUCHBASE_KEY_EEXISTS, "Got EEXISTS for outdated CAS"); |
144
|
|
|
|
|
|
|
|
145
|
0
|
|
|
|
|
0
|
$newv = $o->get($key); |
146
|
0
|
|
|
|
|
0
|
ok($newv->cas, "Have CAS for new value"); |
147
|
0
|
|
|
|
|
0
|
$wv = $o->cas($key, "synchronized", $newv->cas); |
148
|
0
|
|
|
|
|
0
|
ok($wv->errnum == 0, "Got no error for CAS with updated CAS"); |
149
|
0
|
|
|
|
|
0
|
is($o->get($key)->value, "synchronized", "Got expected value"); |
150
|
|
|
|
|
|
|
|
151
|
0
|
|
|
|
|
0
|
$o->delete($key); |
152
|
0
|
|
|
|
|
0
|
ok($o->add($key, "value")->is_ok, "No error for ADD with nonexistent key"); |
153
|
0
|
|
|
|
|
0
|
is($o->add($key, "value")->errnum, |
154
|
|
|
|
|
|
|
COUCHBASE_KEY_EEXISTS, "Got eexists for ADD on existing key"); |
155
|
|
|
|
|
|
|
|
156
|
0
|
|
|
|
|
0
|
ok($o->delete($key, $newv->cas)->errnum, "Got error for DELETE with bad CAS"); |
157
|
0
|
|
|
|
|
0
|
$newv = $o->get($key); |
158
|
0
|
|
|
|
|
0
|
ok($o->delete($key, $newv->cas)->errnum == 0, |
159
|
|
|
|
|
|
|
"No error for delete with updated CAS"); |
160
|
2
|
|
|
2
|
|
1150
|
} |
|
2
|
|
|
|
|
18
|
|
|
2
|
|
|
|
|
12
|
|
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub T05_conversion :Test(no_plan) { |
163
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
164
|
0
|
|
|
|
|
0
|
my $o = $self->cbo; |
165
|
0
|
|
|
|
|
0
|
my $structure = [ qw(foo bar baz) ]; |
166
|
0
|
|
|
|
|
0
|
my $key = "Serialization"; |
167
|
0
|
|
|
|
|
0
|
my $rv; |
168
|
|
|
|
|
|
|
|
169
|
0
|
|
|
|
|
0
|
ok($o->set($key, $structure)->is_ok, "Serialized OK"); |
170
|
|
|
|
|
|
|
|
171
|
0
|
|
|
|
|
0
|
$rv = $o->get($key); |
172
|
0
|
|
|
|
|
0
|
ok($rv->is_ok, "Got serialized structure OK"); |
173
|
0
|
|
|
|
|
0
|
is_deeply($rv->value, $structure, "Got back our array reference"); |
174
|
0
|
|
|
|
|
0
|
eval { |
175
|
0
|
|
|
|
|
0
|
$o->append($key, $structure); |
176
|
|
|
|
|
|
|
}; |
177
|
0
|
|
|
|
|
0
|
ok($@, "Got error for append/prepending a serialized structure ($@)"); |
178
|
2
|
|
|
2
|
|
716
|
} |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
8
|
|
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
sub _multi_check_ret { |
181
|
0
|
|
|
0
|
|
|
my ($rv,$keys) = @_; |
182
|
0
|
|
|
|
|
|
my $nkeys = scalar @$keys; |
183
|
0
|
|
|
|
|
|
my $defined = scalar grep defined $_, values %$rv; |
184
|
0
|
|
|
|
|
|
my $n_ok = scalar grep $_->is_ok, values %$rv; |
185
|
|
|
|
|
|
|
|
186
|
0
|
|
|
|
|
|
is(scalar keys %$rv, $nkeys, "Expected number of keys"); |
187
|
0
|
|
|
|
|
|
is($defined, $nkeys, "All values defined"); |
188
|
0
|
|
|
|
|
|
is($n_ok,$nkeys, "All returned ok (no errors)"); |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
} |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
sub T06_multi :Test(no_plan) { |
193
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
194
|
0
|
|
|
|
|
0
|
my $o = $self->cbo; |
195
|
0
|
|
|
|
|
0
|
my @keys = @{$self->{basic_keys}}; |
|
0
|
|
|
|
|
0
|
|
196
|
|
|
|
|
|
|
|
197
|
0
|
|
|
|
|
0
|
my $rv = $o->set_multi( |
198
|
0
|
|
|
|
|
0
|
map { [$_, $_] } @keys); |
199
|
|
|
|
|
|
|
|
200
|
0
|
|
0
|
|
|
0
|
ok($rv && ref $rv eq 'HASH', "Got hash result for multi operation"); |
201
|
0
|
|
|
|
|
0
|
ok(scalar keys %$rv == scalar @keys, |
202
|
|
|
|
|
|
|
"got expected number of results"); |
203
|
|
|
|
|
|
|
|
204
|
0
|
|
|
|
|
0
|
is(grep(defined $_, values %$rv), scalar @keys, "All values defined"); |
205
|
0
|
|
|
|
|
0
|
is(scalar grep(!$rv->{$_}->is_ok, @keys), 0, "No errors"); |
206
|
|
|
|
|
|
|
|
207
|
0
|
|
|
|
|
0
|
$rv = $o->get_multi(@keys); |
208
|
0
|
|
|
|
|
0
|
_multi_check_ret($rv, \@keys); |
209
|
|
|
|
|
|
|
|
210
|
0
|
|
|
|
|
0
|
is(scalar grep($rv->{$_}->value eq $_, @keys), scalar @keys, |
211
|
|
|
|
|
|
|
"get_multi: Got expected values"); |
212
|
|
|
|
|
|
|
|
213
|
0
|
|
|
|
|
0
|
$rv = $o->cas_multi( |
214
|
0
|
|
|
|
|
0
|
map { [$_, scalar(reverse $_), $rv->{$_}->cas ] } @keys ); |
215
|
0
|
|
|
|
|
0
|
_multi_check_ret($rv, \@keys); |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
#Remove them all: |
218
|
|
|
|
|
|
|
|
219
|
0
|
|
|
|
|
0
|
note "Remove (no CAS)"; |
220
|
0
|
|
|
|
|
0
|
$rv = $o->remove_multi(@keys); |
221
|
0
|
|
|
|
|
0
|
_multi_check_ret($rv, \@keys); |
222
|
|
|
|
|
|
|
|
223
|
0
|
|
|
|
|
0
|
$rv = $o->set_multi(map { [$_, $_] } @keys); |
|
0
|
|
|
|
|
0
|
|
224
|
0
|
|
|
|
|
0
|
_multi_check_ret($rv, \@keys); |
225
|
|
|
|
|
|
|
|
226
|
0
|
|
|
|
|
0
|
note "Remove (with CAS)"; |
227
|
0
|
|
|
|
|
0
|
$rv = $o->remove_multi(map { [ $_, $rv->{$_}->cas] } @keys); |
|
0
|
|
|
|
|
0
|
|
228
|
0
|
|
|
|
|
0
|
_multi_check_ret($rv, \@keys); |
229
|
|
|
|
|
|
|
|
230
|
0
|
|
|
|
|
0
|
note "Trying arithmetic.."; |
231
|
|
|
|
|
|
|
|
232
|
0
|
|
|
|
|
0
|
$rv = $o->arithmetic_multi( |
233
|
0
|
|
|
|
|
0
|
map { [$_, 666, undef, 120] } @keys |
234
|
|
|
|
|
|
|
); |
235
|
0
|
|
|
|
|
0
|
ok(scalar( |
236
|
0
|
|
|
|
|
0
|
grep {$_->errnum == COUCHBASE_KEY_ENOENT} values %$rv |
237
|
|
|
|
|
|
|
) == scalar @keys, |
238
|
|
|
|
|
|
|
"ENOENT for non-existent deleted arithmetic keys"); |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
#try arithmetic again: |
242
|
0
|
|
|
|
|
0
|
$rv = $o->arithmetic_multi( |
243
|
0
|
|
|
|
|
0
|
map { [$_, 666, 42, 120] } @keys); |
244
|
0
|
|
|
|
|
0
|
_multi_check_ret($rv, \@keys); |
245
|
|
|
|
|
|
|
|
246
|
0
|
|
|
|
|
0
|
is(scalar grep($_->value == 42, values %$rv), scalar @keys, |
247
|
|
|
|
|
|
|
"all keys have expected value"); |
248
|
|
|
|
|
|
|
|
249
|
0
|
|
|
|
|
0
|
$rv = $o->incr_multi(@keys); |
250
|
0
|
|
|
|
|
0
|
_multi_check_ret($rv, \@keys); |
251
|
|
|
|
|
|
|
|
252
|
0
|
|
|
|
|
0
|
is(scalar grep($_->value == 43, values %$rv), scalar @keys, |
253
|
|
|
|
|
|
|
"all keys have been incremented"); |
254
|
|
|
|
|
|
|
|
255
|
0
|
|
|
|
|
0
|
$rv = $o->decr_multi( |
256
|
0
|
|
|
|
|
0
|
map {[ $_, 41 ]} @keys); |
257
|
0
|
|
|
|
|
0
|
_multi_check_ret($rv, \@keys); |
258
|
0
|
|
|
|
|
0
|
is(scalar grep($_->value == 2, values %$rv), scalar @keys, |
259
|
|
|
|
|
|
|
"all keys have been decremented"); |
260
|
2
|
|
|
2
|
|
1908
|
} |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
10
|
|
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
sub T06_multi_GH4 :Test(no_plan) { |
263
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
264
|
0
|
|
|
|
|
0
|
my $o = $self->cbo; |
265
|
0
|
|
|
|
|
0
|
my $rv = $o->set_multi(['single_key', 'single_value']); |
266
|
0
|
|
|
|
|
0
|
ok($rv->{"single_key"}->is_ok, "Single arrayref on setmulti does not fail"); |
267
|
2
|
|
|
2
|
|
572
|
} |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
8
|
|
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
sub T07_stats :Test(no_plan) { |
271
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
272
|
0
|
|
|
|
|
0
|
my $o = $self->cbo; |
273
|
0
|
|
|
|
|
0
|
my $stats = $o->stats(); |
274
|
|
|
|
|
|
|
|
275
|
0
|
|
0
|
|
|
0
|
ok($stats && ref $stats eq 'HASH', "Got a hashref"); |
276
|
0
|
|
|
|
|
0
|
ok(scalar keys %$stats, "stats not empty"); |
277
|
|
|
|
|
|
|
|
278
|
0
|
0
|
0
|
|
|
0
|
if($self->mock && $self->mock->nodes) { |
279
|
0
|
|
|
|
|
0
|
ok(scalar keys %$stats == $self->mock->nodes, "Got expected stat count"); |
280
|
|
|
|
|
|
|
} else { |
281
|
0
|
|
|
|
|
0
|
diag "Cannot determine expected stat count for real cluster"; |
282
|
|
|
|
|
|
|
} |
283
|
2
|
|
|
2
|
|
740
|
} |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
10
|
|
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
sub T08_expiry :Test(no_plan) { |
286
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
287
|
0
|
|
|
|
|
|
my $o = $self->cbo; |
288
|
0
|
|
|
|
|
|
$self->set_ok( |
289
|
|
|
|
|
|
|
"Setting with numeric expiry", |
290
|
|
|
|
|
|
|
"key", "value", 1); |
291
|
|
|
|
|
|
|
|
292
|
0
|
|
|
|
|
|
$self->set_ok( |
293
|
|
|
|
|
|
|
"Setting with stringified expiry", |
294
|
|
|
|
|
|
|
"key", "value", "1"); |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
|
297
|
0
|
|
|
|
|
|
eval { |
298
|
0
|
|
|
|
|
|
$o->set("key", "Value", "bad-expiry"); |
299
|
|
|
|
|
|
|
}; |
300
|
0
|
|
|
|
|
|
ok($@, "Got error for invalid expiry"); |
301
|
|
|
|
|
|
|
|
302
|
0
|
|
|
|
|
|
sleep(1.5); |
303
|
0
|
|
|
|
|
|
my $rv = $o->get("key"); |
304
|
0
|
|
|
|
|
|
is($rv->errnum, COUCHBASE_KEY_ENOENT, "key has expired"); |
305
|
2
|
|
|
2
|
|
688
|
} |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
10
|
|
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
1; |