riak-client 2.4.1 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/.document +5 -5
  3. data/.gitignore +3 -0
  4. data/Gemfile +17 -17
  5. data/Guardfile +20 -20
  6. data/LICENSE.md +16 -16
  7. data/RELNOTES.md +4 -0
  8. data/Rakefile +6 -1
  9. data/lib/riak/client/beefcake/crdt/counter_loader.rb +18 -18
  10. data/lib/riak/client/beefcake/crdt/hyper_log_log_loader.rb +18 -0
  11. data/lib/riak/client/beefcake/crdt/map_loader.rb +64 -64
  12. data/lib/riak/client/beefcake/crdt_loader.rb +4 -1
  13. data/lib/riak/client/beefcake/crdt_operator.rb +13 -0
  14. data/lib/riak/client/beefcake/footer +4 -4
  15. data/lib/riak/client/beefcake/header +6 -6
  16. data/lib/riak/client/beefcake/messages.rb +67 -10
  17. data/lib/riak/client/decaying.rb +36 -36
  18. data/lib/riak/client/feature_detection.rb +120 -120
  19. data/lib/riak/client/instrumentation.rb +19 -19
  20. data/lib/riak/client/node.rb +49 -49
  21. data/lib/riak/client/search.rb +27 -27
  22. data/lib/riak/conflict.rb +13 -13
  23. data/lib/riak/core_ext.rb +7 -7
  24. data/lib/riak/core_ext/blank.rb +53 -53
  25. data/lib/riak/core_ext/extract_options.rb +7 -7
  26. data/lib/riak/core_ext/json.rb +15 -15
  27. data/lib/riak/core_ext/slice.rb +18 -18
  28. data/lib/riak/core_ext/stringify_keys.rb +10 -10
  29. data/lib/riak/core_ext/symbolize_keys.rb +10 -10
  30. data/lib/riak/core_ext/to_param.rb +31 -31
  31. data/lib/riak/crdt.rb +23 -21
  32. data/lib/riak/crdt/base.rb +1 -1
  33. data/lib/riak/crdt/hyper_log_log.rb +97 -0
  34. data/lib/riak/crdt/operation.rb +19 -19
  35. data/lib/riak/encoding.rb +6 -6
  36. data/lib/riak/errors/backend_creation.rb +9 -9
  37. data/lib/riak/errors/connection_error.rb +50 -50
  38. data/lib/riak/errors/protobuffs_error.rb +11 -11
  39. data/lib/riak/i18n.rb +7 -7
  40. data/lib/riak/instrumentation.rb +6 -6
  41. data/lib/riak/json.rb +52 -52
  42. data/lib/riak/list_buckets.rb +28 -28
  43. data/lib/riak/locale/en.yml +1 -0
  44. data/lib/riak/locale/fr.yml +51 -51
  45. data/lib/riak/map_reduce/results.rb +49 -49
  46. data/lib/riak/map_reduce_error.rb +7 -7
  47. data/lib/riak/multiget.rb +122 -122
  48. data/lib/riak/robject.rb +17 -1
  49. data/lib/riak/search/result_document.rb +9 -0
  50. data/lib/riak/stamp.rb +77 -77
  51. data/lib/riak/tombstone.rb +13 -0
  52. data/lib/riak/util/tcp_socket_extensions.rb +58 -58
  53. data/lib/riak/version.rb +1 -1
  54. data/spec/failover/failover.rb +59 -59
  55. data/spec/fixtures/bitcask.txt +25 -25
  56. data/spec/fixtures/multipart-basic-conflict.txt +15 -15
  57. data/spec/fixtures/multipart-blank.txt +7 -7
  58. data/spec/fixtures/multipart-mapreduce.txt +10 -10
  59. data/spec/fixtures/multipart-with-body.txt +16 -16
  60. data/spec/fixtures/multipart-with-marked-tombstones.txt +17 -17
  61. data/spec/fixtures/multipart-with-unmarked-tombstone.txt +16 -16
  62. data/spec/fixtures/server.cert.crt +15 -15
  63. data/spec/fixtures/server.cert.key +15 -15
  64. data/spec/fixtures/test.pem +1 -1
  65. data/spec/integration/riak/bucket_types_spec.rb +38 -0
  66. data/spec/integration/riak/crdt/configuration_spec.rb +4 -3
  67. data/spec/integration/riak/crdt_spec.rb +70 -0
  68. data/spec/integration/riak/encodings/crdt_spec.rb +29 -3
  69. data/spec/integration/riak/encodings/yz_spec.rb +2 -1
  70. data/spec/integration/riak/preflist_spec.rb +15 -3
  71. data/spec/integration/riak/protobuffs/timeouts_spec.rb +1 -1
  72. data/spec/integration/riak/security_spec.rb +11 -6
  73. data/spec/integration/riak/threading_spec.rb +154 -150
  74. data/spec/integration/yokozuna/index_spec.rb +61 -61
  75. data/spec/integration/yokozuna/queries_spec.rb +1 -1
  76. data/spec/integration/yokozuna/schema_spec.rb +49 -49
  77. data/spec/riak/beefcake_protobuffs_backend/crdt_operator_spec.rb +22 -0
  78. data/spec/riak/core_ext/to_param_spec.rb +15 -15
  79. data/spec/riak/crdt/hyper_log_log_spec.rb +56 -0
  80. data/spec/riak/crdt/inner_counter_spec.rb +21 -21
  81. data/spec/riak/crdt/inner_set_spec.rb +33 -33
  82. data/spec/riak/crdt/set_spec.rb +61 -61
  83. data/spec/riak/crdt/shared_examples.rb +14 -0
  84. data/spec/riak/escape_spec.rb +72 -72
  85. data/spec/riak/feature_detection_spec.rb +77 -77
  86. data/spec/riak/index_collection_spec.rb +53 -53
  87. data/spec/riak/instrumentation_spec.rb +124 -124
  88. data/spec/riak/link_spec.rb +85 -85
  89. data/spec/riak/list_buckets_spec.rb +41 -41
  90. data/spec/riak/node_spec.rb +26 -26
  91. data/spec/riak/robject_spec.rb +45 -0
  92. data/spec/support/certs/README.md +12 -12
  93. data/spec/support/certs/ca.crt +21 -21
  94. data/spec/support/certs/client.crl +13 -13
  95. data/spec/support/certs/client.crt +94 -94
  96. data/spec/support/certs/client.csr +18 -18
  97. data/spec/support/certs/client.key +27 -27
  98. data/spec/support/certs/empty_ca.crt +21 -21
  99. data/spec/support/certs/server.crl +13 -13
  100. data/spec/support/certs/server.crt +94 -94
  101. data/spec/support/certs/server.key +27 -27
  102. data/spec/support/crdt_search_fixtures.rb +1 -1
  103. data/spec/support/integration_setup.rb +10 -10
  104. data/spec/support/test_client.rb +1 -1
  105. data/spec/support/test_client.yml.example +10 -10
  106. metadata +10 -3
@@ -75,7 +75,7 @@ describe "Yokozuna queries", test_client: true, integration: true do
75
75
 
76
76
  it "supports utf8" do
77
77
  build_json_obj(@bucket, "ja", {"text_ja"=>"私はハイビスカスを食べるのが 大好き"})
78
- sleep 1.1 # pause for index commit to trigger
78
+ sleep 2.1 # pause for index commit to trigger
79
79
  resp = @client.search(@index, "text_ja:大好き")
80
80
  expect(resp).to include('docs')
81
81
  expect(resp['docs'].size).to eq 1
@@ -1,49 +1,49 @@
1
- require 'spec_helper'
2
- require 'riak'
3
-
4
- describe "Yokozuna", test_client: true, integration: true do
5
- before(:all) do
6
- @client = test_client
7
-
8
- @index = 'yz_spec-' + random_key
9
- @schema = 'yz_spec-' + random_key
10
- end
11
-
12
- context 'with no schema' do
13
- it 'allows schema creation' do
14
- @client.create_search_schema(@schema, SCHEMA_CONTENT)
15
- wait_until{ !@client.get_search_schema(@schema).nil? }
16
- expect(@client.get_search_schema(@schema)).not_to be_nil
17
- end
18
- end
19
- context 'with a schema' do
20
- it 'has a readable schema' do
21
- @client.create_search_schema(@schema, SCHEMA_CONTENT)
22
- wait_until{ !@client.get_search_schema(@schema).nil? }
23
- schema_resp = @client.get_search_schema(@schema)
24
- expect(schema_resp.name).to eq(@schema)
25
- expect(schema_resp.content).to eq(SCHEMA_CONTENT)
26
- end
27
- end
28
-
29
- SCHEMA_CONTENT = <<-XML
30
- <?xml version=\"1.0\" encoding=\"UTF-8\" ?>
31
- <schema name=\"#{@index}\" version=\"1.5\">
32
- <fields>
33
- <field name=\"_yz_id\" type=\"_yz_str\" indexed=\"true\" stored=\"true\" multiValued=\"false\" required=\"true\" />
34
- <field name=\"_yz_ed\" type=\"_yz_str\" indexed=\"true\" stored=\"true\" multiValued=\"false\"/>
35
- <field name=\"_yz_pn\" type=\"_yz_str\" indexed=\"true\" stored=\"true\" multiValued=\"false\"/>
36
- <field name=\"_yz_fpn\" type=\"_yz_str\" indexed=\"true\" stored=\"true\" multiValued=\"false\"/>
37
- <field name=\"_yz_vtag\" type=\"_yz_str\" indexed=\"true\" stored=\"true\" multiValued=\"false\"/>
38
- <field name=\"_yz_rk\" type=\"_yz_str\" indexed=\"true\" stored=\"true\" multiValued=\"false\"/>
39
- <field name=\"_yz_rb\" type=\"_yz_str\" indexed=\"true\" stored=\"true\" multiValued=\"false\"/>
40
- <field name=\"_yz_rt\" type=\"_yz_str\" indexed=\"true\" stored=\"true\" multiValued=\"false\"/>
41
- <field name=\"_yz_err\" type=\"_yz_str\" indexed=\"true\" stored=\"true\" multiValued=\"false\"/>
42
- </fields>
43
- <uniqueKey>_yz_id</uniqueKey>
44
- <types>
45
- <fieldType name=\"_yz_str\" class=\"solr.StrField\" sortMissingLast=\"true\" />
46
- </types>
47
- </schema>
48
- XML
49
- end
1
+ require 'spec_helper'
2
+ require 'riak'
3
+
4
+ describe "Yokozuna", test_client: true, integration: true do
5
+ before(:all) do
6
+ @client = test_client
7
+
8
+ @index = 'yz_spec-' + random_key
9
+ @schema = 'yz_spec-' + random_key
10
+ end
11
+
12
+ context 'with no schema' do
13
+ it 'allows schema creation' do
14
+ @client.create_search_schema(@schema, SCHEMA_CONTENT)
15
+ wait_until{ !@client.get_search_schema(@schema).nil? }
16
+ expect(@client.get_search_schema(@schema)).not_to be_nil
17
+ end
18
+ end
19
+ context 'with a schema' do
20
+ it 'has a readable schema' do
21
+ @client.create_search_schema(@schema, SCHEMA_CONTENT)
22
+ wait_until{ !@client.get_search_schema(@schema).nil? }
23
+ schema_resp = @client.get_search_schema(@schema)
24
+ expect(schema_resp.name).to eq(@schema)
25
+ expect(schema_resp.content).to eq(SCHEMA_CONTENT)
26
+ end
27
+ end
28
+
29
+ SCHEMA_CONTENT = <<-XML
30
+ <?xml version=\"1.0\" encoding=\"UTF-8\" ?>
31
+ <schema name=\"#{@index}\" version=\"1.5\">
32
+ <fields>
33
+ <field name=\"_yz_id\" type=\"_yz_str\" indexed=\"true\" stored=\"true\" multiValued=\"false\" required=\"true\" />
34
+ <field name=\"_yz_ed\" type=\"_yz_str\" indexed=\"true\" stored=\"true\" multiValued=\"false\"/>
35
+ <field name=\"_yz_pn\" type=\"_yz_str\" indexed=\"true\" stored=\"true\" multiValued=\"false\"/>
36
+ <field name=\"_yz_fpn\" type=\"_yz_str\" indexed=\"true\" stored=\"true\" multiValued=\"false\"/>
37
+ <field name=\"_yz_vtag\" type=\"_yz_str\" indexed=\"true\" stored=\"true\" multiValued=\"false\"/>
38
+ <field name=\"_yz_rk\" type=\"_yz_str\" indexed=\"true\" stored=\"true\" multiValued=\"false\"/>
39
+ <field name=\"_yz_rb\" type=\"_yz_str\" indexed=\"true\" stored=\"true\" multiValued=\"false\"/>
40
+ <field name=\"_yz_rt\" type=\"_yz_str\" indexed=\"true\" stored=\"true\" multiValued=\"false\"/>
41
+ <field name=\"_yz_err\" type=\"_yz_str\" indexed=\"true\" stored=\"true\" multiValued=\"false\"/>
42
+ </fields>
43
+ <uniqueKey>_yz_id</uniqueKey>
44
+ <types>
45
+ <fieldType name=\"_yz_str\" class=\"solr.StrField\" sortMissingLast=\"true\" />
46
+ </types>
47
+ </schema>
48
+ XML
49
+ end
@@ -61,6 +61,28 @@ describe Riak::Client::BeefcakeProtobuffsBackend::CrdtOperator do
61
61
  end
62
62
  end
63
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
+
64
86
  describe 'operating on a map' do
65
87
  it 'serializes inner counter operations' do
66
88
  counter_op = Riak::Crdt::Operation::Update.new.tap do |op|
@@ -1,15 +1,15 @@
1
-
2
- describe Riak do
3
- require 'riak/core_ext/to_param'
4
-
5
- it "converts params correctly" do
6
- expect({ :name => 'David', :nationality => 'Danish' }.to_param).to eq("name=David&nationality=Danish")
7
- end
8
-
9
- # Based on the activesupport implementation.
10
- # https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/object/to_param.rb
11
- it "converts namespaced params correctly" do
12
- expect({ :name => 'David', :nationality => 'Danish' }.to_param('user')).to eq("user%5Bname%5D=David&user%5Bnationality%5D=Danish")
13
- end
14
-
15
- end
1
+
2
+ describe Riak do
3
+ require 'riak/core_ext/to_param'
4
+
5
+ it "converts params correctly" do
6
+ expect({ :name => 'David', :nationality => 'Danish' }.to_param).to eq("name=David&nationality=Danish")
7
+ end
8
+
9
+ # Based on the activesupport implementation.
10
+ # https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/object/to_param.rb
11
+ it "converts namespaced params correctly" do
12
+ expect({ :name => 'David', :nationality => 'Danish' }.to_param('user')).to eq("user%5Bname%5D=David&user%5Bnationality%5D=Danish")
13
+ end
14
+
15
+ end
@@ -0,0 +1,56 @@
1
+ require 'spec_helper'
2
+ require_relative 'shared_examples'
3
+
4
+ describe Riak::Crdt::HyperLogLog, hll: true 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 bucket-type' do
14
+ expect{described_class.new bucket, 'key', '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 'HyperLogLog CRDT'
35
+
36
+ it 'batches properly' do
37
+ expect(operator).
38
+ to receive(:operate) { |bucket, key, type, operations|
39
+ expect(bucket).to eq bucket
40
+ expect(key).to eq 'key'
41
+ expect(type).to eq subject.bucket_type
42
+
43
+ expect(operations).to be_a Riak::Crdt::Operation::Update
44
+ expect(operations.value).to eq({add: %w{alpha bravo}})
45
+ }.
46
+ and_return(response)
47
+
48
+ subject.instance_variable_set :@context, 'placeholder'
49
+
50
+ subject.batch do |s|
51
+ s.add 'alpha'
52
+ s.add 'bravo'
53
+ end
54
+ end
55
+ end
56
+ end
@@ -1,21 +1,21 @@
1
- require 'spec_helper'
2
- require_relative 'shared_examples'
3
-
4
- describe Riak::Crdt::InnerCounter do
5
- let(:parent){ double 'parent' }
6
- let(:counter_name){ 'counter name' }
7
- subject do
8
- described_class.new(parent, 0).tap do |c|
9
- c.name = counter_name
10
- end
11
- end
12
-
13
- include_examples 'Counter CRDT'
14
-
15
- it 'sends increments to the parent' do
16
- expect(parent).to receive(:increment).
17
- with(counter_name, 1)
18
-
19
- subject.increment
20
- end
21
- end
1
+ require 'spec_helper'
2
+ require_relative 'shared_examples'
3
+
4
+ describe Riak::Crdt::InnerCounter do
5
+ let(:parent){ double 'parent' }
6
+ let(:counter_name){ 'counter name' }
7
+ subject do
8
+ described_class.new(parent, 0).tap do |c|
9
+ c.name = counter_name
10
+ end
11
+ end
12
+
13
+ include_examples 'Counter CRDT'
14
+
15
+ it 'sends increments to the parent' do
16
+ expect(parent).to receive(:increment).
17
+ with(counter_name, 1)
18
+
19
+ subject.increment
20
+ end
21
+ end
@@ -1,33 +1,33 @@
1
- require 'spec_helper'
2
- require_relative 'shared_examples'
3
-
4
- describe Riak::Crdt::InnerSet do
5
- let(:parent){ double 'parent' }
6
- let(:set_name){ 'set name' }
7
- subject do
8
- described_class.new(parent, []).tap do |s|
9
- s.name = set_name
10
- end
11
- end
12
-
13
- include_examples 'Set CRDT'
14
-
15
- it 'sends additions to the parent' do
16
- expect(parent).to receive(:operate) do |name, op|
17
- expect(name).to eq set_name
18
- expect(op.type).to eq :set
19
- expect(op.value).to eq add: 'el'
20
- end
21
-
22
- subject.add 'el'
23
-
24
- expect(parent).to receive(:operate) do |name, op|
25
- expect(name).to eq set_name
26
- expect(op.type).to eq :set
27
- expect(op.value).to eq remove: 'el2'
28
- end
29
- allow(parent).to receive(:context?).and_return(true)
30
-
31
- subject.remove 'el2'
32
- end
33
- end
1
+ require 'spec_helper'
2
+ require_relative 'shared_examples'
3
+
4
+ describe Riak::Crdt::InnerSet do
5
+ let(:parent){ double 'parent' }
6
+ let(:set_name){ 'set name' }
7
+ subject do
8
+ described_class.new(parent, []).tap do |s|
9
+ s.name = set_name
10
+ end
11
+ end
12
+
13
+ include_examples 'Set CRDT'
14
+
15
+ it 'sends additions to the parent' do
16
+ expect(parent).to receive(:operate) do |name, op|
17
+ expect(name).to eq set_name
18
+ expect(op.type).to eq :set
19
+ expect(op.value).to eq add: 'el'
20
+ end
21
+
22
+ subject.add 'el'
23
+
24
+ expect(parent).to receive(:operate) do |name, op|
25
+ expect(name).to eq set_name
26
+ expect(op.type).to eq :set
27
+ expect(op.value).to eq remove: 'el2'
28
+ end
29
+ allow(parent).to receive(:context?).and_return(true)
30
+
31
+ subject.remove 'el2'
32
+ end
33
+ end
@@ -1,61 +1,61 @@
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
+ 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