riak-client 2.5.0 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/RELNOTES.md +3 -0
- data/lib/riak/bucket.rb +1 -1
- data/lib/riak/client.rb +14 -7
- data/lib/riak/client/beefcake/messages.rb +13 -0
- data/lib/riak/multi.rb +101 -0
- data/lib/riak/multiexist.rb +14 -0
- data/lib/riak/multiget.rb +7 -107
- data/lib/riak/version.rb +1 -1
- metadata +12 -234
- data/.document +0 -5
- data/.gitignore +0 -44
- data/.rspec +0 -2
- data/Gemfile +0 -17
- data/Guardfile +0 -20
- data/Rakefile +0 -124
- data/riak-client.gemspec +0 -71
- data/spec/failover/failover.rb +0 -59
- data/spec/fixtures/bitcask.txt +0 -25
- data/spec/fixtures/cat.jpg +0 -0
- data/spec/fixtures/multipart-basic-conflict.txt +0 -15
- data/spec/fixtures/multipart-blank.txt +0 -7
- data/spec/fixtures/multipart-mapreduce.txt +0 -10
- data/spec/fixtures/multipart-with-body.txt +0 -16
- data/spec/fixtures/multipart-with-marked-tombstones.txt +0 -17
- data/spec/fixtures/multipart-with-unmarked-tombstone.txt +0 -16
- data/spec/fixtures/server.cert.crt +0 -15
- data/spec/fixtures/server.cert.key +0 -15
- data/spec/fixtures/test.pem +0 -1
- data/spec/fixtures/yz_schema_template.xml +0 -18
- data/spec/integration/riak/bucket_types_spec.rb +0 -308
- data/spec/integration/riak/conflict_resolution_spec.rb +0 -96
- data/spec/integration/riak/counters_spec.rb +0 -36
- data/spec/integration/riak/crdt/configuration_spec.rb +0 -38
- data/spec/integration/riak/crdt_search_spec.rb +0 -176
- data/spec/integration/riak/crdt_spec.rb +0 -332
- data/spec/integration/riak/crdt_validation/map_spec.rb +0 -63
- data/spec/integration/riak/crdt_validation/set_spec.rb +0 -122
- data/spec/integration/riak/encodings/crdt_spec.rb +0 -122
- data/spec/integration/riak/encodings/kv_spec.rb +0 -87
- data/spec/integration/riak/encodings/yz_spec.rb +0 -142
- data/spec/integration/riak/preflist_spec.rb +0 -43
- data/spec/integration/riak/properties_spec.rb +0 -69
- data/spec/integration/riak/protobuffs/interrupted_request_spec.rb +0 -33
- data/spec/integration/riak/protobuffs/timeouts_spec.rb +0 -178
- data/spec/integration/riak/protobuffs_backends_spec.rb +0 -40
- data/spec/integration/riak/search_spec.rb +0 -104
- data/spec/integration/riak/secondary_index_spec.rb +0 -72
- data/spec/integration/riak/security_spec.rb +0 -105
- data/spec/integration/riak/threading_spec.rb +0 -154
- data/spec/integration/riak/time_series_spec.rb +0 -212
- data/spec/integration/yokozuna/index_spec.rb +0 -61
- data/spec/integration/yokozuna/queries_spec.rb +0 -115
- data/spec/integration/yokozuna/schema_spec.rb +0 -49
- data/spec/riak/beefcake_protobuffs_backend/bucket_properties_operator_spec.rb +0 -247
- data/spec/riak/beefcake_protobuffs_backend/crdt_operator_spec.rb +0 -244
- data/spec/riak/beefcake_protobuffs_backend/object_methods_spec.rb +0 -53
- data/spec/riak/beefcake_protobuffs_backend/protocol_spec.rb +0 -189
- data/spec/riak/beefcake_protobuffs_backend/ts_cell_codec_spec.rb +0 -124
- data/spec/riak/beefcake_protobuffs_backend_spec.rb +0 -162
- data/spec/riak/bucket_properties_spec.rb +0 -135
- data/spec/riak/bucket_spec.rb +0 -275
- data/spec/riak/bucket_type_spec.rb +0 -50
- data/spec/riak/bucket_typed/bucket_spec.rb +0 -78
- data/spec/riak/client_spec.rb +0 -304
- data/spec/riak/core_ext/to_param_spec.rb +0 -15
- data/spec/riak/counter_spec.rb +0 -122
- data/spec/riak/crdt/counter_spec.rb +0 -55
- data/spec/riak/crdt/hyper_log_log_spec.rb +0 -56
- data/spec/riak/crdt/inner_counter_spec.rb +0 -21
- data/spec/riak/crdt/inner_flag_spec.rb +0 -39
- data/spec/riak/crdt/inner_map_spec.rb +0 -47
- data/spec/riak/crdt/inner_register_spec.rb +0 -40
- data/spec/riak/crdt/inner_set_spec.rb +0 -33
- data/spec/riak/crdt/map_spec.rb +0 -78
- data/spec/riak/crdt/set_spec.rb +0 -61
- data/spec/riak/crdt/shared_examples.rb +0 -88
- data/spec/riak/crdt/typed_collection_spec.rb +0 -225
- data/spec/riak/escape_spec.rb +0 -72
- data/spec/riak/feature_detection_spec.rb +0 -77
- data/spec/riak/index_collection_spec.rb +0 -53
- data/spec/riak/instrumentation_spec.rb +0 -124
- data/spec/riak/link_spec.rb +0 -85
- data/spec/riak/list_buckets_spec.rb +0 -41
- data/spec/riak/map_reduce/filter_builder_spec.rb +0 -32
- data/spec/riak/map_reduce/phase_spec.rb +0 -142
- data/spec/riak/map_reduce_spec.rb +0 -434
- data/spec/riak/multiget_spec.rb +0 -81
- data/spec/riak/node_spec.rb +0 -26
- data/spec/riak/robject_spec.rb +0 -542
- data/spec/riak/search/index_spec.rb +0 -72
- data/spec/riak/search/query_spec.rb +0 -88
- data/spec/riak/search/result_collection_spec.rb +0 -89
- data/spec/riak/search/result_document_spec.rb +0 -106
- data/spec/riak/search/schema_spec.rb +0 -63
- data/spec/riak/search_spec.rb +0 -107
- data/spec/riak/secondary_index_spec.rb +0 -225
- data/spec/riak/serializers_spec.rb +0 -121
- data/spec/riak/stamp_spec.rb +0 -54
- data/spec/riak/time_series/deletion_spec.rb +0 -33
- data/spec/riak/time_series/listing_spec.rb +0 -51
- data/spec/riak/time_series/submission_spec.rb +0 -35
- data/spec/riak/util/gzip_spec.rb +0 -49
- data/spec/riak/walk_spec_spec.rb +0 -203
- data/spec/spec_helper.rb +0 -67
- data/spec/support/certs/README.md +0 -13
- data/spec/support/certs/ca.crt +0 -21
- data/spec/support/certs/client.crl +0 -13
- data/spec/support/certs/client.crt +0 -94
- data/spec/support/certs/client.csr +0 -18
- data/spec/support/certs/client.key +0 -27
- data/spec/support/certs/empty_ca.crt +0 -21
- data/spec/support/certs/server.crl +0 -13
- data/spec/support/certs/server.crt +0 -94
- data/spec/support/certs/server.key +0 -27
- data/spec/support/crdt_search_config.rb +0 -112
- data/spec/support/crdt_search_fixtures.rb +0 -42
- data/spec/support/integration_setup.rb +0 -10
- data/spec/support/search_config.rb +0 -83
- data/spec/support/search_corpus_setup.rb +0 -39
- data/spec/support/test_client.rb +0 -52
- data/spec/support/test_client.yml.example +0 -10
- data/spec/support/unified_backend_examples.rb +0 -402
- data/spec/support/version_filter.rb +0 -12
- data/spec/support/wait_until.rb +0 -20
data/spec/riak/crdt/set_spec.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require_relative 'shared_examples'
|
3
|
-
|
4
|
-
describe Riak::Crdt::Set do
|
5
|
-
let(:bucket) do
|
6
|
-
double('bucket').tap do |b|
|
7
|
-
allow(b).to receive(:name).and_return('bucket')
|
8
|
-
allow(b).to receive(:is_a?).with(Riak::Bucket).and_return(true)
|
9
|
-
allow(b).to receive(:is_a?).with(Riak::BucketTyped::Bucket).and_return(false)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'initializes with bucket, key, and optional bucket-type' do
|
14
|
-
expect{described_class.new bucket, 'key', 'optional bucket type'}.
|
15
|
-
to_not raise_error
|
16
|
-
end
|
17
|
-
|
18
|
-
subject{ described_class.new bucket, 'key' }
|
19
|
-
|
20
|
-
describe 'with a client' do
|
21
|
-
let(:response){ double 'response', key: nil }
|
22
|
-
let(:operator){ double 'operator' }
|
23
|
-
let(:loader){ double 'loader', get_loader_for_value: nil }
|
24
|
-
let(:backend){ double 'backend' }
|
25
|
-
let(:client){ double 'client' }
|
26
|
-
|
27
|
-
before(:each) do
|
28
|
-
allow(bucket).to receive(:client).and_return(client)
|
29
|
-
allow(client).to receive(:backend).and_yield(backend)
|
30
|
-
allow(backend).to receive(:crdt_operator).and_return(operator)
|
31
|
-
allow(backend).to receive(:crdt_loader).and_return(loader)
|
32
|
-
end
|
33
|
-
|
34
|
-
include_examples 'Set CRDT'
|
35
|
-
|
36
|
-
it 'batches properly' do
|
37
|
-
expect(operator).
|
38
|
-
to receive(:operate) { |bucket, key, type, operations|
|
39
|
-
|
40
|
-
expect(bucket).to eq bucket
|
41
|
-
expect(key).to eq 'key'
|
42
|
-
expect(type).to eq subject.bucket_type
|
43
|
-
|
44
|
-
expect(operations).to be_a Riak::Crdt::Operation::Update
|
45
|
-
expect(operations.value).to eq({
|
46
|
-
add: %w{alpha bravo},
|
47
|
-
remove: %w{foxtrot}
|
48
|
-
})
|
49
|
-
}.
|
50
|
-
and_return(response)
|
51
|
-
|
52
|
-
subject.instance_variable_set :@context, 'placeholder'
|
53
|
-
|
54
|
-
subject.batch do |s|
|
55
|
-
s.add 'alpha'
|
56
|
-
s.add 'bravo'
|
57
|
-
s.remove 'foxtrot'
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
@@ -1,88 +0,0 @@
|
|
1
|
-
shared_examples_for "Map CRDT" do
|
2
|
-
let(:typed_collection){ Riak::Crdt::TypedCollection }
|
3
|
-
|
4
|
-
it 'contains counters' do
|
5
|
-
expect(subject).to respond_to(:counters)
|
6
|
-
expect(subject.counters).to be_an_instance_of typed_collection
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'contains flags' do
|
10
|
-
expect(subject).to respond_to(:flags)
|
11
|
-
expect(subject.counters).to be_an_instance_of typed_collection
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'contains maps' do
|
15
|
-
expect(subject).to respond_to(:maps)
|
16
|
-
expect(subject.counters).to be_an_instance_of typed_collection
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'contains registers' do
|
20
|
-
expect(subject).to respond_to(:registers)
|
21
|
-
expect(subject.counters).to be_an_instance_of typed_collection
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'contains sets' do
|
25
|
-
expect(subject).to respond_to(:sets)
|
26
|
-
expect(subject.counters).to be_an_instance_of typed_collection
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'accepts operations' do
|
30
|
-
expect(subject).to respond_to(:operate)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
shared_examples_for "Counter CRDT" do
|
35
|
-
it 'has a value' do
|
36
|
-
expect(subject).to respond_to :value
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'has an increment method' do
|
40
|
-
expect(subject).to respond_to :increment
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'has a decrement method' do
|
44
|
-
expect(subject).to respond_to :decrement
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'has a batch method' do
|
48
|
-
expect(subject).to respond_to :batch
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
shared_examples_for 'Set CRDT' do
|
53
|
-
it 'has a value' do
|
54
|
-
expect(subject).to respond_to :value
|
55
|
-
expect(subject).to respond_to :members
|
56
|
-
expect(subject).to respond_to :to_a
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'has an include? method' do
|
60
|
-
expect(subject).to respond_to :include?
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'has an empty? method' do
|
64
|
-
expect(subject).to respond_to :empty?
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'has an add method' do
|
68
|
-
expect(subject).to respond_to :add
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'has a remove method' do
|
72
|
-
expect(subject).to respond_to :remove
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
shared_examples_for 'HyperLogLog CRDT' do
|
77
|
-
it 'has a value' do
|
78
|
-
expect(subject).to respond_to :value
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'has a cardinality' do
|
82
|
-
expect(subject).to respond_to :cardinality
|
83
|
-
end
|
84
|
-
|
85
|
-
it 'has an add method' do
|
86
|
-
expect(subject).to respond_to :add
|
87
|
-
end
|
88
|
-
end
|
@@ -1,225 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Riak::Crdt::TypedCollection do
|
4
|
-
let(:parent){ double 'parent' }
|
5
|
-
let(:operation){ double 'operation' }
|
6
|
-
|
7
|
-
describe 'initialization' do
|
8
|
-
it "accepts a type, parent, and hash of values" do
|
9
|
-
expect{ described_class.new Riak::Crdt::Counter, parent, {} }.to_not raise_error
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
describe 'containing' do
|
14
|
-
describe 'registers' do
|
15
|
-
let(:register_class){ Riak::Crdt::InnerRegister }
|
16
|
-
subject do
|
17
|
-
described_class.new register_class, parent, existing: 'existing'
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'exposes them as frozen strings that are really Registers' do
|
21
|
-
expect(subject[:existing]).to eq 'existing'
|
22
|
-
expect(subject['existing']).to eq 'existing'
|
23
|
-
expect(subject[:existing]).to be_an_instance_of register_class
|
24
|
-
expect(subject['existing'].frozen?).to be
|
25
|
-
expect{subject['existing'].gsub!('e', 'a')}.to raise_error
|
26
|
-
end
|
27
|
-
|
28
|
-
describe 'creating and updating' do
|
29
|
-
|
30
|
-
let(:new_value){ 'the new value' }
|
31
|
-
|
32
|
-
it 'asks the register class for an operation' do
|
33
|
-
expect(register_class).to receive(:update).
|
34
|
-
with(new_value).
|
35
|
-
and_return(operation)
|
36
|
-
|
37
|
-
expect(operation).
|
38
|
-
to receive(:name=).
|
39
|
-
with('existing')
|
40
|
-
|
41
|
-
expect(parent).
|
42
|
-
to receive(:operate).
|
43
|
-
with(operation)
|
44
|
-
|
45
|
-
subject['existing'] = new_value
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
describe 'removing' do
|
50
|
-
|
51
|
-
it 'asks the register class for a remove operation' do
|
52
|
-
expect(register_class).
|
53
|
-
to receive(:delete).
|
54
|
-
and_return(operation)
|
55
|
-
|
56
|
-
expect(operation).
|
57
|
-
to receive(:name=).
|
58
|
-
with('existing')
|
59
|
-
|
60
|
-
expect(parent).
|
61
|
-
to receive(:operate).
|
62
|
-
with(operation)
|
63
|
-
|
64
|
-
subject.delete 'existing'
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
describe 'flags' do
|
69
|
-
let(:flag_class){ Riak::Crdt::InnerFlag }
|
70
|
-
subject do
|
71
|
-
described_class.new flag_class, parent, truthy: true, falsey: false
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'exposes them as booleans' do
|
75
|
-
expect(subject[:truthy]).to eq true
|
76
|
-
expect(subject['falsey']).to eq false
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'updates them' do
|
80
|
-
expect(flag_class).
|
81
|
-
to receive(:update).
|
82
|
-
with(true).
|
83
|
-
and_return(operation)
|
84
|
-
|
85
|
-
expect(operation).
|
86
|
-
to receive(:name=).
|
87
|
-
with('become_truthy')
|
88
|
-
|
89
|
-
expect(parent).
|
90
|
-
to receive(:operate).
|
91
|
-
with(operation)
|
92
|
-
|
93
|
-
subject['become_truthy'] = true
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'deletes them' do
|
97
|
-
expect(flag_class).
|
98
|
-
to receive(:delete).
|
99
|
-
and_return(operation)
|
100
|
-
|
101
|
-
expect(operation).
|
102
|
-
to receive(:name=).
|
103
|
-
with('become_deleted')
|
104
|
-
|
105
|
-
expect(parent).
|
106
|
-
to receive(:operate).
|
107
|
-
with(operation)
|
108
|
-
|
109
|
-
subject.delete 'become_deleted'
|
110
|
-
end
|
111
|
-
end
|
112
|
-
describe 'counters' do
|
113
|
-
let(:counter_class){ Riak::Crdt::InnerCounter }
|
114
|
-
|
115
|
-
subject{ described_class.new counter_class, parent, zero: 0, one: 1 }
|
116
|
-
|
117
|
-
it 'exposes existing ones as Counter instances' do
|
118
|
-
expect(subject['zero']).to be_an_instance_of counter_class
|
119
|
-
expect(subject['zero'].to_i).to eq 0
|
120
|
-
|
121
|
-
expect(subject['one'].to_i).to eq 1
|
122
|
-
end
|
123
|
-
|
124
|
-
it 'exposes new ones as Counter instances' do
|
125
|
-
expect(subject['new_zero']).to be_an_instance_of counter_class
|
126
|
-
expect(subject['new_zero'].to_i).to eq 0
|
127
|
-
end
|
128
|
-
|
129
|
-
it 'allows incrementing and decrementing' do
|
130
|
-
counter_name = 'counter'
|
131
|
-
|
132
|
-
expect(parent).to receive(:operate) do |op|
|
133
|
-
expect(op.name).to eq counter_name
|
134
|
-
expect(op.type).to eq :counter
|
135
|
-
expect(op.value).to eq 1
|
136
|
-
end
|
137
|
-
subject[counter_name].increment
|
138
|
-
|
139
|
-
expect(parent).to receive(:operate) do |op|
|
140
|
-
expect(op.name).to eq counter_name
|
141
|
-
expect(op.type).to eq :counter
|
142
|
-
expect(op.value).to eq -5
|
143
|
-
end
|
144
|
-
|
145
|
-
subject[counter_name].decrement 5
|
146
|
-
end
|
147
|
-
end
|
148
|
-
describe 'sets' do
|
149
|
-
let(:set_class){ Riak::Crdt::InnerSet }
|
150
|
-
|
151
|
-
subject{ described_class.new set_class, parent, brewers: %w{aeropress clever v60}}
|
152
|
-
|
153
|
-
it 'exposes existing ones as Set instances' do
|
154
|
-
expect(subject['brewers']).to be_an_instance_of set_class
|
155
|
-
expect(subject['brewers']).to include 'aeropress'
|
156
|
-
end
|
157
|
-
|
158
|
-
it 'exposes new ones as empty Set instances' do
|
159
|
-
expect(subject['filters']).to be_an_instance_of set_class
|
160
|
-
expect(subject['filters']).to be_empty
|
161
|
-
end
|
162
|
-
|
163
|
-
it 'allows adding and removing' do
|
164
|
-
set_name = 'brewers'
|
165
|
-
|
166
|
-
expect(parent).to receive(:operate) do |op|
|
167
|
-
expect(op.name).to eq set_name
|
168
|
-
expect(op.type).to eq :set
|
169
|
-
expect(op.value).to eq add: 'frenchpress'
|
170
|
-
end
|
171
|
-
subject[set_name].add 'frenchpress'
|
172
|
-
|
173
|
-
expect(parent).to receive(:operate) do |op|
|
174
|
-
expect(op.name).to eq set_name
|
175
|
-
expect(op.type).to eq :set
|
176
|
-
expect(op.value).to eq remove: 'aeropress'
|
177
|
-
end
|
178
|
-
allow(parent).to receive(:context?).and_return(true)
|
179
|
-
|
180
|
-
subject[set_name].remove 'aeropress'
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
describe 'maps' do
|
185
|
-
let(:map_class){ Riak::Crdt::InnerMap }
|
186
|
-
|
187
|
-
let(:contents) do {a: {
|
188
|
-
counters: {},
|
189
|
-
flags: {},
|
190
|
-
maps: {},
|
191
|
-
registers: {'hello' => 'world'},
|
192
|
-
sets: {}
|
193
|
-
}}
|
194
|
-
end
|
195
|
-
|
196
|
-
let(:inner_map_name){ 'inner map' }
|
197
|
-
|
198
|
-
subject do
|
199
|
-
described_class.new map_class, parent, contents
|
200
|
-
end
|
201
|
-
|
202
|
-
it 'exposes existing ones as populated Map instances' do
|
203
|
-
expect(subject['a']).to be_an_instance_of map_class
|
204
|
-
expect(subject['a'].registers['hello']).to eq 'world'
|
205
|
-
end
|
206
|
-
|
207
|
-
it 'exposes new ones as empty Map instances' do
|
208
|
-
expect(subject['b']).to be_an_instance_of map_class
|
209
|
-
expect(subject['b'].registers['hello']).to be_nil
|
210
|
-
end
|
211
|
-
|
212
|
-
it 'cascades operations to a parent map' do
|
213
|
-
expect(operation).
|
214
|
-
to receive(:name=).
|
215
|
-
with(inner_map_name)
|
216
|
-
|
217
|
-
expect(parent).
|
218
|
-
to receive(:operate).
|
219
|
-
with(operation)
|
220
|
-
|
221
|
-
subject.operate inner_map_name, operation
|
222
|
-
end
|
223
|
-
end
|
224
|
-
end
|
225
|
-
end
|
data/spec/riak/escape_spec.rb
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe Riak::Util::Escape do
|
5
|
-
before :each do
|
6
|
-
@object = Object.new
|
7
|
-
@object.extend(Riak::Util::Escape)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "uses URI by default for escaping" do
|
11
|
-
expect(Riak.escaper).to eq(URI)
|
12
|
-
end
|
13
|
-
|
14
|
-
context "when using CGI for escaping" do
|
15
|
-
before { @oldesc, Riak.escaper = Riak.escaper, CGI }
|
16
|
-
after { Riak.escaper = @oldesc }
|
17
|
-
|
18
|
-
it "escapes standard non-safe characters" do
|
19
|
-
expect(@object.escape("some string")).to eq("some%20string")
|
20
|
-
expect(@object.escape("another^one")).to eq("another%5Eone")
|
21
|
-
expect(@object.escape("bracket[one")).to eq("bracket%5Bone")
|
22
|
-
end
|
23
|
-
|
24
|
-
it "escapes slashes" do
|
25
|
-
expect(@object.escape("some/inner/path")).to eq("some%2Finner%2Fpath")
|
26
|
-
end
|
27
|
-
|
28
|
-
it "converts the bucket or key to a string before escaping" do
|
29
|
-
expect(@object.escape(125)).to eq('125')
|
30
|
-
end
|
31
|
-
|
32
|
-
it "unescapes escaped strings" do
|
33
|
-
expect(@object.unescape("some%20string")).to eq("some string")
|
34
|
-
expect(@object.unescape("another%5Eone")).to eq("another^one")
|
35
|
-
expect(@object.unescape("bracket%5Bone")).to eq("bracket[one")
|
36
|
-
expect(@object.unescape("some%2Finner%2Fpath")).to eq("some/inner/path")
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
context "when using URI for escaping" do
|
41
|
-
before { @oldesc, Riak.escaper = Riak.escaper, URI }
|
42
|
-
after { Riak.escaper = @oldesc }
|
43
|
-
|
44
|
-
it "escapes standard non-safe characters" do
|
45
|
-
expect(@object.escape("some string")).to eq("some%20string")
|
46
|
-
expect(@object.escape("another^one")).to eq("another%5Eone")
|
47
|
-
expect(@object.escape("--one+two--")).to eq("--one%2Btwo--")
|
48
|
-
end
|
49
|
-
|
50
|
-
it "allows URI-safe characters" do
|
51
|
-
expect(@object.escape("bracket[one")).to eq("bracket[one")
|
52
|
-
expect(@object.escape("sean@basho")).to eq("sean@basho")
|
53
|
-
end
|
54
|
-
|
55
|
-
it "escapes slashes" do
|
56
|
-
expect(@object.escape("some/inner/path")).to eq("some%2Finner%2Fpath")
|
57
|
-
end
|
58
|
-
|
59
|
-
it "converts the bucket or key to a string before escaping" do
|
60
|
-
expect(@object.escape(125)).to eq('125')
|
61
|
-
end
|
62
|
-
|
63
|
-
it "unescapes escaped strings" do
|
64
|
-
expect(@object.unescape("some%20string")).to eq("some string")
|
65
|
-
expect(@object.unescape("another%5Eone")).to eq("another^one")
|
66
|
-
expect(@object.unescape("bracket%5Bone")).to eq("bracket[one")
|
67
|
-
expect(@object.unescape("some%2Finner%2Fpath")).to eq("some/inner/path")
|
68
|
-
expect(@object.unescape("--one%2Btwo--")).to eq("--one+two--")
|
69
|
-
expect(@object.unescape("me%40basho.co")).to eq("me@basho.co")
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'riak/client/feature_detection'
|
3
|
-
|
4
|
-
describe Riak::Client::FeatureDetection do
|
5
|
-
let(:klass) {
|
6
|
-
Class.new do
|
7
|
-
include Riak::Client::FeatureDetection
|
8
|
-
end
|
9
|
-
}
|
10
|
-
subject { klass.new }
|
11
|
-
|
12
|
-
context "when the get_server_version is unimplemented" do
|
13
|
-
it "raises a NotImplementedError" do
|
14
|
-
expect { subject.server_version }.to raise_error(NotImplementedError)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
context "when the Riak version is 0.14.x" do
|
19
|
-
before { allow(subject).to receive(:get_server_version).and_return("0.14.2") }
|
20
|
-
it { is_expected.not_to be_mapred_phaseless }
|
21
|
-
it { is_expected.not_to be_pb_indexes }
|
22
|
-
it { is_expected.not_to be_pb_search }
|
23
|
-
it { is_expected.not_to be_pb_conditionals }
|
24
|
-
it { is_expected.not_to be_quorum_controls }
|
25
|
-
it { is_expected.not_to be_tombstone_vclocks }
|
26
|
-
it { is_expected.not_to be_pb_head }
|
27
|
-
it { is_expected.not_to be_http_props_clearable }
|
28
|
-
end
|
29
|
-
|
30
|
-
context "when the Riak version is 1.0.x" do
|
31
|
-
before { allow(subject).to receive(:get_server_version).and_return("1.0.3") }
|
32
|
-
it { is_expected.not_to be_mapred_phaseless }
|
33
|
-
it { is_expected.not_to be_pb_indexes }
|
34
|
-
it { is_expected.not_to be_pb_search }
|
35
|
-
it { is_expected.to be_pb_conditionals }
|
36
|
-
it { is_expected.to be_quorum_controls }
|
37
|
-
it { is_expected.to be_tombstone_vclocks }
|
38
|
-
it { is_expected.to be_pb_head }
|
39
|
-
it { is_expected.not_to be_http_props_clearable }
|
40
|
-
end
|
41
|
-
|
42
|
-
context "when the Riak version is 1.1.x" do
|
43
|
-
before { allow(subject).to receive(:get_server_version).and_return("1.1.4") }
|
44
|
-
it { is_expected.to be_mapred_phaseless }
|
45
|
-
it { is_expected.not_to be_pb_indexes }
|
46
|
-
it { is_expected.not_to be_pb_search }
|
47
|
-
it { is_expected.to be_pb_conditionals }
|
48
|
-
it { is_expected.to be_quorum_controls }
|
49
|
-
it { is_expected.to be_tombstone_vclocks }
|
50
|
-
it { is_expected.to be_pb_head }
|
51
|
-
it { is_expected.not_to be_http_props_clearable }
|
52
|
-
end
|
53
|
-
|
54
|
-
context "when the Riak version is 1.2.x" do
|
55
|
-
before { allow(subject).to receive(:get_server_version).and_return("1.2.1") }
|
56
|
-
it { is_expected.to be_mapred_phaseless }
|
57
|
-
it { is_expected.to be_pb_indexes }
|
58
|
-
it { is_expected.to be_pb_search }
|
59
|
-
it { is_expected.to be_pb_conditionals }
|
60
|
-
it { is_expected.to be_quorum_controls }
|
61
|
-
it { is_expected.to be_tombstone_vclocks }
|
62
|
-
it { is_expected.to be_pb_head }
|
63
|
-
it { is_expected.not_to be_http_props_clearable }
|
64
|
-
end
|
65
|
-
|
66
|
-
context "when the Riak version is 1.3.x" do
|
67
|
-
before { allow(subject).to receive(:get_server_version).and_return("1.3.0") }
|
68
|
-
it { is_expected.to be_mapred_phaseless }
|
69
|
-
it { is_expected.to be_pb_indexes }
|
70
|
-
it { is_expected.to be_pb_search }
|
71
|
-
it { is_expected.to be_pb_conditionals }
|
72
|
-
it { is_expected.to be_quorum_controls }
|
73
|
-
it { is_expected.to be_tombstone_vclocks }
|
74
|
-
it { is_expected.to be_pb_head }
|
75
|
-
it { is_expected.to be_http_props_clearable }
|
76
|
-
end
|
77
|
-
end
|