riak-client 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,63 +0,0 @@
1
- require 'spec_helper'
2
- require 'riak'
3
-
4
- describe 'CRDT map validation', integration: true, test_client: true do
5
- let(:bucket){ random_bucket 'crdt_validation' }
6
- let(:map){ Riak::Crdt::Map.new bucket, random_key }
7
-
8
- it 'deletes sets and re-add entries' do
9
- map.batch do |m|
10
- m.sets['set'].add 'X'
11
- m.sets['set'].add 'Y'
12
- end
13
-
14
- map.reload
15
- expect(map.sets['set'].include? 'Y').to be
16
-
17
- expect do
18
- map.batch do |m|
19
- m.sets.delete 'set'
20
- m.sets['set'].add 'Z'
21
- end
22
- end.to_not raise_error
23
-
24
- map2 = Riak::Crdt::Map.new bucket, map.key
25
-
26
- expect(map2.sets['set'].members).to eq ::Set.new(['Z'])
27
- end
28
-
29
- it 'deletes counters and increments counters' do
30
- map.counters['counter'].increment 5
31
-
32
- map.reload
33
-
34
- expect(map.counters['counter'].value).to eq 5
35
-
36
- map.batch do |m|
37
- m.counters['counter'].increment 2
38
- m.counters.delete 'counter'
39
- end
40
-
41
- map2 = Riak::Crdt::Map.new bucket, map.key
42
-
43
- expect(map2.counters['counter'].value).to eq(7).or eq(2)
44
- end
45
-
46
- it 'deletes maps containing sets and re-adds the contained sets' do
47
- map.batch do |m|
48
- m.maps['map'].sets['set'].add "X"
49
- m.maps['map'].sets['set'].add "Y"
50
- end
51
-
52
- map.reload
53
- expect(map.maps['map'].sets['set'].members).to eq ::Set.new(%w(X Y))
54
-
55
- map.batch do |m|
56
- m.maps.delete 'map'
57
- m.maps['map'].sets['set'].add "Z"
58
- end
59
-
60
- map2 = Riak::Crdt::Map.new bucket, map.key
61
- expect(map2.maps['map'].sets['set'].members).to eq ::Set.new(['Z'])
62
- end
63
- end
@@ -1,122 +0,0 @@
1
- require 'spec_helper'
2
- require 'riak'
3
-
4
- describe 'CRDT set validation', integration: true, test_client: true do
5
- let(:bucket){ random_bucket 'crdt_validation' }
6
- let(:set){ Riak::Crdt::Set.new bucket, random_key }
7
-
8
- it 'removes recently-added set entries during batch mode' do
9
- expect do
10
- set.batch do |s|
11
- s.add 'X'
12
- s.add 'Y'
13
- s.add 'Z'
14
- s.remove 'Y'
15
- end
16
- end.to raise_error Riak::CrdtError::SetRemovalWithoutContextError
17
- end
18
-
19
- it 'removes non-members with context' do
20
- set.batch do |s|
21
- s.add 'X'
22
- s.add 'Y'
23
- end
24
-
25
- set.reload
26
-
27
- expect{ set.remove 'bogus' }.to_not raise_error
28
-
29
- set2 = Riak::Crdt::Set.new bucket, set.key
30
- expect(set2.members).to eq ::Set.new(%w{X Y})
31
- end
32
-
33
- it 'adds duplicate members' do
34
- set.batch do |s|
35
- s.add 'X'
36
- s.add 'Y'
37
- end
38
-
39
- set.reload
40
-
41
- expect{ set.add 'X' }.to_not raise_error
42
-
43
- set2 = Riak::Crdt::Set.new bucket, set.key
44
- expect(set2.members).to eq ::Set.new(%w{X Y})
45
- end
46
-
47
- it 'no-ops adding then removing a duplicate member' do
48
- set.batch do |s|
49
- s.add 'X'
50
- s.add 'Y'
51
- end
52
-
53
- set.reload
54
- expect(set.members).to eq ::Set.new(%w{X Y})
55
-
56
- expect do
57
- set.batch do |s|
58
- s.add 'X'
59
- s.remove 'X'
60
- end
61
- end.to_not raise_error
62
-
63
- set2 = Riak::Crdt::Set.new bucket, set.key
64
- expect(set2.members).to eq ::Set.new(%w{X Y})
65
- end
66
-
67
- it 'no-ops removing then re-adding a set member' do
68
- set.batch do |s|
69
- s.add 'X'
70
- s.add 'Y'
71
- end
72
-
73
- set.reload
74
- expect(set.members).to eq ::Set.new(%w{X Y})
75
-
76
- expect do
77
- set.batch do |s|
78
- s.remove 'X'
79
- s.add 'X'
80
- end
81
- end.to_not raise_error
82
-
83
- set2 = Riak::Crdt::Set.new bucket, set.key
84
- expect(set2.members).to eq ::Set.new(%w{X Y})
85
- end
86
-
87
- describe 'parallel operations' do
88
- it 'removes with up-to-date context' do
89
- set.batch do |s|
90
- s.add 'X'
91
- s.add 'Y'
92
- end
93
-
94
- set_parallel = Riak::Crdt::Set.new bucket, set.key
95
- set_parallel.add 'Z'
96
-
97
- set.reload
98
-
99
- expect{ set.remove 'Z' }.to_not raise_error
100
-
101
- set2 = Riak::Crdt::Set.new bucket, set.key
102
- expect(set2.members).to eq ::Set.new(%w{X Y})
103
- end
104
-
105
- it "doesn't remove with outdated context" do
106
- set.batch do |s|
107
- s.add 'X'
108
- s.add 'Y'
109
- end
110
-
111
- set.reload
112
-
113
- set_parallel = Riak::Crdt::Set.new bucket, set.key
114
- set_parallel.add 'Z'
115
-
116
- expect{ set.remove 'Z' }.to_not raise_error
117
-
118
- set2 = Riak::Crdt::Set.new bucket, set.key
119
- expect(set2.members).to eq ::Set.new(%w{X Y Z})
120
- end
121
- end
122
- end
@@ -1,122 +0,0 @@
1
- # coding: utf-8
2
- require 'spec_helper'
3
- require 'riak'
4
- require 'riak/util/string'
5
-
6
- describe 'Encoding and CRDTs', integration: true, search_config: true do
7
- shared_examples 'CRDTs with weird names' do
8
- let(:counter_bucket) do
9
- test_client.bucket_type(Riak::Crdt::DEFAULT_BUCKET_TYPES[:counter]).bucket(random_string)
10
- end
11
- let(:map_bucket) do
12
- test_client.bucket_type(Riak::Crdt::DEFAULT_BUCKET_TYPES[:map]).bucket(random_string)
13
- end
14
- let(:set_bucket) do
15
- test_client.bucket_type(Riak::Crdt::DEFAULT_BUCKET_TYPES[:set]).bucket(random_string)
16
- end
17
- let(:hll_bucket) do
18
- test_client.bucket_type(Riak::Crdt::DEFAULT_BUCKET_TYPES[:hll]).bucket(random_string)
19
- end
20
-
21
- it 'creates counters' do
22
- counter = nil
23
-
24
- expect{ counter = Riak::Crdt::Counter.new counter_bucket, random_string }.
25
- to_not raise_error
26
-
27
- expect(counter).to be_a Riak::Crdt::Counter
28
-
29
- expect(value = counter.value).to be_a Numeric
30
-
31
- expect{ counter.increment }.to_not raise_error
32
-
33
- expect(counter.value).to eq value + 1
34
- end
35
-
36
- it 'updates registers in maps' do
37
- map = nil
38
-
39
- expect(random_string.encoding.name).to eq expected_encoding
40
-
41
- expect{ map = Riak::Crdt::Map.new map_bucket, random_string }.
42
- to_not raise_error
43
-
44
- expect(map).to be_a Riak::Crdt::Map
45
-
46
- expect(map.registers[random_string]).to be_nil
47
-
48
- expect{ map.registers[random_string] = random_string }.
49
- to_not raise_error
50
-
51
- expect(map.registers.length).to eq 1
52
-
53
- expect(map.registers[random_string]).to_not be_nil
54
-
55
- expect(Riak::Util::String.equal_bytes?(map.registers[random_string], random_string)).to be
56
-
57
- expect(random_string.encoding.name).to eq expected_encoding
58
- end
59
-
60
- it 'updates sets' do
61
- set = nil
62
-
63
- expect(random_string.encoding.name).to eq expected_encoding
64
-
65
- expect{ set = Riak::Crdt::Set.new set_bucket, random_string }.
66
- to_not raise_error
67
-
68
- expect(set).to be_a Riak::Crdt::Set
69
-
70
- expect(set.include?(random_string)).to_not be
71
-
72
- set.add random_string
73
-
74
- expect(set.include?(random_string)).to be
75
-
76
- set.remove random_string
77
-
78
- expect(set.include?(random_string)).to_not be
79
-
80
- expect(random_string.encoding.name).to eq expected_encoding
81
- end
82
-
83
- it 'updates hyper_log_logs', hll: true do
84
- begin
85
- hlls = test_client.bucket_type Riak::Crdt::DEFAULT_BUCKET_TYPES[:hll]
86
- hlls.properties
87
- rescue Riak::ProtobuffsErrorResponse
88
- skip('HyperLogLog bucket-type not found or active.')
89
- end
90
-
91
- hll = nil
92
-
93
- expect(random_string.encoding.name).to eq expected_encoding
94
-
95
- expect{ hll = Riak::Crdt::HyperLogLog.new hll_bucket, random_string }.to_not raise_error
96
- expect(hll).to be_a Riak::Crdt::HyperLogLog
97
-
98
- hll.add random_string
99
-
100
- expect(hll.value).to be_a(Integer)
101
- expect(hll.value).to eq 1
102
-
103
- expect(random_string.encoding.name).to eq expected_encoding
104
- end
105
- end
106
-
107
- describe 'with utf-8 strings' do
108
- let(:string){ "\xF0\x9F\x9A\xB4こんにちはสวัสดี" }
109
- let(:expected_encoding){ 'UTF-8' }
110
- let(:random_string){ string + random_key }
111
-
112
- include_examples 'CRDTs with weird names'
113
- end
114
-
115
- describe 'with binary strings' do
116
- let(:string){ "\xff\xff".force_encoding('binary') }
117
- let(:expected_encoding){ 'ASCII-8BIT' }
118
- let(:random_string){ string + random_key }
119
-
120
- include_examples 'CRDTs with weird names'
121
- end
122
- end
@@ -1,87 +0,0 @@
1
- # coding: utf-8
2
- require 'spec_helper'
3
- require 'riak'
4
-
5
- describe 'Encoding and Riak KV', integration: true, test_client: true do
6
- let(:bucket_type){ test_client.bucket_type 'yokozuna' }
7
-
8
- let(:utf8_encoding){ Encoding.find 'utf-8' }
9
- let(:utf8_string){ "\xF0\x9F\x9A\xB4こんにちはสวัสดี" }
10
- let(:random_utf8_string){ utf8_string + random_key }
11
- let(:utf8_bucket){ bucket_type.bucket random_utf8_string }
12
-
13
- let(:binary_encoding){ Encoding.find 'binary' }
14
- let(:binary_string){ "\xff\xff".force_encoding('binary') }
15
- let(:random_binary_string){ binary_string + random_key }
16
- let(:binary_bucket){ bucket_type.bucket random_binary_string }
17
-
18
- it 'encodes the test strings correctly' do
19
- expect(utf8_string.encoding).to eq utf8_encoding
20
- expect(random_utf8_string.encoding).to eq utf8_encoding
21
- expect(binary_string.encoding).to eq binary_encoding
22
- expect(random_binary_string.encoding).to eq binary_encoding
23
- end
24
-
25
- describe 'key-value operations' do
26
- it 'allows utf-8 strings in bucket and key names, values, and 2i' do
27
- expect(utf8_bucket).to be_a Riak::Bucket
28
- expect(robj = utf8_bucket.new(random_utf8_string)).to be_a Riak::RObject
29
- robj.content_type = 'text/plain'
30
- robj.data = random_utf8_string
31
- robj.indexes['cat_bin'] = [random_utf8_string, 'asdf']
32
- expect{ robj.store }.to_not raise_error
33
-
34
- expect(robj2 = utf8_bucket.get(random_utf8_string)).to be_a Riak::RObject
35
- expect(robj2.data).to eq random_utf8_string
36
-
37
- robj.raw_data = random_utf8_string
38
- robj.store
39
- robj2.reload
40
- expect(robj2.raw_data).to eq random_utf8_string
41
- expect(robj2.indexes['cat_bin']).to include 'asdf'
42
- expect(robj2.indexes['cat_bin']).
43
- to include random_utf8_string.force_encoding('binary')
44
-
45
- expect(utf8_bucket.get_index 'cat_bin', 'asdf').
46
- to include random_utf8_string.force_encoding('binary')
47
- expect(utf8_bucket.get_index 'cat_bin', random_utf8_string).
48
- to include random_utf8_string.force_encoding('binary')
49
-
50
- # riak gives us binary-encoding back, which is working as intended
51
- expect(utf8_bucket.keys).
52
- to include random_utf8_string.force_encoding('binary')
53
- end
54
-
55
- it 'allows binary strings in bucket and key names and values' do
56
- expect(binary_bucket).to be_a Riak::Bucket
57
- expect(robj = binary_bucket.new(random_binary_string)).
58
- to be_a Riak::RObject
59
- robj.content_type = 'text/plain'
60
- robj.data = random_binary_string
61
- robj.indexes['cat_bin'] = [random_binary_string, 'asdf']
62
- expect{ robj.store }.to_not raise_error
63
-
64
- expect(robj2 = binary_bucket.get(random_binary_string)).
65
- to be_a Riak::RObject
66
- expect(robj2.data).to eq random_binary_string
67
-
68
- robj.raw_data = random_binary_string
69
- robj.store
70
- robj2.reload
71
- expect(robj2.raw_data).to eq random_binary_string
72
-
73
- expect(binary_bucket.get_index 'cat_bin', 'asdf').
74
- to include random_binary_string
75
- expect(binary_bucket.get_index 'cat_bin', random_binary_string).
76
- to include random_binary_string
77
-
78
- expect(binary_bucket.keys).to include random_binary_string
79
- end
80
-
81
- it 'throws an exception when non-string used as key' do
82
- expect do
83
- binary_bucket.get(1234)
84
- end.to raise_error ArgumentError, /is not a String/
85
- end
86
- end
87
- end
@@ -1,142 +0,0 @@
1
- # coding: utf-8
2
- require 'spec_helper'
3
- require 'riak'
4
- require 'riak/util/string'
5
-
6
- describe 'Encoding and Riak Search', integration: true, search_config: true do
7
- let(:bucket_type){ test_client.bucket_type 'yokozuna' }
8
-
9
- let(:utf8_encoding){ Encoding.find 'utf-8' }
10
- let(:utf8_string){ "\xF0\x9F\x9A\xB4こんにちはสวัสดี" }
11
- let(:random_utf8_string){ utf8_string + random_key }
12
- let(:utf8_bucket){ bucket_type.bucket random_utf8_string }
13
-
14
- let(:binary_encoding){ Encoding.find 'binary' }
15
- let(:binary_string){ "\xff\xff".force_encoding('binary') }
16
- let(:random_binary_string){ binary_string + random_key }
17
- let(:binary_bucket){ bucket_type.bucket random_binary_string }
18
-
19
- describe 'with utf-8 strings' do
20
- it 'creates schemas' do
21
- schema = nil
22
- expect do
23
- schema = Riak::Search::Schema.new test_client, random_utf8_string
24
- end.to_not raise_error
25
-
26
- expect(schema).to be_a Riak::Search::Schema
27
-
28
- expect{ schema.create! schema_xml random_utf8_string }.to_not raise_error
29
-
30
- schema2 = Riak::Search::Schema.new test_client, random_utf8_string
31
- expect(schema2).to be_exists
32
- end
33
-
34
- it 'refuses to create indexes' do
35
- index = nil
36
- expect do
37
- index = Riak::Search::Index.new test_client, random_utf8_string
38
- end.to_not raise_error
39
-
40
- expect(index).to be_a Riak::Search::Index
41
-
42
- expect{ index.create! }.to raise_error /Invalid character/
43
- end
44
-
45
- it 'queries non-weird indexes' do
46
- create_index
47
-
48
- props = Riak::BucketProperties.new utf8_bucket
49
- props['search_index'] = index_name
50
- props.store
51
-
52
- wait_until do
53
- props.reload
54
- props['search_index'] == index_name
55
- end
56
-
57
- robj = utf8_bucket.new random_utf8_string
58
- robj.content_type = 'text/plain'
59
- robj.raw_data = <<EOD
60
- This is due to the write-once, append-only nature of the Bitcask database files.
61
- High throughput, especially when writing an incoming stream of random items
62
- Because the data being written doesn't need to be ordered on disk and because
63
- the log structured design allows for minimal disk head movement during writes
64
- these operations generally saturate the I/O and disk bandwidth.
65
- EOD
66
- robj.store
67
-
68
- results = nil
69
- wait_until do
70
- results = index.query('bitcask').results
71
- !results.empty?
72
- end
73
- expect(results).to_not be_empty
74
- expect(results.docs.first.bucket_type).to eq robj.bucket.type
75
- expect(results.docs.first.bucket).to eq robj.bucket
76
- expect(Riak::Util::String.equal_bytes?(results.docs.first.key, robj.key)).to be
77
- end
78
- end
79
-
80
- describe 'with binary strings' do
81
- it 'refuses to create schemas' do
82
- schema = nil
83
- expect do
84
- schema = Riak::Search::Schema.new test_client, random_binary_string
85
- end.to_not raise_error
86
-
87
- expect(schema).to be_a Riak::Search::Schema
88
-
89
- # yz will refuse to create files with names that aren't valid utf-8
90
- expect{ schema.create! schema_xml random_binary_string }.
91
- to raise_error /bad_character/
92
- end
93
-
94
-
95
- it 'refuses to create indexes' do
96
- index = nil
97
- expect do
98
- index = Riak::Search::Index.new test_client, random_binary_string
99
- end.to_not raise_error
100
-
101
- expect(index).to be_a Riak::Search::Index
102
-
103
- expect{ index.create! }.to raise_error /Invalid character/
104
- end
105
-
106
- # left here for reference: yz can't index documents with \xff\xff in the
107
- # key, or presumably bucket name either
108
- # it 'queries non-weird indexes' do
109
- # create_index
110
-
111
- # props = Riak::BucketProperties.new binary_bucket
112
- # props['search_index'] = index_name
113
- # props.store
114
-
115
- # wait_until do
116
- # props.reload
117
- # props['search_index'] == index_name
118
- # end
119
-
120
- # robj = binary_bucket.new random_binary_string
121
- # robj.content_type = 'text/plain'
122
- # robj.raw_data = <<EOD
123
- # This is due to the write-once, append-only nature of the Bitcask database files.
124
- # High throughput, especially when writing an incoming stream of random items
125
- # Because the data being written doesn't need to be ordered on disk and because
126
- # the log structured design allows for minimal disk head movement during writes
127
- # these operations generally saturate the I/O and disk bandwidth.
128
- # EOD
129
- # robj.store
130
-
131
- # results = nil
132
- # wait_until do
133
- # results = index.query('bitcask').results
134
- # !results.empty?
135
- # end
136
- # expect(results).to_not be_empty
137
- # expect(results.docs.first.bucket_type).to eq robj.bucket.type
138
- # expect(results.docs.first.bucket).to eq robj.bucket
139
- # expect(results.docs.first.key.bytes).to eq robj.key.bytes
140
- # end
141
- end
142
- end