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
@@ -1,61 +0,0 @@
|
|
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 "without any indexes" do
|
13
|
-
it "allows index creation" do
|
14
|
-
expect(@client.create_search_index(@index, "_yz_default", 3)).to eq(true)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
context "with an index" do
|
19
|
-
before :all do
|
20
|
-
expect(@client.create_search_index(@index)).to eq(true)
|
21
|
-
wait_until{ !@client.get_search_index(@index).nil? }
|
22
|
-
end
|
23
|
-
|
24
|
-
it "allows index inspection" do
|
25
|
-
expect(@client.get_search_index(@index).name).to eq(@index)
|
26
|
-
expect{ @client.get_search_index("herp_derp") }.to raise_error(Riak::ProtobuffsFailedRequest)
|
27
|
-
end
|
28
|
-
|
29
|
-
it "has an index list" do
|
30
|
-
expect(@client.list_search_indexes.size).to be >= 1
|
31
|
-
end
|
32
|
-
|
33
|
-
it "associates a bucket with an index" do
|
34
|
-
@bucket = Riak::Bucket.new(@client, @index)
|
35
|
-
@bucket.props = {'search_index' => @index}
|
36
|
-
@bucket = @client.bucket(@index)
|
37
|
-
expect(@bucket.props).to include('search_index' => @index)
|
38
|
-
end
|
39
|
-
|
40
|
-
context "associated with a bucket" do
|
41
|
-
before :all do
|
42
|
-
@bucket = Riak::Bucket.new(@client, @index)
|
43
|
-
@bucket.props = {'search_index' => @index}
|
44
|
-
@bucket = @client.bucket(@index)
|
45
|
-
expect(@bucket.props).to include('search_index' => @index)
|
46
|
-
end
|
47
|
-
|
48
|
-
it "indexes on object writes" do
|
49
|
-
object = @bucket.get_or_new("cat")
|
50
|
-
object.raw_data = {"cat_s"=>"Lela"}.to_json
|
51
|
-
object.content_type = 'application/json'
|
52
|
-
object.store
|
53
|
-
sleep 2.1 # pause for index commit to trigger
|
54
|
-
|
55
|
-
resp = @client.search(@index, "cat_s:Lela")
|
56
|
-
expect(resp).to include('docs')
|
57
|
-
expect(resp['docs'].size).to eq(1)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
@@ -1,115 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'riak'
|
4
|
-
|
5
|
-
describe "Yokozuna queries", test_client: true, integration: true do
|
6
|
-
before :all do
|
7
|
-
@client = test_client
|
8
|
-
end
|
9
|
-
|
10
|
-
context "with a schema and indexes" do
|
11
|
-
before :all do
|
12
|
-
@bucket = random_bucket 'yz-spec'
|
13
|
-
@index = @bucket.name
|
14
|
-
|
15
|
-
expect(@client.create_search_index(@index)).to eq(true)
|
16
|
-
wait_until{ !@client.get_search_index(@index).nil? }
|
17
|
-
@client.set_bucket_props(@bucket, {:search_index => @index}, 'yokozuna')
|
18
|
-
|
19
|
-
wait_until do
|
20
|
-
props = @client.get_bucket_props(@bucket, type: 'yokozuna')
|
21
|
-
props['search_index'] == @index
|
22
|
-
end
|
23
|
-
|
24
|
-
@o1 = build_json_obj(@bucket, "cat", {"cat_s"=>"Lela"})
|
25
|
-
@o2 = build_json_obj(@bucket, "docs", {"dog_ss"=>%w(Einstein Olive)})
|
26
|
-
build_json_obj(@bucket, "Z", {"username_s"=>"Z", "name_s"=>"ryan", "age_i"=>30})
|
27
|
-
build_json_obj(@bucket, "R", {"username_s"=>"R", "name_s"=>"eric", "age_i"=>34})
|
28
|
-
build_json_obj(@bucket, "F", {"username_s"=>"F", "name_s"=>"bryan fink", "age_i"=>32})
|
29
|
-
build_json_obj(@bucket, "H", {"username_s"=>"H", "name_s"=>"brett", "age_i"=>14})
|
30
|
-
|
31
|
-
wait_until { @client.search(@index, "username_s:Z")['docs'].length > 0 }
|
32
|
-
end
|
33
|
-
|
34
|
-
it "produces results on single term queries" do
|
35
|
-
resp = @client.search(@index, "username_s:Z")
|
36
|
-
expect(resp).to include('docs')
|
37
|
-
expect(resp['docs'].size).to eq(1)
|
38
|
-
end
|
39
|
-
|
40
|
-
it "produces results on multiple term queries" do
|
41
|
-
resp = @client.search(@index, "username_s:(F OR H)")
|
42
|
-
expect(resp).to include('docs')
|
43
|
-
expect(resp['docs'].size).to eq(2)
|
44
|
-
end
|
45
|
-
|
46
|
-
it "produces results on queries with boolean logic" do
|
47
|
-
resp = @client.search(@index, "username_s:Z AND name_s:ryan")
|
48
|
-
expect(resp).to include('docs')
|
49
|
-
expect(resp['docs'].size).to eq(1)
|
50
|
-
end
|
51
|
-
|
52
|
-
it "produces results on range queries" do
|
53
|
-
resp = @client.search(@index, "age_i:[30 TO 33]")
|
54
|
-
expect(resp).to include('docs')
|
55
|
-
expect(resp['docs'].size).to eq(2)
|
56
|
-
end
|
57
|
-
|
58
|
-
it "produces results on phrase queries" do
|
59
|
-
resp = @client.search(@index, 'name_s:"bryan fink"')
|
60
|
-
expect(resp).to include('docs')
|
61
|
-
expect(resp['docs'].size).to eq(1)
|
62
|
-
end
|
63
|
-
|
64
|
-
it "produces results on wildcard queries" do
|
65
|
-
resp = @client.search(@index, "name_s:*ryan*")
|
66
|
-
expect(resp).to include('docs')
|
67
|
-
expect(resp['docs'].size).to eq(2)
|
68
|
-
end
|
69
|
-
|
70
|
-
it "produces results on regexp queries" do
|
71
|
-
resp = @client.search(@index, "name_s:/br.*/")
|
72
|
-
expect(resp).to include('docs')
|
73
|
-
expect(resp['docs'].size).to eq(2)
|
74
|
-
end
|
75
|
-
|
76
|
-
it "supports utf8" do
|
77
|
-
build_json_obj(@bucket, "ja", {"text_ja"=>"私はハイビスカスを食べるのが 大好き"})
|
78
|
-
sleep 2.1 # pause for index commit to trigger
|
79
|
-
resp = @client.search(@index, "text_ja:大好き")
|
80
|
-
expect(resp).to include('docs')
|
81
|
-
expect(resp['docs'].size).to eq 1
|
82
|
-
end
|
83
|
-
|
84
|
-
context "using parameters" do
|
85
|
-
it "searches one row" do
|
86
|
-
resp = @client.search(@index, "*:*", {:rows => 1})
|
87
|
-
expect(resp).to include('docs')
|
88
|
-
expect(resp['docs'].size).to eq(1)
|
89
|
-
end
|
90
|
-
|
91
|
-
it "searches with df" do
|
92
|
-
resp = @client.search(@index, "Olive", {:rows => 1, :df => 'dog_ss'})
|
93
|
-
expect(resp).to include('docs')
|
94
|
-
expect(resp['docs'].size).to eq(1)
|
95
|
-
resp['docs'].first['dog_ss']
|
96
|
-
end
|
97
|
-
|
98
|
-
it "produces top result on sort" do
|
99
|
-
resp = @client.search(@index, "username_s:*", {:sort => "age_i asc"})
|
100
|
-
expect(resp).to include('docs')
|
101
|
-
expect(resp['docs'].first['age_i'].to_i).to eq(14)
|
102
|
-
end
|
103
|
-
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
# populate objects
|
108
|
-
def build_json_obj(bucket, key, data)
|
109
|
-
object = bucket.get_or_new(key)
|
110
|
-
object.raw_data = data.to_json
|
111
|
-
object.content_type = 'application/json'
|
112
|
-
object.store type: 'yokozuna'
|
113
|
-
object
|
114
|
-
end
|
115
|
-
end
|
@@ -1,49 +0,0 @@
|
|
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,247 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
Riak::Client::BeefcakeProtobuffsBackend.configured?
|
3
|
-
|
4
|
-
describe Riak::Client::BeefcakeProtobuffsBackend::BucketPropertiesOperator do
|
5
|
-
let(:backend_class){ Riak::Client::BeefcakeProtobuffsBackend }
|
6
|
-
let(:backend) { instance_double('Riak::Client::BeefcakeProtobuffsBackend') }
|
7
|
-
|
8
|
-
let(:protocol) do
|
9
|
-
instance_double('Riak::Client::BeefcakeProtobuffsBackend::Protocol').
|
10
|
-
tap do |p|
|
11
|
-
allow(backend).to receive(:protocol).and_yield(p)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
let(:bucket_name){ 'bucket_name' }
|
16
|
-
let(:bucket) do
|
17
|
-
instance_double('Riak::Bucket').tap do |b|
|
18
|
-
allow(b).to receive(:name).and_return(bucket_name)
|
19
|
-
allow(b).to receive(:is_a?).with(Riak::Bucket).and_return(true)
|
20
|
-
allow(b).to receive(:needs_type?).and_return(false)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
let(:test_props) do
|
25
|
-
backend_class::RpbBucketProps.
|
26
|
-
new(
|
27
|
-
n_val: 3,
|
28
|
-
pr: 0xffffffff - 1,
|
29
|
-
r: 0xffffffff - 2,
|
30
|
-
w: 0xffffffff - 3,
|
31
|
-
pw: 0xffffffff - 4,
|
32
|
-
dw: 0,
|
33
|
-
rw: 1,
|
34
|
-
precommit: precommit,
|
35
|
-
postcommit: backend_class::RpbCommitHook.new(name: 'piper'),
|
36
|
-
linkfun: backend_class::RpbModFun.new(module: 'nachos',
|
37
|
-
function: 'galacticos')
|
38
|
-
)
|
39
|
-
end
|
40
|
-
|
41
|
-
let(:precommit) do
|
42
|
-
backend_class::RpbCommitHook.
|
43
|
-
new(
|
44
|
-
modfun: backend_class::RpbModFun.new(
|
45
|
-
module: 'validate_json',
|
46
|
-
function: 'validate'
|
47
|
-
))
|
48
|
-
end
|
49
|
-
|
50
|
-
let(:get_bucket_request) do
|
51
|
-
backend_class::RpbGetBucketReq.new bucket: bucket_name
|
52
|
-
end
|
53
|
-
|
54
|
-
let(:get_bucket_response) do
|
55
|
-
backend_class::RpbGetBucketResp.
|
56
|
-
new(props: test_props)
|
57
|
-
end
|
58
|
-
|
59
|
-
let(:get_bucket_expectation) do
|
60
|
-
expect(protocol).to receive(:write).
|
61
|
-
with(:GetBucketReq, get_bucket_request)
|
62
|
-
|
63
|
-
expect(protocol).to receive(:expect).
|
64
|
-
with(:GetBucketResp,
|
65
|
-
backend_class::RpbGetBucketResp).
|
66
|
-
and_return(get_bucket_response)
|
67
|
-
end
|
68
|
-
|
69
|
-
subject{ described_class.new backend }
|
70
|
-
|
71
|
-
it 'is initialized with a backend' do
|
72
|
-
expect{ described_class.new backend }.to_not raise_error
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'passes through scalar properties' do
|
76
|
-
get_bucket_expectation
|
77
|
-
|
78
|
-
resp = nil
|
79
|
-
expect{ resp = subject.get bucket }.to_not raise_error
|
80
|
-
|
81
|
-
expect(resp['n_val']).to eq 3
|
82
|
-
end
|
83
|
-
|
84
|
-
describe 'quorums' do
|
85
|
-
it 'rubyfies' do
|
86
|
-
get_bucket_expectation
|
87
|
-
|
88
|
-
resp = nil
|
89
|
-
expect{ resp = subject.get bucket }.to_not raise_error
|
90
|
-
|
91
|
-
expect(resp['pr']).to eq 'one'
|
92
|
-
expect(resp['r']).to eq 'quorum'
|
93
|
-
expect(resp['w']).to eq 'all'
|
94
|
-
expect(resp['pw']).to eq 'default'
|
95
|
-
expect(resp['dw']).to eq 0
|
96
|
-
expect(resp['rw']).to eq 1
|
97
|
-
end
|
98
|
-
|
99
|
-
it 'riakifies' do
|
100
|
-
expected_props = backend_class::RpbBucketProps.
|
101
|
-
new(
|
102
|
-
pr: 0xffffffff - 1,
|
103
|
-
r: 0xffffffff - 2,
|
104
|
-
w: 0xffffffff - 3,
|
105
|
-
pw: 0xffffffff - 4,
|
106
|
-
dw: 0,
|
107
|
-
rw: 1
|
108
|
-
)
|
109
|
-
|
110
|
-
set_bucket_request = backend_class::RpbSetBucketReq.new
|
111
|
-
set_bucket_request.bucket = bucket_name
|
112
|
-
set_bucket_request.props = expected_props
|
113
|
-
|
114
|
-
expect(protocol).to receive(:write).
|
115
|
-
with(:SetBucketReq, set_bucket_request)
|
116
|
-
|
117
|
-
expect(protocol).to receive(:expect).
|
118
|
-
with(:SetBucketResp)
|
119
|
-
|
120
|
-
# support both strings and symbols for quorum names
|
121
|
-
write_props = {
|
122
|
-
pr: 'one',
|
123
|
-
r: :quorum,
|
124
|
-
w: 'all',
|
125
|
-
pw: :default,
|
126
|
-
dw: 0,
|
127
|
-
rw: 1
|
128
|
-
}
|
129
|
-
|
130
|
-
expect{ subject.put bucket, write_props }.to_not raise_error
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
describe 'commit hooks' do
|
135
|
-
it 'rubyfies' do
|
136
|
-
expect(protocol).to receive(:write).
|
137
|
-
with(:GetBucketReq, get_bucket_request)
|
138
|
-
|
139
|
-
expect(protocol).to receive(:expect).
|
140
|
-
with(:GetBucketResp,
|
141
|
-
backend_class::RpbGetBucketResp).
|
142
|
-
and_return(get_bucket_response)
|
143
|
-
|
144
|
-
resp = nil
|
145
|
-
expect{ resp = subject.get bucket }.to_not raise_error
|
146
|
-
|
147
|
-
expect(resp['precommit']).to be_an Array
|
148
|
-
expect(pre = resp['precommit'].first).to be_a Hash
|
149
|
-
expect(pre['mod']).to eq 'validate_json'
|
150
|
-
expect(pre['fun']).to eq 'validate'
|
151
|
-
|
152
|
-
expect(resp['postcommit'].first).to eq 'piper'
|
153
|
-
end
|
154
|
-
|
155
|
-
it 'riakifies' do
|
156
|
-
modfun = backend_class::RpbModFun.new(
|
157
|
-
module: 'validate_json',
|
158
|
-
function: 'validate'
|
159
|
-
)
|
160
|
-
expected_props = backend_class::RpbBucketProps.
|
161
|
-
new(
|
162
|
-
precommit: [backend_class::RpbCommitHook.
|
163
|
-
new(modfun: modfun)],
|
164
|
-
postcommit: [backend_class::RpbCommitHook.
|
165
|
-
new(name: 'piper')]
|
166
|
-
)
|
167
|
-
|
168
|
-
set_bucket_request = backend_class::RpbSetBucketReq.new
|
169
|
-
set_bucket_request.bucket = bucket_name
|
170
|
-
set_bucket_request.props = expected_props
|
171
|
-
|
172
|
-
expect(protocol).to receive(:write).
|
173
|
-
with(:SetBucketReq, set_bucket_request)
|
174
|
-
|
175
|
-
expect(protocol).to receive(:expect).
|
176
|
-
with(:SetBucketResp)
|
177
|
-
|
178
|
-
write_props = {
|
179
|
-
precommit: { mod: 'validate_json', fun: 'validate' },
|
180
|
-
postcommit: ['piper']
|
181
|
-
}
|
182
|
-
|
183
|
-
expect{ subject.put bucket, write_props }.to_not raise_error
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
describe 'modfuns' do
|
188
|
-
it 'rubyfies' do
|
189
|
-
get_bucket_expectation
|
190
|
-
|
191
|
-
resp = nil
|
192
|
-
expect{ resp = subject.get bucket }.to_not raise_error
|
193
|
-
|
194
|
-
expect(resp['linkfun']).to eq({
|
195
|
-
'mod' => 'nachos',
|
196
|
-
'fun' => 'galacticos'
|
197
|
-
})
|
198
|
-
|
199
|
-
expect(resp['chash_keyfun']).to_not be
|
200
|
-
end
|
201
|
-
|
202
|
-
it 'riakifies' do
|
203
|
-
expected_props = backend_class::RpbBucketProps.
|
204
|
-
new(
|
205
|
-
linkfun: backend_class::RpbModFun.new(module: 'nachos',
|
206
|
-
function: 'galacticos')
|
207
|
-
)
|
208
|
-
|
209
|
-
set_bucket_request = backend_class::RpbSetBucketReq.new
|
210
|
-
set_bucket_request.bucket = bucket_name
|
211
|
-
set_bucket_request.props = expected_props
|
212
|
-
|
213
|
-
expect(protocol).to receive(:write).
|
214
|
-
with(:SetBucketReq, set_bucket_request)
|
215
|
-
|
216
|
-
expect(protocol).to receive(:expect).
|
217
|
-
with(:SetBucketResp)
|
218
|
-
|
219
|
-
write_props = {
|
220
|
-
linkfun: { mod: 'nachos', fun: 'galacticos' }
|
221
|
-
}
|
222
|
-
|
223
|
-
expect{ subject.put bucket, write_props }.to_not raise_error
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
describe 'repl modes' do
|
228
|
-
it 'riakifies symbols' do
|
229
|
-
expected_props = backend_class::RpbBucketProps.
|
230
|
-
new(repl: 2)
|
231
|
-
|
232
|
-
set_bucket_request = backend_class::RpbSetBucketReq.new
|
233
|
-
set_bucket_request.bucket = bucket_name
|
234
|
-
set_bucket_request.props = expected_props
|
235
|
-
|
236
|
-
expect(protocol).to receive(:write).
|
237
|
-
with(:SetBucketReq, set_bucket_request)
|
238
|
-
|
239
|
-
expect(protocol).to receive(:expect).
|
240
|
-
with(:SetBucketResp)
|
241
|
-
|
242
|
-
write_props = { repl: :fullsync }
|
243
|
-
|
244
|
-
expect{ subject.put bucket, write_props }.to_not raise_error
|
245
|
-
end
|
246
|
-
end
|
247
|
-
end
|