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.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -0
  3. data/RELNOTES.md +3 -0
  4. data/lib/riak/bucket.rb +1 -1
  5. data/lib/riak/client.rb +14 -7
  6. data/lib/riak/client/beefcake/messages.rb +13 -0
  7. data/lib/riak/multi.rb +101 -0
  8. data/lib/riak/multiexist.rb +14 -0
  9. data/lib/riak/multiget.rb +7 -107
  10. data/lib/riak/version.rb +1 -1
  11. metadata +12 -234
  12. data/.document +0 -5
  13. data/.gitignore +0 -44
  14. data/.rspec +0 -2
  15. data/Gemfile +0 -17
  16. data/Guardfile +0 -20
  17. data/Rakefile +0 -124
  18. data/riak-client.gemspec +0 -71
  19. data/spec/failover/failover.rb +0 -59
  20. data/spec/fixtures/bitcask.txt +0 -25
  21. data/spec/fixtures/cat.jpg +0 -0
  22. data/spec/fixtures/multipart-basic-conflict.txt +0 -15
  23. data/spec/fixtures/multipart-blank.txt +0 -7
  24. data/spec/fixtures/multipart-mapreduce.txt +0 -10
  25. data/spec/fixtures/multipart-with-body.txt +0 -16
  26. data/spec/fixtures/multipart-with-marked-tombstones.txt +0 -17
  27. data/spec/fixtures/multipart-with-unmarked-tombstone.txt +0 -16
  28. data/spec/fixtures/server.cert.crt +0 -15
  29. data/spec/fixtures/server.cert.key +0 -15
  30. data/spec/fixtures/test.pem +0 -1
  31. data/spec/fixtures/yz_schema_template.xml +0 -18
  32. data/spec/integration/riak/bucket_types_spec.rb +0 -308
  33. data/spec/integration/riak/conflict_resolution_spec.rb +0 -96
  34. data/spec/integration/riak/counters_spec.rb +0 -36
  35. data/spec/integration/riak/crdt/configuration_spec.rb +0 -38
  36. data/spec/integration/riak/crdt_search_spec.rb +0 -176
  37. data/spec/integration/riak/crdt_spec.rb +0 -332
  38. data/spec/integration/riak/crdt_validation/map_spec.rb +0 -63
  39. data/spec/integration/riak/crdt_validation/set_spec.rb +0 -122
  40. data/spec/integration/riak/encodings/crdt_spec.rb +0 -122
  41. data/spec/integration/riak/encodings/kv_spec.rb +0 -87
  42. data/spec/integration/riak/encodings/yz_spec.rb +0 -142
  43. data/spec/integration/riak/preflist_spec.rb +0 -43
  44. data/spec/integration/riak/properties_spec.rb +0 -69
  45. data/spec/integration/riak/protobuffs/interrupted_request_spec.rb +0 -33
  46. data/spec/integration/riak/protobuffs/timeouts_spec.rb +0 -178
  47. data/spec/integration/riak/protobuffs_backends_spec.rb +0 -40
  48. data/spec/integration/riak/search_spec.rb +0 -104
  49. data/spec/integration/riak/secondary_index_spec.rb +0 -72
  50. data/spec/integration/riak/security_spec.rb +0 -105
  51. data/spec/integration/riak/threading_spec.rb +0 -154
  52. data/spec/integration/riak/time_series_spec.rb +0 -212
  53. data/spec/integration/yokozuna/index_spec.rb +0 -61
  54. data/spec/integration/yokozuna/queries_spec.rb +0 -115
  55. data/spec/integration/yokozuna/schema_spec.rb +0 -49
  56. data/spec/riak/beefcake_protobuffs_backend/bucket_properties_operator_spec.rb +0 -247
  57. data/spec/riak/beefcake_protobuffs_backend/crdt_operator_spec.rb +0 -244
  58. data/spec/riak/beefcake_protobuffs_backend/object_methods_spec.rb +0 -53
  59. data/spec/riak/beefcake_protobuffs_backend/protocol_spec.rb +0 -189
  60. data/spec/riak/beefcake_protobuffs_backend/ts_cell_codec_spec.rb +0 -124
  61. data/spec/riak/beefcake_protobuffs_backend_spec.rb +0 -162
  62. data/spec/riak/bucket_properties_spec.rb +0 -135
  63. data/spec/riak/bucket_spec.rb +0 -275
  64. data/spec/riak/bucket_type_spec.rb +0 -50
  65. data/spec/riak/bucket_typed/bucket_spec.rb +0 -78
  66. data/spec/riak/client_spec.rb +0 -304
  67. data/spec/riak/core_ext/to_param_spec.rb +0 -15
  68. data/spec/riak/counter_spec.rb +0 -122
  69. data/spec/riak/crdt/counter_spec.rb +0 -55
  70. data/spec/riak/crdt/hyper_log_log_spec.rb +0 -56
  71. data/spec/riak/crdt/inner_counter_spec.rb +0 -21
  72. data/spec/riak/crdt/inner_flag_spec.rb +0 -39
  73. data/spec/riak/crdt/inner_map_spec.rb +0 -47
  74. data/spec/riak/crdt/inner_register_spec.rb +0 -40
  75. data/spec/riak/crdt/inner_set_spec.rb +0 -33
  76. data/spec/riak/crdt/map_spec.rb +0 -78
  77. data/spec/riak/crdt/set_spec.rb +0 -61
  78. data/spec/riak/crdt/shared_examples.rb +0 -88
  79. data/spec/riak/crdt/typed_collection_spec.rb +0 -225
  80. data/spec/riak/escape_spec.rb +0 -72
  81. data/spec/riak/feature_detection_spec.rb +0 -77
  82. data/spec/riak/index_collection_spec.rb +0 -53
  83. data/spec/riak/instrumentation_spec.rb +0 -124
  84. data/spec/riak/link_spec.rb +0 -85
  85. data/spec/riak/list_buckets_spec.rb +0 -41
  86. data/spec/riak/map_reduce/filter_builder_spec.rb +0 -32
  87. data/spec/riak/map_reduce/phase_spec.rb +0 -142
  88. data/spec/riak/map_reduce_spec.rb +0 -434
  89. data/spec/riak/multiget_spec.rb +0 -81
  90. data/spec/riak/node_spec.rb +0 -26
  91. data/spec/riak/robject_spec.rb +0 -542
  92. data/spec/riak/search/index_spec.rb +0 -72
  93. data/spec/riak/search/query_spec.rb +0 -88
  94. data/spec/riak/search/result_collection_spec.rb +0 -89
  95. data/spec/riak/search/result_document_spec.rb +0 -106
  96. data/spec/riak/search/schema_spec.rb +0 -63
  97. data/spec/riak/search_spec.rb +0 -107
  98. data/spec/riak/secondary_index_spec.rb +0 -225
  99. data/spec/riak/serializers_spec.rb +0 -121
  100. data/spec/riak/stamp_spec.rb +0 -54
  101. data/spec/riak/time_series/deletion_spec.rb +0 -33
  102. data/spec/riak/time_series/listing_spec.rb +0 -51
  103. data/spec/riak/time_series/submission_spec.rb +0 -35
  104. data/spec/riak/util/gzip_spec.rb +0 -49
  105. data/spec/riak/walk_spec_spec.rb +0 -203
  106. data/spec/spec_helper.rb +0 -67
  107. data/spec/support/certs/README.md +0 -13
  108. data/spec/support/certs/ca.crt +0 -21
  109. data/spec/support/certs/client.crl +0 -13
  110. data/spec/support/certs/client.crt +0 -94
  111. data/spec/support/certs/client.csr +0 -18
  112. data/spec/support/certs/client.key +0 -27
  113. data/spec/support/certs/empty_ca.crt +0 -21
  114. data/spec/support/certs/server.crl +0 -13
  115. data/spec/support/certs/server.crt +0 -94
  116. data/spec/support/certs/server.key +0 -27
  117. data/spec/support/crdt_search_config.rb +0 -112
  118. data/spec/support/crdt_search_fixtures.rb +0 -42
  119. data/spec/support/integration_setup.rb +0 -10
  120. data/spec/support/search_config.rb +0 -83
  121. data/spec/support/search_corpus_setup.rb +0 -39
  122. data/spec/support/test_client.rb +0 -52
  123. data/spec/support/test_client.yml.example +0 -10
  124. data/spec/support/unified_backend_examples.rb +0 -402
  125. data/spec/support/version_filter.rb +0 -12
  126. data/spec/support/wait_until.rb +0 -20
@@ -1,244 +0,0 @@
1
- require 'spec_helper'
2
- Riak::Client::BeefcakeProtobuffsBackend.configured?
3
-
4
- describe Riak::Client::BeefcakeProtobuffsBackend::CrdtOperator do
5
-
6
- let(:backend_class){ Riak::Client::BeefcakeProtobuffsBackend }
7
- let(:backend){ double 'beefcake protobuffs backend' }
8
- subject { described_class.new backend }
9
-
10
-
11
- describe 'operating on a counter' do
12
- let(:increment){ 5 }
13
- let(:operation) do
14
- Riak::Crdt::Operation::Update.new.tap do |op|
15
- op.type = :counter
16
- op.value = increment
17
- end
18
- end
19
-
20
- it 'serializes a counter operation into protobuffs' do
21
- result = subject.serialize operation
22
-
23
- expect(result).to be_a backend_class::DtOp
24
- expect(result.counter_op).to be_a backend_class::CounterOp
25
- expect(result.counter_op.increment).to eq increment
26
- end
27
-
28
- it 'serializes multiple counter operations into protobuffs' do
29
- result = subject.serialize [operation, operation]
30
-
31
- expect{result.encode}.to_not raise_error
32
-
33
- expect(result).to be_a backend_class::DtOp
34
- expect(result.counter_op).to be_a backend_class::CounterOp
35
- expect(result.counter_op.increment).to eq (increment * 2)
36
- end
37
- end
38
-
39
- describe 'operating on a set' do
40
- let(:added_element){ 'added_element' }
41
- let(:removed_element){ 'removed_element' }
42
- let(:operation) do
43
- Riak::Crdt::Operation::Update.new.tap do |op|
44
- op.type = :set
45
- op.value = {
46
- add: [added_element],
47
- remove: [removed_element]
48
- }
49
- end
50
- end
51
-
52
- it 'serializes a set operation into protobuffs' do
53
- result = subject.serialize operation
54
-
55
- expect{result.encode}.to_not raise_error
56
-
57
- expect(result).to be_a backend_class::DtOp
58
- expect(result.set_op).to be_a backend_class::SetOp
59
- expect(result.set_op.adds).to eq [added_element]
60
- expect(result.set_op.removes).to eq [removed_element]
61
- end
62
- end
63
-
64
- describe 'operating on a hyper_log_log' do
65
- let(:added_element){ 'added_element' }
66
- let(:operation) do
67
- Riak::Crdt::Operation::Update.new.tap do |op|
68
- op.type = :hll
69
- op.value = {
70
- add: [added_element]
71
- }
72
- end
73
- end
74
-
75
- it 'serializes a hyper_log_log operation into protobuffs' do
76
- result = subject.serialize operation
77
-
78
- expect{result.encode}.to_not raise_error
79
-
80
- expect(result).to be_a backend_class::DtOp
81
- expect(result.hll_op).to be_a backend_class::HllOp
82
- expect(result.hll_op.adds).to eq [added_element]
83
- end
84
- end
85
-
86
- describe 'operating on a map' do
87
- it 'serializes inner counter operations' do
88
- counter_op = Riak::Crdt::Operation::Update.new.tap do |op|
89
- op.name = 'inner_counter'
90
- op.type = :counter
91
- op.value = 12345
92
- end
93
- map_op = Riak::Crdt::Operation::Update.new.tap do |op|
94
- op.type = :map
95
- op.value = counter_op
96
- end
97
-
98
- result = subject.serialize map_op
99
-
100
- expect{result.encode}.to_not raise_error
101
-
102
- expect(result).to be_a backend_class::DtOp
103
- expect(result.map_op).to be_a backend_class::MapOp
104
- map_update = result.map_op.updates.first
105
- expect(map_update).to be_a backend_class::MapUpdate
106
- expect(map_update.counter_op).to be_a backend_class::CounterOp
107
- expect(map_update.counter_op.increment).to eq 12345
108
- end
109
-
110
- it 'serializes inner flag operations' do
111
- flag_op = Riak::Crdt::Operation::Update.new.tap do |op|
112
- op.name = 'inner_flag'
113
- op.type = :flag
114
- op.value = true
115
- end
116
- map_op = Riak::Crdt::Operation::Update.new.tap do |op|
117
- op.type = :map
118
- op.value = flag_op
119
- end
120
-
121
- result = subject.serialize map_op
122
-
123
- expect{result.encode}.to_not raise_error
124
-
125
- expect(result).to be_a backend_class::DtOp
126
- expect(result.map_op).to be_a backend_class::MapOp
127
- map_update = result.map_op.updates.first
128
- expect(map_update).to be_a backend_class::MapUpdate
129
- expect(map_update.flag_op).to eq backend_class::MapUpdate::FlagOp::ENABLE
130
-
131
- flag_op = Riak::Crdt::Operation::Update.new.tap do |op|
132
- op.name = 'inner_flag'
133
- op.type = :flag
134
- op.value = false
135
- end
136
- map_op = Riak::Crdt::Operation::Update.new.tap do |op|
137
- op.type = :map
138
- op.value = flag_op
139
- end
140
-
141
- result = subject.serialize map_op
142
-
143
- expect{result.encode}.to_not raise_error
144
-
145
- expect(result).to be_a backend_class::DtOp
146
- expect(result.map_op).to be_a backend_class::MapOp
147
- map_update = result.map_op.updates.first
148
- expect(map_update).to be_a backend_class::MapUpdate
149
- expect(map_update.flag_op).to eq backend_class::MapUpdate::FlagOp::DISABLE
150
- end
151
-
152
- it 'serializes inner register operations' do
153
- register_op = Riak::Crdt::Operation::Update.new.tap do |op|
154
- op.name = 'inner_register'
155
- op.type = :register
156
- op.value = 'hello'
157
- end
158
- map_op = Riak::Crdt::Operation::Update.new.tap do |op|
159
- op.type = :map
160
- op.value = register_op
161
- end
162
-
163
- result = subject.serialize map_op
164
-
165
- expect{result.encode}.to_not raise_error
166
-
167
- expect(result).to be_a backend_class::DtOp
168
- expect(result.map_op).to be_a backend_class::MapOp
169
- map_update = result.map_op.updates.first
170
- expect(map_update).to be_a backend_class::MapUpdate
171
- expect(map_update.register_op).to eq 'hello'
172
-
173
- delete_op = Riak::Crdt::Operation::Delete.new.tap do |op|
174
- op.name = 'inner_register'
175
- op.type = :register
176
- end
177
- map_op = Riak::Crdt::Operation::Update.new.tap do |op|
178
- op.type = :map
179
- op.value = delete_op
180
- end
181
-
182
- result = subject.serialize map_op
183
-
184
- expect{ result.encode }.to_not raise_error
185
-
186
- expect(result).to be_a backend_class::DtOp
187
- expect(result.map_op).to be_a backend_class::MapOp
188
- map_delete = result.map_op.removes.first
189
- expect(map_delete).to be_a backend_class::MapField
190
- expect(map_delete.name).to eq 'inner_register'
191
- expect(map_delete.type).to eq backend_class::MapField::MapFieldType::REGISTER
192
- end
193
-
194
- it 'serializes inner set operations' do
195
- set_op = Riak::Crdt::Operation::Update.new.tap do |op|
196
- op.name = 'inner_set'
197
- op.type = :set
198
- op.value = {add: 'added_member'}
199
- end
200
- map_op = Riak::Crdt::Operation::Update.new.tap do |op|
201
- op.type = :map
202
- op.value = set_op
203
- end
204
-
205
- result = subject.serialize map_op
206
-
207
- expect{result.encode}.to_not raise_error
208
-
209
- expect(result).to be_a backend_class::DtOp
210
- expect(result.map_op).to be_a backend_class::MapOp
211
- map_update = result.map_op.updates.first
212
- expect(map_update).to be_a backend_class::MapUpdate
213
- expect(map_update.set_op.adds).to eq 'added_member'
214
- end
215
-
216
- it 'serializes inner map operations' do
217
- register_op = Riak::Crdt::Operation::Update.new.tap do |op|
218
- op.name = 'inner_inner_register'
219
- op.type = :register
220
- op.value = 'inner_register_value'
221
- end
222
- inner_map_op = Riak::Crdt::Operation::Update.new.tap do |op|
223
- op.name = 'inner_map'
224
- op.type = :map
225
- op.value = register_op
226
- end
227
- map_op = Riak::Crdt::Operation::Update.new.tap do |op|
228
- op.type = :map
229
- op.value = inner_map_op
230
- end
231
-
232
- result = subject.serialize map_op
233
-
234
- expect{result.encode}.to_not raise_error
235
-
236
- expect(result).to be_a backend_class::DtOp
237
- expect(result.map_op).to be_a backend_class::MapOp
238
- map_update = result.map_op.updates.first
239
- expect(map_update).to be_a backend_class::MapUpdate
240
- expect(map_update.map_op).to be_a backend_class::MapOp
241
- expect(map_update.map_op.updates.first.register_op).to eq 'inner_register_value'
242
- end
243
- end
244
- end
@@ -1,53 +0,0 @@
1
- require 'spec_helper'
2
- require 'riak/client/beefcake/object_methods'
3
- require 'riak/client/beefcake/messages'
4
-
5
- describe Riak::Client::BeefcakeProtobuffsBackend::ObjectMethods do
6
- before :each do
7
- @client = Riak::Client.new
8
- @backend = Riak::Client::BeefcakeProtobuffsBackend.new(@client, @client.node)
9
- @bucket = Riak::Bucket.new(@client, "bucket")
10
- @object = Riak::RObject.new(@bucket, "bar")
11
- @content = double(
12
- :value => '',
13
- :vtag => nil,
14
- :content_type => nil,
15
- :content_encoding => nil,
16
- :links => nil,
17
- :usermeta => nil,
18
- :last_mod => nil,
19
- :last_mod_usecs => nil,
20
- :indexes => nil,
21
- :charset => nil
22
- )
23
- end
24
-
25
- describe "loading object data from the response" do
26
- it "loads the key" do
27
- pbuf = double(:vclock => nil, :content => [@content], :value => nil, :key => 'akey')
28
- o = @backend.load_object(pbuf, @object)
29
- expect(o).to eq(@object)
30
- expect(o.key).to eq(pbuf.key)
31
- end
32
-
33
- describe "last_modified" do
34
- before :each do
35
- allow(@content).to receive(:last_mod) { 1271442363 }
36
- end
37
-
38
- it "is set to time of last_mod with microseconds from last_mod_usecs" do
39
- allow(@content).to receive(:last_mod_usecs) { 105696 }
40
- pbuf = double(:vclock => nil, :content => [@content], :value => nil, :key => 'akey')
41
- o = @backend.load_object(pbuf, @object)
42
- expect(o.last_modified).to eq(Time.at(1271442363, 105696))
43
- end
44
-
45
- it "is set to time of last_mod without microseconds if last_mod_usecs is missing" do
46
- pbuf = double(:vclock => nil, :content => [@content], :value => nil, :key => 'akey')
47
- o = @backend.load_object(pbuf, @object)
48
- expect(o.last_modified).to eq(Time.at(1271442363, 0))
49
- end
50
- end
51
- end
52
-
53
- end
@@ -1,189 +0,0 @@
1
- require 'spec_helper'
2
- require 'riak/client/beefcake/protocol'
3
-
4
- describe Riak::Client::BeefcakeProtobuffsBackend::Protocol do
5
- let(:socket){ double 'Socket' }
6
- subject{ described_class.new socket }
7
- let(:codes){ Riak::Client::BeefcakeMessageCodes }
8
-
9
- let(:yz_req){ Riak::Client::BeefcakeProtobuffsBackend::
10
- RpbYokozunaSchemaGetReq.new name: 'schema' }
11
- let(:ctr_resp){ Riak::Client::BeefcakeProtobuffsBackend::
12
- RpbCounterGetResp.new value: rand(2**10) }
13
- let(:error_resp){ Riak::Client::BeefcakeProtobuffsBackend::
14
- RpbErrorResp.new errcode: rand(2**10), errmsg: 'message' }
15
-
16
- describe 'writing messages' do
17
- # I really wanted to call this "send" but Ruby already has that method
18
-
19
- it 'writes messages without a body' do
20
- name = :PingReq
21
-
22
- expect(socket).to receive(:write) { |payload|
23
- length, code = payload.unpack 'NC'
24
- expect(length).to eq 1
25
- expect(code).to eq codes.index name
26
- }.ordered
27
- expect(socket).to receive(:flush).ordered
28
-
29
- subject.write name
30
- end
31
-
32
- it 'writes messages with Beefcake::Message instances as bodies' do
33
- message = yz_req
34
- name = :YokozunaSchemaGetReq
35
-
36
- expect(socket).to receive(:write) { |payload|
37
- header = payload[0..4]
38
- body = payload[5..-1]
39
- length, code = header.unpack 'NC'
40
- expect(code).to eq codes.index name
41
- expect(length).to eq(body.length + 1)
42
- expect(body).to eq message.encode.to_s
43
- }.ordered
44
- expect(socket).to receive(:flush).ordered
45
-
46
- subject.write name, message
47
- end
48
-
49
- it 'raises an error and writes nothing when passed the wrong thing' do
50
- expect{ subject.write :YokozunaSchemaGetReq, Object.new }.
51
- to raise_error
52
- end
53
- end
54
-
55
- describe 'receiving messages' do
56
- it 'receives messages without a body and returns an array of code-symbol and nil' do
57
- name = :PingResp
58
- header = [1, codes.index(name)].pack 'NC'
59
- expect(socket).to receive(:read).
60
- ordered.
61
- with(5).
62
- and_return(header)
63
-
64
- code, payload = subject.receive
65
-
66
- expect(code).to eq name
67
- expect(payload).to eq nil
68
- end
69
-
70
- it 'receives messages and returns an array of code-symbol and string' do
71
- message = ctr_resp
72
- message_str = message.encode.to_s
73
- message_len = message_str.length
74
- name = :CounterGetResp
75
- header = [message_len + 1, codes.index(name)].pack 'NC'
76
-
77
- expect(socket).to receive(:read).
78
- ordered.
79
- with(5).
80
- and_return(header)
81
- expect(socket).to receive(:read).
82
- ordered.
83
- with(message_len).
84
- and_return(message_str)
85
-
86
- code, payload = subject.receive
87
-
88
- expect(code).to eq name
89
- expect(payload).to eq message_str
90
- end
91
- end
92
-
93
- describe 'expecting messages' do
94
- describe 'expected message received' do
95
- it 'accepts expected messages without a body and returns true' do
96
- name = :PingResp
97
- header = [1, codes.index(name)].pack 'NC'
98
-
99
- expect(socket).to receive(:read).
100
- with(5).
101
- and_return(header)
102
-
103
- payload = subject.expect name
104
-
105
- expect(payload).to eq true
106
- end
107
-
108
- it 'accepts expected messages and returns a Beefcake::Message instance' do
109
- message = ctr_resp
110
- message_str = message.encode.to_s
111
- message_len = message_str.length
112
- name = :CounterGetResp
113
- header = [message_len + 1, codes.index(name)].pack 'NC'
114
-
115
- expect(socket).to receive(:read).
116
- ordered.
117
- with(5).
118
- and_return(header)
119
- expect(socket).to receive(:read).
120
- ordered.
121
- with(message_len).
122
- and_return(message_str)
123
-
124
- payload = subject.expect name, message.class
125
-
126
- expect(payload).to eq message
127
- expect(payload.value).to eq message.value
128
- end
129
-
130
- it 'accepts messages with an empty body when required to' do
131
- name = :PutResp
132
- header = [1, codes.index(name)].pack 'NC'
133
- decoder_class = double 'RpbPutResp'
134
-
135
- expect(socket).to receive(:read).
136
- with(5).
137
- and_return(header)
138
-
139
- payload = subject.expect name, decoder_class, empty_body_acceptable: true
140
-
141
- expect(payload).to eq :empty
142
- end
143
- end
144
-
145
- describe 'unexpected message received' do
146
- it 'raises a ProtobuffsUnexpectedResponse error' do
147
- message = ctr_resp
148
- message_str = message.encode.to_s
149
- message_len = message_str.length
150
- name = :CounterGetResp
151
- header = [message_len + 1, codes.index(name)].pack 'NC'
152
-
153
- expect(socket).to receive(:read).
154
- ordered.
155
- with(5).
156
- and_return(header)
157
- expect(socket).to receive(:read).
158
- ordered.
159
- with(message_len).
160
- and_return(message_str)
161
-
162
- expect{ subject.expect :PingResp }.
163
- to raise_error Riak::ProtobuffsUnexpectedResponse
164
- end
165
- end
166
-
167
- describe 'ErrorResp received' do
168
- it 'raises a ProtobuffsErrorResponse error' do
169
- message = error_resp
170
- message_str = message.encode.to_s
171
- message_len = message_str.length
172
- name = :ErrorResp
173
- header = [message_len + 1, codes.index(name)].pack 'NC'
174
-
175
- expect(socket).to receive(:read).
176
- ordered.
177
- with(5).
178
- and_return(header)
179
- expect(socket).to receive(:read).
180
- ordered.
181
- with(message_len).
182
- and_return(message_str)
183
-
184
- expect{ subject.expect :PingResp }.
185
- to raise_error Riak::ProtobuffsErrorResponse
186
- end
187
- end
188
- end
189
- end