riak-client 1.4.5 → 2.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/Gemfile +0 -1
  4. data/{LICENSE → LICENSE.md} +0 -0
  5. data/README.markdown +211 -66
  6. data/RELEASE_NOTES.md +22 -47
  7. data/Rakefile +45 -0
  8. data/lib/riak.rb +1 -1
  9. data/lib/riak/bucket.rb +2 -2
  10. data/lib/riak/client.rb +22 -195
  11. data/lib/riak/client/beefcake/crdt_loader.rb +127 -0
  12. data/lib/riak/client/beefcake/crdt_operator.rb +222 -0
  13. data/lib/riak/client/beefcake/footer +4 -0
  14. data/lib/riak/client/beefcake/header +6 -0
  15. data/lib/riak/client/beefcake/message_codes.rb +29 -0
  16. data/lib/riak/client/beefcake/message_overlay.rb +61 -0
  17. data/lib/riak/client/beefcake/messages.rb +733 -371
  18. data/lib/riak/client/beefcake/object_methods.rb +1 -1
  19. data/lib/riak/client/beefcake/protocol.rb +105 -0
  20. data/lib/riak/client/beefcake/socket.rb +243 -0
  21. data/lib/riak/client/beefcake_protobuffs_backend.rb +262 -122
  22. data/lib/riak/client/node.rb +4 -75
  23. data/lib/riak/client/protobuffs_backend.rb +6 -14
  24. data/lib/riak/client/search.rb +0 -64
  25. data/lib/riak/client/yokozuna.rb +52 -0
  26. data/lib/riak/counter.rb +1 -1
  27. data/lib/riak/crdt.rb +21 -0
  28. data/lib/riak/crdt/base.rb +97 -0
  29. data/lib/riak/crdt/batch_counter.rb +19 -0
  30. data/lib/riak/crdt/batch_map.rb +41 -0
  31. data/lib/riak/crdt/counter.rb +71 -0
  32. data/lib/riak/crdt/inner_counter.rb +74 -0
  33. data/lib/riak/crdt/inner_flag.rb +42 -0
  34. data/lib/riak/crdt/inner_map.rb +53 -0
  35. data/lib/riak/crdt/inner_register.rb +26 -0
  36. data/lib/riak/crdt/inner_set.rb +95 -0
  37. data/lib/riak/crdt/map.rb +88 -0
  38. data/lib/riak/crdt/operation.rb +19 -0
  39. data/lib/riak/crdt/set.rb +156 -0
  40. data/lib/riak/crdt/typed_collection.rb +131 -0
  41. data/lib/riak/errors/base.rb +9 -0
  42. data/lib/riak/errors/connection_error.rb +44 -0
  43. data/lib/riak/errors/crdt_error.rb +18 -0
  44. data/lib/riak/errors/failed_request.rb +56 -0
  45. data/lib/riak/errors/protobuffs_error.rb +11 -0
  46. data/lib/riak/i18n.rb +2 -0
  47. data/lib/riak/json.rb +1 -1
  48. data/lib/riak/locale/en.yml +26 -1
  49. data/lib/riak/locale/fr.yml +0 -1
  50. data/lib/riak/map_reduce.rb +1 -1
  51. data/lib/riak/map_reduce/results.rb +1 -1
  52. data/lib/riak/multiget.rb +1 -2
  53. data/lib/riak/rcontent.rb +8 -3
  54. data/lib/riak/robject.rb +2 -8
  55. data/lib/riak/secondary_index.rb +4 -4
  56. data/lib/riak/serializers.rb +1 -1
  57. data/lib/riak/util/escape.rb +3 -5
  58. data/lib/riak/version.rb +1 -1
  59. data/lib/riak/walk_spec.rb +7 -3
  60. data/riak-client.gemspec +10 -8
  61. data/spec/fixtures/bitcask.txt +25 -0
  62. data/spec/integration/riak/bucket_types_spec.rb +61 -0
  63. data/spec/integration/riak/counters_spec.rb +17 -32
  64. data/spec/integration/riak/crdt_spec.rb +181 -0
  65. data/spec/integration/riak/crdt_validation/map_spec.rb +63 -0
  66. data/spec/integration/riak/crdt_validation/set_spec.rb +122 -0
  67. data/spec/integration/riak/protobuffs_backends_spec.rb +9 -26
  68. data/spec/integration/riak/security_spec.rb +94 -0
  69. data/spec/integration/riak/threading_spec.rb +24 -67
  70. data/spec/integration/yokozuna/index_spec.rb +61 -0
  71. data/spec/integration/yokozuna/queries_spec.rb +116 -0
  72. data/spec/integration/yokozuna/schema_spec.rb +49 -0
  73. data/spec/riak/beefcake_protobuffs_backend/crdt_operator_spec.rb +222 -0
  74. data/spec/riak/beefcake_protobuffs_backend/object_methods_spec.rb +4 -4
  75. data/spec/riak/beefcake_protobuffs_backend/protocol_spec.rb +189 -0
  76. data/spec/riak/beefcake_protobuffs_backend/socket_spec.rb +151 -0
  77. data/spec/riak/beefcake_protobuffs_backend_spec.rb +68 -106
  78. data/spec/riak/bucket_spec.rb +81 -77
  79. data/spec/riak/client_spec.rb +43 -340
  80. data/spec/riak/core_ext/to_param_spec.rb +2 -2
  81. data/spec/riak/counter_spec.rb +20 -20
  82. data/spec/riak/crdt/counter_spec.rb +52 -0
  83. data/spec/riak/crdt/inner_counter_spec.rb +21 -0
  84. data/spec/riak/crdt/inner_flag_spec.rb +39 -0
  85. data/spec/riak/crdt/inner_map_spec.rb +47 -0
  86. data/spec/riak/crdt/inner_register_spec.rb +40 -0
  87. data/spec/riak/crdt/inner_set_spec.rb +33 -0
  88. data/spec/riak/crdt/map_spec.rb +77 -0
  89. data/spec/riak/crdt/set_spec.rb +58 -0
  90. data/spec/riak/crdt/shared_examples.rb +74 -0
  91. data/spec/riak/crdt/typed_collection_spec.rb +231 -0
  92. data/spec/riak/escape_spec.rb +33 -37
  93. data/spec/riak/feature_detection_spec.rb +45 -45
  94. data/spec/riak/index_collection_spec.rb +12 -12
  95. data/spec/riak/link_spec.rb +34 -34
  96. data/spec/riak/list_buckets_spec.rb +7 -7
  97. data/spec/riak/map_reduce/filter_builder_spec.rb +6 -6
  98. data/spec/riak/map_reduce/phase_spec.rb +35 -35
  99. data/spec/riak/map_reduce_spec.rb +89 -87
  100. data/spec/riak/multiget_spec.rb +20 -15
  101. data/spec/riak/node_spec.rb +5 -152
  102. data/spec/riak/robject_spec.rb +95 -108
  103. data/spec/riak/search_spec.rb +17 -139
  104. data/spec/riak/secondary_index_spec.rb +49 -49
  105. data/spec/riak/serializers_spec.rb +9 -9
  106. data/spec/riak/stamp_spec.rb +9 -9
  107. data/spec/riak/walk_spec_spec.rb +46 -46
  108. data/spec/spec_helper.rb +14 -22
  109. data/spec/support/certs/README.md +13 -0
  110. data/spec/support/certs/ca.crt +22 -0
  111. data/spec/support/certs/client.crt +95 -0
  112. data/spec/support/certs/client.key +27 -0
  113. data/spec/support/certs/empty_ca.crt +21 -0
  114. data/spec/support/certs/server.crl +13 -0
  115. data/spec/support/certs/server.crt +95 -0
  116. data/spec/support/certs/server.key +27 -0
  117. data/spec/support/integration_setup.rb +1 -1
  118. data/spec/support/search_corpus_setup.rb +29 -8
  119. data/spec/support/test_client.rb +46 -0
  120. data/spec/support/test_client.yml.example +10 -0
  121. data/spec/support/unified_backend_examples.rb +104 -83
  122. data/spec/support/version_filter.rb +2 -2
  123. data/spec/support/wait_until.rb +14 -0
  124. metadata +134 -132
  125. data/erl_src/riak_kv_test014_backend.beam +0 -0
  126. data/erl_src/riak_kv_test014_backend.erl +0 -189
  127. data/erl_src/riak_kv_test_backend.beam +0 -0
  128. data/erl_src/riak_kv_test_backend.erl +0 -731
  129. data/erl_src/riak_search_test_backend.beam +0 -0
  130. data/erl_src/riak_search_test_backend.erl +0 -175
  131. data/lib/riak/client/excon_backend.rb +0 -172
  132. data/lib/riak/client/http_backend.rb +0 -413
  133. data/lib/riak/client/http_backend/bucket_streamer.rb +0 -15
  134. data/lib/riak/client/http_backend/chunked_json_streamer.rb +0 -42
  135. data/lib/riak/client/http_backend/configuration.rb +0 -227
  136. data/lib/riak/client/http_backend/key_streamer.rb +0 -15
  137. data/lib/riak/client/http_backend/object_methods.rb +0 -114
  138. data/lib/riak/client/http_backend/request_headers.rb +0 -34
  139. data/lib/riak/client/http_backend/transport_methods.rb +0 -201
  140. data/lib/riak/client/instrumentation.rb +0 -25
  141. data/lib/riak/client/net_http_backend.rb +0 -82
  142. data/lib/riak/cluster.rb +0 -151
  143. data/lib/riak/failed_request.rb +0 -81
  144. data/lib/riak/instrumentation.rb +0 -6
  145. data/lib/riak/node.rb +0 -40
  146. data/lib/riak/node/configuration.rb +0 -304
  147. data/lib/riak/node/console.rb +0 -133
  148. data/lib/riak/node/control.rb +0 -207
  149. data/lib/riak/node/defaults.rb +0 -85
  150. data/lib/riak/node/generation.rb +0 -127
  151. data/lib/riak/node/log.rb +0 -34
  152. data/lib/riak/node/version.rb +0 -29
  153. data/lib/riak/search.rb +0 -3
  154. data/lib/riak/test_server.rb +0 -89
  155. data/lib/riak/util/headers.rb +0 -32
  156. data/lib/riak/util/multipart.rb +0 -52
  157. data/lib/riak/util/multipart/stream_parser.rb +0 -62
  158. data/spec/fixtures/munchausen.txt +0 -1033
  159. data/spec/integration/riak/cluster_spec.rb +0 -88
  160. data/spec/integration/riak/http_backends_spec.rb +0 -180
  161. data/spec/integration/riak/node_spec.rb +0 -170
  162. data/spec/integration/riak/test_server_spec.rb +0 -57
  163. data/spec/riak/excon_backend_spec.rb +0 -102
  164. data/spec/riak/headers_spec.rb +0 -21
  165. data/spec/riak/http_backend/configuration_spec.rb +0 -273
  166. data/spec/riak/http_backend/object_methods_spec.rb +0 -243
  167. data/spec/riak/http_backend/transport_methods_spec.rb +0 -97
  168. data/spec/riak/http_backend_spec.rb +0 -367
  169. data/spec/riak/instrumentation_spec.rb +0 -167
  170. data/spec/riak/multipart_spec.rb +0 -23
  171. data/spec/riak/net_http_backend_spec.rb +0 -15
  172. data/spec/riak/stream_parser_spec.rb +0 -53
  173. data/spec/support/drb_mock_server.rb +0 -39
  174. data/spec/support/http_backend_implementation_examples.rb +0 -253
  175. data/spec/support/mock_server.rb +0 -81
  176. data/spec/support/mocks.rb +0 -4
  177. data/spec/support/riak_test.rb +0 -77
  178. data/spec/support/sometimes.rb +0 -46
  179. data/spec/support/test_server.rb +0 -61
  180. data/spec/support/test_server.yml.example +0 -14
@@ -0,0 +1,27 @@
1
+ -----BEGIN RSA PRIVATE KEY-----
2
+ MIIEowIBAAKCAQEAsYmZjNwswx37osP9v6Qssrdsm6/50t5C2ZvFHOg/VNuFaKfQ
3
+ Sl5SXA4udyR2yM1K5ydcSAD/FHXOwqLIcOYr1p/V6QSIXME6lPiJSHSev+8l0Zmx
4
+ X9O8xSH06VZRCJ8tsMHPa8wJ+5rqEqOuV3AUY8WLrpIWyex+vANayZS40x0y2B+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k0MjQ4WhcNMTQw
6
+ NjI2MTk0MjQ4WjAWMBQCA2beDRcNMTQwNTI3MTk0MjQ4WqARMA8wDQYDVR0UBAYC
7
+ BACikbwwDQYJKoZIhvcNAQEFBQADggEBAKPIogNgS8I4MR21ZrLkyV0wPGjzB26W
8
+ AplQMQqr8GYLLxkRPZBKDVdjwZINjmAm0MUsL74vnvrABJ91M0IRkanVPc3UA/Gk
9
+ ZNjH5WgTWbGP8SwdwPzjJeYckVQRNTpF9YQ/0XN1mtJA95WwSy7VuWKnMNRU0uf6
10
+ CWcXO+hlsPkwBTu+NMqkD2E5PpbcLvob9sdGMAJ2AzI2Oa8JPpVS9RXDFJTtqFAZ
11
+ JikU5MmZmpY9hL++3OD4rRih2lW32OzO710olJGPcV3o8Ax8KxPk13sVgdwTNPmj
12
+ auGtyqY/m/94SwNPUcglAkWn0wRO9sD+1PvoZJPxq+NBs/EKihFY1GI=
13
+ -----END X509 CRL-----
@@ -0,0 +1,95 @@
1
+ Certificate:
2
+ Data:
3
+ Version: 3 (0x2)
4
+ Serial Number: 6741517 (0x66de0d)
5
+ Signature Algorithm: sha1WithRSAEncryption
6
+ Issuer: C=US, ST=Washington, L=Seattle, O=Basho, OU=Riak Python Client, CN=CA/emailAddress=clients@basho.com
7
+ Validity
8
+ Not Before: May 27 19:42:48 2014 GMT
9
+ Not After : May 24 19:42:48 2024 GMT
10
+ Subject: C=US, ST=Washington, O=Basho, OU=Riak Python Client, CN=riak@127.0.0.1/emailAddress=clients@basho.com
11
+ Subject Public Key Info:
12
+ Public Key Algorithm: rsaEncryption
13
+ Public-Key: (2048 bit)
14
+ Modulus:
15
+ 00:d6:2c:f3:40:a0:bc:22:54:18:b0:29:71:9c:64:
16
+ 77:c9:b7:eb:c7:df:16:1d:5d:56:cd:28:1f:f8:41:
17
+ 60:07:2c:a5:42:af:39:cc:2f:0d:a9:9e:32:96:0a:
18
+ b3:08:ab:16:9a:3a:ef:7f:aa:83:c1:1f:59:19:02:
19
+ b3:f1:bf:4f:59:37:74:18:bb:87:e1:b8:3e:42:59:
20
+ fb:dd:f7:ef:1c:9f:f9:ec:96:dc:b8:46:d0:a6:25:
21
+ 02:e0:70:f8:9f:64:67:5c:69:88:26:2e:4c:a8:c7:
22
+ ee:dd:9e:d0:47:79:61:14:b0:9f:9a:d9:ff:a8:56:
23
+ ce:0f:59:64:7c:69:1f:d3:e9:d5:c5:e9:0b:6b:aa:
24
+ 63:77:39:ae:23:1e:8a:91:d2:8a:84:93:34:7f:3d:
25
+ c9:37:27:af:20:85:0c:b6:02:c0:21:77:df:34:1a:
26
+ b2:fd:f5:84:b8:da:90:33:a2:55:c9:ba:60:53:8a:
27
+ a9:07:8c:2e:81:36:6f:ed:4a:f4:74:1f:e9:91:61:
28
+ 87:41:b6:47:3d:50:28:9b:eb:da:9d:58:e0:86:f5:
29
+ 66:92:5e:f0:fb:43:be:71:43:3b:ab:59:8c:8d:36:
30
+ 2f:54:25:4a:46:f8:16:3f:d0:db:6a:b7:ca:6f:cf:
31
+ de:63:6b:97:b3:64:58:1b:18:d7:a0:85:09:f9:08:
32
+ 0f:a7
33
+ Exponent: 65537 (0x10001)
34
+ X509v3 extensions:
35
+ X509v3 Basic Constraints:
36
+ CA:FALSE
37
+ Netscape Cert Type:
38
+ SSL Client, SSL Server
39
+ X509v3 Key Usage:
40
+ Digital Signature, Non Repudiation, Key Encipherment
41
+ Netscape Comment:
42
+ Riak Python Client Testing Certificate
43
+ X509v3 Subject Key Identifier:
44
+ E5:77:01:19:34:B0:B0:C5:D9:A3:D4:BD:8B:6B:A5:A8:73:E0:F2:50
45
+ X509v3 Authority Key Identifier:
46
+ DirName:/C=US/ST=Washington/L=Seattle/O=Basho/OU=Riak Python Client/CN=CA/emailAddress=clients@basho.com
47
+ serial:9F:5A:C6:15:8C:23:44:9D
48
+
49
+ X509v3 Extended Key Usage:
50
+ TLS Web Server Authentication, TLS Web Client Authentication
51
+ Signature Algorithm: sha1WithRSAEncryption
52
+ 0e:8e:1e:93:17:55:90:ed:b2:b2:8f:03:84:8d:76:92:07:b6:
53
+ ef:5b:98:c0:4c:75:cc:d4:1c:f7:2c:d5:d9:01:96:ff:e7:13:
54
+ d0:94:1b:ac:21:ef:7f:71:98:a0:de:82:39:97:d3:11:24:54:
55
+ fa:d6:f6:b4:3f:eb:ee:c5:df:9c:19:b8:42:63:7c:a4:e0:1c:
56
+ 29:d6:ff:f5:3c:d8:a4:ee:3f:65:21:83:2f:b5:b8:b3:4b:01:
57
+ 03:c4:fa:e8:b3:be:e6:62:99:ce:8a:af:87:ce:c6:5e:94:db:
58
+ 79:9c:29:61:81:5e:38:24:ab:6a:52:8a:a8:49:2e:90:71:4a:
59
+ b4:f8:b3:20:fc:74:16:ac:e5:a5:7c:58:72:30:ca:e0:24:f7:
60
+ 49:cd:d1:d6:d9:1b:c0:9f:fe:27:38:5d:c4:b7:15:fc:0f:69:
61
+ 3e:83:36:af:21:f7:de:9f:1e:01:ad:9c:c1:77:7a:07:f6:0f:
62
+ df:42:af:99:09:82:7a:e3:61:73:1f:a7:ea:a8:15:f5:02:68:
63
+ 4a:e5:3a:d6:ba:bd:ec:22:6f:41:7f:d8:77:4b:08:0a:24:9c:
64
+ 07:16:c7:a8:53:26:3a:90:cf:25:63:d4:6b:7a:42:83:22:2b:
65
+ 3f:9d:13:e7:d3:4d:b0:31:71:32:63:a9:d3:86:ca:20:d0:f8:
66
+ b8:65:3c:05
67
+ -----BEGIN CERTIFICATE-----
68
+ MIIE8TCCA9mgAwIBAgIDZt4NMA0GCSqGSIb3DQEBBQUAMIGQMQswCQYDVQQGEwJV
69
+ UzETMBEGA1UECAwKV2FzaGluZ3RvbjEQMA4GA1UEBwwHU2VhdHRsZTEOMAwGA1UE
70
+ CgwFQmFzaG8xGzAZBgNVBAsMElJpYWsgUHl0aG9uIENsaWVudDELMAkGA1UEAwwC
71
+ Q0ExIDAeBgkqhkiG9w0BCQEWEWNsaWVudHNAYmFzaG8uY29tMB4XDTE0MDUyNzE5
72
+ N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v
25
+ 468ioLz9R7n8AAwa63aFr36BpsKUwbPs1kujzfvrvNZr81se1lM8lehQDv5OOPHK
26
+ 773Fl/A+7ePM+ZPXaW3zslPM722fBG32bBsMTceQnkVQItqR8jk=
27
+ -----END RSA PRIVATE KEY-----
@@ -6,5 +6,5 @@ module IntegrationSpecs
6
6
  end
7
7
 
8
8
  RSpec.configure do |config|
9
- config.include IntegrationSpecs, :example_group => { :file_path => %r{spec/integration} }
9
+ config.include IntegrationSpecs, file_path: %r{spec/integration}
10
10
  end
@@ -1,18 +1,39 @@
1
+ # encoding: utf-8
1
2
  shared_context "search corpus setup" do
2
3
  before do
3
- @bucket = @client.bucket('search_test')
4
- orig_proto, @client.protocol = @client.protocol, :http
5
- @bucket.enable_index!
6
- @client.protocol = orig_proto
4
+ @search_bucket = random_bucket 'search_test'
5
+ @backend.create_search_index @search_bucket.name
6
+
7
+ wait_until{ !@backend.get_search_index(@search_bucket.name).nil? }
8
+
9
+ @client.set_bucket_props(@search_bucket,
10
+ {search_index: @search_bucket.name},
11
+ 'yokozuna')
12
+
13
+ wait_until do
14
+ p = @client.get_bucket_props(@search_bucket, type: 'yokozuna')
15
+ p['search_index'] == @search_bucket.name
16
+ end
17
+
7
18
  idx = 0
8
- IO.foreach("spec/fixtures/munchausen.txt") do |para|
9
- next if para =~ /^\s*$|introduction|chapter/i
19
+ old_encoding = Encoding.default_external
20
+ Encoding.default_external = Encoding::UTF_8
21
+ IO.foreach("spec/fixtures/bitcask.txt") do |para|
22
+ next if para =~ /^\s*$|introduction|chapter/ui
10
23
  idx += 1
11
- Riak::RObject.new(@bucket, "munchausen-#{idx}") do |obj|
24
+ Riak::RObject.new(@search_bucket, "bitcask-#{idx}") do |obj|
12
25
  obj.content_type = 'text/plain'
13
26
  obj.raw_data = para
14
- @backend.store_object(obj)
27
+ @backend.store_object(obj, type: 'yokozuna')
15
28
  end
16
29
  end
30
+ Encoding.default_external = old_encoding
31
+
32
+ wait_until do
33
+ results = @backend.search(@search_bucket.name,
34
+ 'contain your entire keyspace',
35
+ df: 'text')
36
+ results['docs'].length > 0
37
+ end
17
38
  end
18
39
  end
@@ -0,0 +1,46 @@
1
+ module TestClient
2
+ def test_client
3
+ if defined? $test_client and $test_client.ping
4
+ return $test_client
5
+ end
6
+
7
+ candidate_client = Riak::Client.new test_client_configuration
8
+
9
+ live = candidate_client.ping
10
+
11
+ return $test_client = candidate_client if live
12
+ end
13
+
14
+ def test_client_configuration
15
+ TestClient.test_client_configuration
16
+ end
17
+
18
+ def self.test_client_configuration
19
+ if defined? $test_client_configuration
20
+ return $test_client_configuration
21
+ end
22
+
23
+ config_path = File.expand_path '../test_client.yml', __FILE__
24
+ config = YAML.load_file(config_path).symbolize_keys
25
+
26
+ if config[:nodes]
27
+ new_nodes = config[:nodes].map(&:symbolize_keys)
28
+ config[:nodes] = new_nodes
29
+ end
30
+
31
+ $test_client_configuration = config
32
+ end
33
+
34
+ def random_bucket(name='test_client')
35
+ bucket_name = [name, Time.now.to_i, random_key].join('-')
36
+ test_client.bucket bucket_name
37
+ end
38
+
39
+ def random_key
40
+ rand(36**10).to_s(36)
41
+ end
42
+ end
43
+
44
+ RSpec.configure do |config|
45
+ config.include TestClient, test_client: true
46
+ end
@@ -0,0 +1,10 @@
1
+ # This file is used for configuring test_client used by
2
+ # many of the integration tests.
3
+ #
4
+ # Simply set the arguments you'd normally pass to
5
+ # Riak::Client.new in the file.
6
+ #
7
+ # Don't run multiple nodes, integration tests include
8
+ # quorum checks that may result in race conditions.
9
+
10
+ pb_port: 10017
@@ -1,67 +1,79 @@
1
1
  shared_examples_for "Unified backend API" do
2
2
  # ping
3
3
  it "should ping the server" do
4
- @backend.ping.should be_true
4
+ expect(@backend.ping).to be_truthy
5
+ end
6
+
7
+ it "gets info about the server" do
8
+ expect{ @backend.server_info }.to_not raise_error
9
+
10
+ expect(@backend.server_info).to include(:node, :server_version)
11
+ end
12
+
13
+ it "gets client id" do
14
+ expect{ @backend.get_client_id }.to_not raise_error
15
+
16
+ expect(@backend.get_client_id).to be_a String
5
17
  end
6
18
 
7
19
  # fetch_object
8
20
  context "fetching an object" do
9
21
  before do
10
- @robject = Riak::RObject.new(@client.bucket("test"), "fetch")
22
+ @robject = Riak::RObject.new(@bucket, "fetch")
11
23
  @robject.content_type = "application/json"
12
24
  @robject.data = { "test" => "pass" }
13
- @robject.indexes['test_bin'] << 'pass' if test_server.version >= "1.0.0"
25
+ @robject.indexes['test_bin'] << 'pass'
14
26
  @robject.links << Riak::Link.new('/riak/foo/bar', 'next')
15
27
  @robject.links << Riak::Link.new('/riak/foo/baz', 'next')
16
28
  @backend.store_object(@robject)
17
29
  end
18
30
 
19
31
  it "should find a stored object" do
20
- robj = @backend.fetch_object("test", "fetch")
21
- robj.should be_kind_of(Riak::RObject)
22
- robj.data.should == { "test" => "pass" }
23
- robj.links.should be_a Set
32
+ robj = @backend.fetch_object(@bucket.name, "fetch")
33
+ expect(robj).to be_kind_of(Riak::RObject)
34
+ expect(robj.data).to eq({ "test" => "pass" })
35
+ expect(robj.links).to be_a Set
24
36
  end
25
37
 
26
38
  it "should raise an error when the object is not found" do
27
39
  begin
28
- @backend.fetch_object("test", "notfound")
40
+ @backend.fetch_object(@bucket.name, "notfound")
29
41
  rescue Riak::FailedRequest => exception
30
42
  @exception = exception
31
43
  end
32
- @exception.should be_kind_of(Riak::FailedRequest)
33
- @exception.should be_not_found
44
+ expect(@exception).to be_kind_of(Riak::FailedRequest)
45
+ expect(@exception).to be_not_found
34
46
  end
35
47
 
36
48
  [1,2,3,:one,:quorum,:all,:default].each do |q|
37
49
  it "should accept a R value of #{q.inspect} for the request" do
38
- robj = @backend.fetch_object("test", "fetch", :r => q)
39
- robj.should be_kind_of(Riak::RObject)
40
- robj.data.should == { "test" => "pass" }
50
+ robj = @backend.fetch_object(@bucket.name, "fetch", :r => q)
51
+ expect(robj).to be_kind_of(Riak::RObject)
52
+ expect(robj.data).to eq({ "test" => "pass" })
41
53
  end
42
54
 
43
- it "should accept a PR value of #{q.inspect} for the request", :version => ">= 1.0.0" do
44
- robj = @backend.fetch_object("test", "fetch", :pr => q)
45
- robj.should be_kind_of(Riak::RObject)
46
- robj.data.should == { "test" => "pass" }
55
+ it "should accept a PR value of #{q.inspect} for the request" do
56
+ robj = @backend.fetch_object(@bucket.name, "fetch", :pr => q)
57
+ expect(robj).to be_kind_of(Riak::RObject)
58
+ expect(robj.data).to eq({ "test" => "pass" })
47
59
  end
48
60
  end
49
61
 
50
- sometimes "should marshal indexes properly", :version => ">= 1.0.0", :retries => 5 do
51
- robj = @backend.fetch_object('test', 'fetch')
52
- robj.indexes['test_bin'].should be
53
- robj.indexes['test_bin'].should include('pass')
62
+ it "marshals indexes properly", :retries => 5 do
63
+ robj = @backend.fetch_object(@bucket.name, 'fetch')
64
+ expect(robj.indexes['test_bin']).to be
65
+ expect(robj.indexes['test_bin']).to include('pass')
54
66
  end
55
67
  end
56
68
 
57
69
  # reload_object
58
70
  context "reloading an existing object" do
59
71
  before do
60
- @robject = Riak::RObject.new(@client.bucket('test'), 'reload')
72
+ @robject = Riak::RObject.new(@bucket, 'reload')
61
73
  @robject.content_type = "application/json"
62
74
  @robject.data = {"test" => "pass"}
63
75
  @backend.store_object(@robject)
64
- @robject2 = @backend.fetch_object("test", "reload")
76
+ @robject2 = @backend.fetch_object(@bucket.name, "reload")
65
77
  @robject2.data["test"] = "second"
66
78
  @backend.store_object(@robject2, :returnbody => true)
67
79
  end
@@ -75,15 +87,15 @@ shared_examples_for "Unified backend API" do
75
87
  @backend.reload_object(@robject, :r => q)
76
88
  end
77
89
 
78
- it "should accept a valid PR value of #{q.inspect} for the request", :version => ">= 1.0.0" do
90
+ it "should accept a valid PR value of #{q.inspect} for the request" do
79
91
  @backend.reload_object(@robject, :pr => q)
80
92
  end
81
93
  end
82
94
 
83
- after do
95
+ after do |example|
84
96
  unless example.pending?
85
- @robject.vclock.should == @robject2.vclock
86
- @robject.data['test'].should == "second"
97
+ expect(@robject.vclock).to eq(@robject2.vclock)
98
+ expect(@robject.data['test']).to eq("second")
87
99
  end
88
100
  end
89
101
  end
@@ -91,7 +103,7 @@ shared_examples_for "Unified backend API" do
91
103
  # store_object
92
104
  context "storing an object" do
93
105
  before do
94
- @robject = Riak::RObject.new(@client.bucket('test'), 'store')
106
+ @robject = Riak::RObject.new(@bucket, random_key)
95
107
  @robject.content_type = "application/json"
96
108
  @robject.data = {"test" => "pass"}
97
109
  end
@@ -102,33 +114,33 @@ shared_examples_for "Unified backend API" do
102
114
 
103
115
  it "should modify the object with the returned data if returnbody" do
104
116
  @backend.store_object(@robject, :returnbody => true)
105
- @robject.vclock.should be_present
117
+ expect(@robject.vclock).to be_present
106
118
  end
107
119
 
108
120
  [1,2,3,:one,:quorum,:all,:default].each do |q|
109
121
  it "should accept a W value of #{q.inspect} for the request" do
110
122
  @backend.store_object(@robject, :returnbody => false, :w => q)
111
- @client.bucket("test").exists?("store").should be_true
123
+ expect(@bucket.exists?(@robject.key)).to be_truthy
112
124
  end
113
125
 
114
126
  it "should accept a DW value of #{q.inspect} for the request" do
115
127
  @backend.store_object(@robject, :returnbody => false, :w => :all, :dw => q)
116
128
  end
117
129
 
118
- it "should accept a PW value of #{q.inspect} for the request", :version => ">= 1.0.0" do
130
+ it "should accept a PW value of #{q.inspect} for the request" do
119
131
  @backend.store_object(@robject, :returnbody => false, :pw => q)
120
132
  end
121
133
  end
122
134
 
123
- it "should store an object with indexes", :version => ">= 1.0.0" do
135
+ it "should store an object with indexes" do
124
136
  @robject.indexes['foo_bin'] << 'bar'
125
137
  @backend.store_object(@robject, :returnbody => true)
126
- @robject.indexes.should include('foo_bin')
127
- @robject.indexes['foo_bin'].should include('bar')
138
+ expect(@robject.indexes).to include('foo_bin')
139
+ expect(@robject.indexes['foo_bin']).to include('bar')
128
140
  end
129
141
 
130
142
  after do
131
- expect { @backend.fetch_object("test", "store") }.to_not raise_error(Riak::FailedRequest)
143
+ expect { @backend.fetch_object(@bucket.name, @robject.key) }.not_to raise_error
132
144
  end
133
145
  end
134
146
 
@@ -143,7 +155,7 @@ shared_examples_for "Unified backend API" do
143
155
 
144
156
  it "should remove the object" do
145
157
  @backend.delete_object("test", "delete")
146
- @obj.bucket.exists?("delete").should be_false
158
+ expect(@obj.bucket.exists?("delete")).to be_falsey
147
159
  end
148
160
 
149
161
  [1,2,3,:one,:quorum,:all,:default].each do |q|
@@ -157,7 +169,7 @@ shared_examples_for "Unified backend API" do
157
169
  end
158
170
 
159
171
  after do
160
- @obj.bucket.exists?("delete").should be_false
172
+ expect(@obj.bucket.exists?("delete")).to be_falsey
161
173
  end
162
174
  end
163
175
 
@@ -165,8 +177,8 @@ shared_examples_for "Unified backend API" do
165
177
  context "fetching bucket properties" do
166
178
  it "should fetch a hash of bucket properties" do
167
179
  props = @backend.get_bucket_props("test")
168
- props.should be_kind_of(Hash)
169
- props.should include("n_val")
180
+ expect(props).to be_kind_of(Hash)
181
+ expect(props).to include("n_val")
170
182
  end
171
183
  end
172
184
 
@@ -174,55 +186,56 @@ shared_examples_for "Unified backend API" do
174
186
  context "setting bucket properties" do
175
187
  it "should store properties for the bucket" do
176
188
  @backend.set_bucket_props("test", {"n_val" => 3})
177
- @backend.get_bucket_props("test")["n_val"].should == 3
189
+ expect(@backend.get_bucket_props("test")["n_val"]).to eq(3)
178
190
  end
179
191
  end
180
192
 
181
193
  # list_keys
182
194
  context "listing keys in a bucket" do
183
195
  before do
184
- obj = Riak::RObject.new(@client.bucket("test"), "keys")
196
+ @list_bucket = random_bucket 'unified_backend_list_keys'
197
+ obj = Riak::RObject.new(@list_bucket, "keys")
185
198
  obj.content_type = "application/json"
186
199
  obj.data = [1]
187
200
  @backend.store_object(obj)
188
201
  end
189
202
 
190
203
  it "should fetch an array of string keys" do
191
- @backend.list_keys("test").should == ["keys"]
204
+ expect(@backend.list_keys(@list_bucket)).to eq(["keys"])
192
205
  end
193
206
 
194
207
  context "streaming through a block" do
195
208
  it "should handle a large number of keys" do
196
- obj = Riak::RObject.new(@client.bucket("test"))
209
+ obj = Riak::RObject.new(@list_bucket)
197
210
  obj.content_type = "application/json"
198
211
  obj.data = [1]
199
212
  750.times do |i|
200
213
  obj.key = i.to_s
201
214
  obj.store(:w => 1, :dw => 0, :returnbody => false)
202
215
  end
203
- @backend.list_keys("test") do |keys|
204
- keys.should be_all {|k| k == 'keys' || (0..749).include?(k.to_i) }
216
+ @backend.list_keys(@list_bucket) do |keys|
217
+ expect(keys).to be_all {|k| k == 'keys' || (0..749).include?(k.to_i) }
205
218
  end
206
219
  end
207
220
 
208
221
  it "should pass an array of keys to the block" do
209
- @backend.list_keys("test") do |keys|
210
- keys.should == ["keys"] unless keys.empty?
222
+ @backend.list_keys(@list_bucket) do |keys|
223
+ expect(keys).to eq(["keys"]) unless keys.empty?
211
224
  end
212
225
  end
213
226
 
214
227
  it "should allow requests issued inside the block to execute" do
215
228
  errors = []
216
- @backend.list_keys("test") do |keys|
229
+ @backend.list_keys(@list_bucket) do |keys|
217
230
  keys.each do |key|
218
231
  begin
219
- @client.get_object("test", key)
232
+ @client.get_object(@list_bucket, key)
220
233
  rescue => e
221
234
  errors << e
222
235
  end
223
236
  end
224
237
  end
225
- errors.should be_empty
238
+ expect(errors).to be_empty
226
239
  end
227
240
  end
228
241
  end
@@ -238,8 +251,8 @@ shared_examples_for "Unified backend API" do
238
251
 
239
252
  it "should fetch a list of string bucket names" do
240
253
  list = @backend.list_buckets
241
- list.should be_kind_of(Array)
242
- list.should include("test")
254
+ expect(list).to be_kind_of(Array)
255
+ expect(list).to include("test")
243
256
  end
244
257
  end
245
258
 
@@ -256,58 +269,56 @@ shared_examples_for "Unified backend API" do
256
269
  end
257
270
 
258
271
  it "should find keys for an equality query" do
259
- @backend.get_index('test', 'index_int', 20).should == ["20"]
272
+ expect(@backend.get_index('test', 'index_int', 20)).to eq(["20"])
260
273
  end
261
274
 
262
275
  it "should find keys for a range query" do
263
- @backend.get_index('test', 'index_int', 19..21).should =~ ["19","20", "21"]
276
+ expect(@backend.get_index('test', 'index_int', 19..21)).to match_array(["19","20", "21"])
264
277
  end
265
278
 
266
279
  it "should return an empty array for a query that does not match any keys" do
267
- @backend.get_index('test', 'index_int', 10000).should == []
280
+ expect(@backend.get_index('test', 'index_int', 10000)).to eq([])
268
281
  end
269
282
  end
270
283
 
271
284
  # mapred
272
285
  context "performing MapReduce" do
273
286
  before do
274
- obj = Riak::RObject.new(@client.bucket("test"), "1")
287
+ @mapred_bucket = random_bucket("mapred_test")
288
+ obj = Riak::RObject.new(@mapred_bucket, "1")
275
289
  obj.content_type = "application/json"
276
290
  obj.data = {"value" => "1" }
277
291
  @backend.store_object(obj)
278
- @mapred = Riak::MapReduce.new(@client).add("test").map("Riak.mapValuesJson", :keep => true)
279
- end
280
-
281
- it "should raise an error without phases", :version => "< 1.1.0" do
282
- @mapred.query.clear
283
- expect { @backend.mapred(@mapred) }.to raise_error(Riak::MapReduceError)
292
+ @mapred = Riak::MapReduce.new(@client).
293
+ add(@mapred_bucket.name).
294
+ map("Riak.mapValuesJson", :keep => true)
284
295
  end
285
296
 
286
- it "should not raise an error without phases", :version => ">= 1.1.0" do
297
+ it "should not raise an error without phases" do
287
298
  @mapred.query.clear
288
299
  @backend.mapred(@mapred)
289
300
  end
290
301
 
291
302
  it "should perform a simple MapReduce request" do
292
- @backend.mapred(@mapred).should == [{"value" => "1"}]
303
+ expect(@backend.mapred(@mapred)).to eq([{"value" => "1"}])
293
304
  end
294
305
 
295
306
  it "should return an ordered array of results when multiple phases are kept" do
296
307
  @mapred.reduce("function(objects){ return objects; }", :keep => true)
297
- @backend.mapred(@mapred).should == [[{"value" => "1"}], [{"value" => "1"}]]
308
+ expect(@backend.mapred(@mapred)).to eq([[{"value" => "1"}], [{"value" => "1"}]])
298
309
  end
299
310
 
300
311
  it "should not remove empty phase results when multiple phases are kept" do
301
312
  @mapred.reduce("function(){ return []; }", :keep => true)
302
- @backend.mapred(@mapred).should == [[{"value" => "1"}], []]
313
+ expect(@backend.mapred(@mapred)).to eq([[{"value" => "1"}], []])
303
314
  end
304
315
 
305
316
  context "streaming results through a block" do
306
317
  it "should pass phase number and result to the block" do
307
318
  @backend.mapred(@mapred) do |phase, result|
308
319
  unless result.empty?
309
- phase.should == 0
310
- result.should == [{"value" => "1"}]
320
+ expect(phase).to eq(0)
321
+ expect(result).to eq([{"value" => "1"}])
311
322
  end
312
323
  end
313
324
  end
@@ -318,20 +329,20 @@ shared_examples_for "Unified backend API" do
318
329
  unless result.empty?
319
330
  result.each do |v|
320
331
  begin
321
- @client.get_object("test", v['value'])
332
+ @client.get_object(@mapred_bucket, v['value'])
322
333
  rescue => e
323
334
  errors << e
324
335
  end
325
336
  end
326
337
  end
327
338
  end
328
- errors.should be_empty
339
+ expect(errors).to be_empty
329
340
  end
330
341
  end
331
342
  end
332
343
 
333
344
  # search
334
- context "searching fulltext indexes", :version => ">= 1.2.0" do
345
+ context "searching fulltext indexes" do
335
346
  # Search functionality existed since Riak 0.13, but PBC only
336
347
  # entered into the picture in 1.2. PBC can support searches
337
348
  # against 1.1 and earlier nodes using MapReduce emulation, but has
@@ -339,21 +350,31 @@ shared_examples_for "Unified backend API" do
339
350
  # pre-1.2 functionality.
340
351
  include_context "search corpus setup"
341
352
 
342
- it 'should find indexed documents, returning ids' do
343
- results = @backend.search 'search_test', 'fearless elephant rushed', :fl => 'id'
344
- results.should have_key 'docs'
345
- results.should have_key 'max_score'
346
- results.should have_key 'num_found'
347
- results['docs'].should include({"id" => "munchausen-605"})
353
+ it 'finds indexed documents, returning ids' do
354
+ results = @backend.search @search_bucket.name, 'predictable operations behavior', fl: '_yz_rk', df: 'text'
355
+ expect(results).to have_key 'docs'
356
+ expect(results).to have_key 'max_score'
357
+ expect(results).to have_key 'num_found'
358
+
359
+ found = results['docs'].any? do |e|
360
+ e['_yz_rk'] == 'bitcask-10'
361
+ end
362
+
363
+ expect(found).to be_truthy
348
364
  end
349
365
 
350
- it 'should find indexed documents, returning documents' do
366
+ it 'finds indexed documents, returning documents' do
351
367
  # For now use '*' until #122 is merged into riak_search
352
- results = @backend.search 'search_test', 'fearless elephant rushed', :fl => '*'
353
- results.should have_key 'docs'
354
- results.should have_key 'max_score'
355
- results.should have_key 'num_found'
356
- results['docs'].should include({"id" => "munchausen-605", "value" => "Fearless I advanced against the elephant, desirous to take alive the haughty Tippoo Sahib; but he drew a pistol from his belt, and discharged it full in my face as I rushed upon him, which did me no further harm than wound my cheek-bone, which disfigures me somewhat under my left eye. I could not withstand the rage and impulse of that moment, and with one blow of my sword separated his head from his body.\n"})
368
+ results = @backend.search @search_bucket.name, 'predictable operations behavior', fl: '_yz_rk', df: 'text'
369
+ expect(results).to have_key 'docs'
370
+ expect(results).to have_key 'max_score'
371
+ expect(results).to have_key 'num_found'
372
+
373
+ found = results['docs'].any? do |e|
374
+ e['_yz_rk'] == 'bitcask-10'
375
+ end
376
+
377
+ expect(found).to be_truthy
357
378
  end
358
379
  end
359
380
  end