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.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/Gemfile +0 -1
- data/{LICENSE → LICENSE.md} +0 -0
- data/README.markdown +211 -66
- data/RELEASE_NOTES.md +22 -47
- data/Rakefile +45 -0
- data/lib/riak.rb +1 -1
- data/lib/riak/bucket.rb +2 -2
- data/lib/riak/client.rb +22 -195
- data/lib/riak/client/beefcake/crdt_loader.rb +127 -0
- data/lib/riak/client/beefcake/crdt_operator.rb +222 -0
- data/lib/riak/client/beefcake/footer +4 -0
- data/lib/riak/client/beefcake/header +6 -0
- data/lib/riak/client/beefcake/message_codes.rb +29 -0
- data/lib/riak/client/beefcake/message_overlay.rb +61 -0
- data/lib/riak/client/beefcake/messages.rb +733 -371
- data/lib/riak/client/beefcake/object_methods.rb +1 -1
- data/lib/riak/client/beefcake/protocol.rb +105 -0
- data/lib/riak/client/beefcake/socket.rb +243 -0
- data/lib/riak/client/beefcake_protobuffs_backend.rb +262 -122
- data/lib/riak/client/node.rb +4 -75
- data/lib/riak/client/protobuffs_backend.rb +6 -14
- data/lib/riak/client/search.rb +0 -64
- data/lib/riak/client/yokozuna.rb +52 -0
- data/lib/riak/counter.rb +1 -1
- data/lib/riak/crdt.rb +21 -0
- data/lib/riak/crdt/base.rb +97 -0
- data/lib/riak/crdt/batch_counter.rb +19 -0
- data/lib/riak/crdt/batch_map.rb +41 -0
- data/lib/riak/crdt/counter.rb +71 -0
- data/lib/riak/crdt/inner_counter.rb +74 -0
- data/lib/riak/crdt/inner_flag.rb +42 -0
- data/lib/riak/crdt/inner_map.rb +53 -0
- data/lib/riak/crdt/inner_register.rb +26 -0
- data/lib/riak/crdt/inner_set.rb +95 -0
- data/lib/riak/crdt/map.rb +88 -0
- data/lib/riak/crdt/operation.rb +19 -0
- data/lib/riak/crdt/set.rb +156 -0
- data/lib/riak/crdt/typed_collection.rb +131 -0
- data/lib/riak/errors/base.rb +9 -0
- data/lib/riak/errors/connection_error.rb +44 -0
- data/lib/riak/errors/crdt_error.rb +18 -0
- data/lib/riak/errors/failed_request.rb +56 -0
- data/lib/riak/errors/protobuffs_error.rb +11 -0
- data/lib/riak/i18n.rb +2 -0
- data/lib/riak/json.rb +1 -1
- data/lib/riak/locale/en.yml +26 -1
- data/lib/riak/locale/fr.yml +0 -1
- data/lib/riak/map_reduce.rb +1 -1
- data/lib/riak/map_reduce/results.rb +1 -1
- data/lib/riak/multiget.rb +1 -2
- data/lib/riak/rcontent.rb +8 -3
- data/lib/riak/robject.rb +2 -8
- data/lib/riak/secondary_index.rb +4 -4
- data/lib/riak/serializers.rb +1 -1
- data/lib/riak/util/escape.rb +3 -5
- data/lib/riak/version.rb +1 -1
- data/lib/riak/walk_spec.rb +7 -3
- data/riak-client.gemspec +10 -8
- data/spec/fixtures/bitcask.txt +25 -0
- data/spec/integration/riak/bucket_types_spec.rb +61 -0
- data/spec/integration/riak/counters_spec.rb +17 -32
- data/spec/integration/riak/crdt_spec.rb +181 -0
- data/spec/integration/riak/crdt_validation/map_spec.rb +63 -0
- data/spec/integration/riak/crdt_validation/set_spec.rb +122 -0
- data/spec/integration/riak/protobuffs_backends_spec.rb +9 -26
- data/spec/integration/riak/security_spec.rb +94 -0
- data/spec/integration/riak/threading_spec.rb +24 -67
- data/spec/integration/yokozuna/index_spec.rb +61 -0
- data/spec/integration/yokozuna/queries_spec.rb +116 -0
- data/spec/integration/yokozuna/schema_spec.rb +49 -0
- data/spec/riak/beefcake_protobuffs_backend/crdt_operator_spec.rb +222 -0
- data/spec/riak/beefcake_protobuffs_backend/object_methods_spec.rb +4 -4
- data/spec/riak/beefcake_protobuffs_backend/protocol_spec.rb +189 -0
- data/spec/riak/beefcake_protobuffs_backend/socket_spec.rb +151 -0
- data/spec/riak/beefcake_protobuffs_backend_spec.rb +68 -106
- data/spec/riak/bucket_spec.rb +81 -77
- data/spec/riak/client_spec.rb +43 -340
- data/spec/riak/core_ext/to_param_spec.rb +2 -2
- data/spec/riak/counter_spec.rb +20 -20
- data/spec/riak/crdt/counter_spec.rb +52 -0
- data/spec/riak/crdt/inner_counter_spec.rb +21 -0
- data/spec/riak/crdt/inner_flag_spec.rb +39 -0
- data/spec/riak/crdt/inner_map_spec.rb +47 -0
- data/spec/riak/crdt/inner_register_spec.rb +40 -0
- data/spec/riak/crdt/inner_set_spec.rb +33 -0
- data/spec/riak/crdt/map_spec.rb +77 -0
- data/spec/riak/crdt/set_spec.rb +58 -0
- data/spec/riak/crdt/shared_examples.rb +74 -0
- data/spec/riak/crdt/typed_collection_spec.rb +231 -0
- data/spec/riak/escape_spec.rb +33 -37
- data/spec/riak/feature_detection_spec.rb +45 -45
- data/spec/riak/index_collection_spec.rb +12 -12
- data/spec/riak/link_spec.rb +34 -34
- data/spec/riak/list_buckets_spec.rb +7 -7
- data/spec/riak/map_reduce/filter_builder_spec.rb +6 -6
- data/spec/riak/map_reduce/phase_spec.rb +35 -35
- data/spec/riak/map_reduce_spec.rb +89 -87
- data/spec/riak/multiget_spec.rb +20 -15
- data/spec/riak/node_spec.rb +5 -152
- data/spec/riak/robject_spec.rb +95 -108
- data/spec/riak/search_spec.rb +17 -139
- data/spec/riak/secondary_index_spec.rb +49 -49
- data/spec/riak/serializers_spec.rb +9 -9
- data/spec/riak/stamp_spec.rb +9 -9
- data/spec/riak/walk_spec_spec.rb +46 -46
- data/spec/spec_helper.rb +14 -22
- data/spec/support/certs/README.md +13 -0
- data/spec/support/certs/ca.crt +22 -0
- data/spec/support/certs/client.crt +95 -0
- data/spec/support/certs/client.key +27 -0
- data/spec/support/certs/empty_ca.crt +21 -0
- data/spec/support/certs/server.crl +13 -0
- data/spec/support/certs/server.crt +95 -0
- data/spec/support/certs/server.key +27 -0
- data/spec/support/integration_setup.rb +1 -1
- data/spec/support/search_corpus_setup.rb +29 -8
- data/spec/support/test_client.rb +46 -0
- data/spec/support/test_client.yml.example +10 -0
- data/spec/support/unified_backend_examples.rb +104 -83
- data/spec/support/version_filter.rb +2 -2
- data/spec/support/wait_until.rb +14 -0
- metadata +134 -132
- data/erl_src/riak_kv_test014_backend.beam +0 -0
- data/erl_src/riak_kv_test014_backend.erl +0 -189
- data/erl_src/riak_kv_test_backend.beam +0 -0
- data/erl_src/riak_kv_test_backend.erl +0 -731
- data/erl_src/riak_search_test_backend.beam +0 -0
- data/erl_src/riak_search_test_backend.erl +0 -175
- data/lib/riak/client/excon_backend.rb +0 -172
- data/lib/riak/client/http_backend.rb +0 -413
- data/lib/riak/client/http_backend/bucket_streamer.rb +0 -15
- data/lib/riak/client/http_backend/chunked_json_streamer.rb +0 -42
- data/lib/riak/client/http_backend/configuration.rb +0 -227
- data/lib/riak/client/http_backend/key_streamer.rb +0 -15
- data/lib/riak/client/http_backend/object_methods.rb +0 -114
- data/lib/riak/client/http_backend/request_headers.rb +0 -34
- data/lib/riak/client/http_backend/transport_methods.rb +0 -201
- data/lib/riak/client/instrumentation.rb +0 -25
- data/lib/riak/client/net_http_backend.rb +0 -82
- data/lib/riak/cluster.rb +0 -151
- data/lib/riak/failed_request.rb +0 -81
- data/lib/riak/instrumentation.rb +0 -6
- data/lib/riak/node.rb +0 -40
- data/lib/riak/node/configuration.rb +0 -304
- data/lib/riak/node/console.rb +0 -133
- data/lib/riak/node/control.rb +0 -207
- data/lib/riak/node/defaults.rb +0 -85
- data/lib/riak/node/generation.rb +0 -127
- data/lib/riak/node/log.rb +0 -34
- data/lib/riak/node/version.rb +0 -29
- data/lib/riak/search.rb +0 -3
- data/lib/riak/test_server.rb +0 -89
- data/lib/riak/util/headers.rb +0 -32
- data/lib/riak/util/multipart.rb +0 -52
- data/lib/riak/util/multipart/stream_parser.rb +0 -62
- data/spec/fixtures/munchausen.txt +0 -1033
- data/spec/integration/riak/cluster_spec.rb +0 -88
- data/spec/integration/riak/http_backends_spec.rb +0 -180
- data/spec/integration/riak/node_spec.rb +0 -170
- data/spec/integration/riak/test_server_spec.rb +0 -57
- data/spec/riak/excon_backend_spec.rb +0 -102
- data/spec/riak/headers_spec.rb +0 -21
- data/spec/riak/http_backend/configuration_spec.rb +0 -273
- data/spec/riak/http_backend/object_methods_spec.rb +0 -243
- data/spec/riak/http_backend/transport_methods_spec.rb +0 -97
- data/spec/riak/http_backend_spec.rb +0 -367
- data/spec/riak/instrumentation_spec.rb +0 -167
- data/spec/riak/multipart_spec.rb +0 -23
- data/spec/riak/net_http_backend_spec.rb +0 -15
- data/spec/riak/stream_parser_spec.rb +0 -53
- data/spec/support/drb_mock_server.rb +0 -39
- data/spec/support/http_backend_implementation_examples.rb +0 -253
- data/spec/support/mock_server.rb +0 -81
- data/spec/support/mocks.rb +0 -4
- data/spec/support/riak_test.rb +0 -77
- data/spec/support/sometimes.rb +0 -46
- data/spec/support/test_server.rb +0 -61
- data/spec/support/test_server.yml.example +0 -14
data/spec/riak/stamp_spec.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'riak/stamp'
|
3
3
|
|
4
|
-
describe Riak::Stamp do
|
5
|
-
subject { described_class.new
|
4
|
+
describe Riak::Stamp, test_client: true do
|
5
|
+
subject { described_class.new test_client }
|
6
6
|
it "should generate always increasing integer identifiers" do
|
7
7
|
1000.times do
|
8
8
|
one = subject.next
|
9
9
|
two = subject.next
|
10
|
-
[one, two].
|
11
|
-
two.
|
10
|
+
expect([one, two]).to be_all {|i| Integer === i }
|
11
|
+
expect(two).to be > one
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -17,7 +17,7 @@ describe Riak::Stamp do
|
|
17
17
|
subject.instance_variable_set(:@sequence, described_class::SEQUENCE_MASK)
|
18
18
|
count = 0
|
19
19
|
# Simulate the time_gen method returning the same thing multiple times
|
20
|
-
subject.
|
20
|
+
allow(subject).to receive(:time_gen) do
|
21
21
|
count += 1
|
22
22
|
if count < 10
|
23
23
|
old
|
@@ -25,12 +25,12 @@ describe Riak::Stamp do
|
|
25
25
|
old + 1
|
26
26
|
end
|
27
27
|
end
|
28
|
-
((subject.next >> described_class::TIMESTAMP_SHIFT) & described_class::TIMESTAMP_MASK).
|
28
|
+
expect((subject.next >> described_class::TIMESTAMP_SHIFT) & described_class::TIMESTAMP_MASK).to eq(old + 1)
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should raise an exception when the system clock moves backwards" do
|
32
32
|
old = subject.instance_variable_get(:@timestamp)
|
33
|
-
subject.
|
33
|
+
expect(subject).to receive(:time_gen).and_return(old - 10)
|
34
34
|
expect {
|
35
35
|
subject.next
|
36
36
|
}.to raise_error(Riak::BackwardsClockError)
|
@@ -40,7 +40,7 @@ describe Riak::Stamp do
|
|
40
40
|
# primary ordering. This breaks from the Snowflake model where the
|
41
41
|
# worker ID is in more significant bits.
|
42
42
|
it "should use the client ID as the bottom component of the identifier" do
|
43
|
-
(subject.next & described_class::CLIENT_ID_MASK).
|
43
|
+
expect(subject.next & described_class::CLIENT_ID_MASK).to eq(subject.client.client_id.hash & described_class::CLIENT_ID_MASK)
|
44
44
|
end
|
45
45
|
|
46
46
|
context "using a non-integer client ID" do
|
@@ -48,7 +48,7 @@ describe Riak::Stamp do
|
|
48
48
|
let(:hash) { "ripple".hash }
|
49
49
|
|
50
50
|
it "should use the hash of the client ID as the bottom component of the identifier" do
|
51
|
-
(subject.next & described_class::CLIENT_ID_MASK).
|
51
|
+
expect(subject.next & described_class::CLIENT_ID_MASK).to eq(subject.client.client_id.hash & described_class::CLIENT_ID_MASK)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
data/spec/riak/walk_spec_spec.rb
CHANGED
@@ -5,67 +5,67 @@ describe Riak::WalkSpec do
|
|
5
5
|
describe "with a hash" do
|
6
6
|
it "should be empty by default" do
|
7
7
|
spec = Riak::WalkSpec.new({})
|
8
|
-
spec.bucket.
|
9
|
-
spec.tag.
|
10
|
-
spec.keep.
|
8
|
+
expect(spec.bucket).to eq("_")
|
9
|
+
expect(spec.tag).to eq("_")
|
10
|
+
expect(spec.keep).to be_falsey
|
11
11
|
end
|
12
12
|
|
13
13
|
it "should extract the bucket" do
|
14
14
|
spec = Riak::WalkSpec.new({:bucket => "foo"})
|
15
|
-
spec.bucket.
|
16
|
-
spec.tag.
|
17
|
-
spec.keep.
|
15
|
+
expect(spec.bucket).to eq("foo")
|
16
|
+
expect(spec.tag).to eq("_")
|
17
|
+
expect(spec.keep).to be_falsey
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should extract the tag" do
|
21
21
|
spec = Riak::WalkSpec.new({:tag => "foo"})
|
22
|
-
spec.bucket.
|
23
|
-
spec.tag.
|
24
|
-
spec.keep.
|
22
|
+
expect(spec.bucket).to eq("_")
|
23
|
+
expect(spec.tag).to eq("foo")
|
24
|
+
expect(spec.keep).to be_falsey
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should extract the keep" do
|
28
28
|
spec = Riak::WalkSpec.new({:keep => true})
|
29
|
-
spec.bucket.
|
30
|
-
spec.tag.
|
31
|
-
spec.keep.
|
29
|
+
expect(spec.bucket).to eq("_")
|
30
|
+
expect(spec.tag).to eq("_")
|
31
|
+
expect(spec.keep).to be_truthy
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
describe "with three arguments for bucket, tag, and keep" do
|
36
36
|
it "should assign the bucket, tag, and keep" do
|
37
37
|
spec = Riak::WalkSpec.new("foo", "next", false)
|
38
|
-
spec.bucket.
|
39
|
-
spec.tag.
|
40
|
-
spec.keep.
|
38
|
+
expect(spec.bucket).to eq("foo")
|
39
|
+
expect(spec.tag).to eq("next")
|
40
|
+
expect(spec.keep).to be_falsey
|
41
41
|
end
|
42
42
|
|
43
43
|
it "should make the bucket '_' when false or nil" do
|
44
44
|
spec = Riak::WalkSpec.new(nil, "next", false)
|
45
|
-
spec.bucket.
|
45
|
+
expect(spec.bucket).to eq("_")
|
46
46
|
spec = Riak::WalkSpec.new(false, "next", false)
|
47
|
-
spec.bucket.
|
47
|
+
expect(spec.bucket).to eq("_")
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should make the tag '_' when false or nil" do
|
51
51
|
spec = Riak::WalkSpec.new("foo", nil, false)
|
52
|
-
spec.tag.
|
52
|
+
expect(spec.tag).to eq("_")
|
53
53
|
spec = Riak::WalkSpec.new("foo", false, false)
|
54
|
-
spec.tag.
|
54
|
+
expect(spec.tag).to eq("_")
|
55
55
|
end
|
56
56
|
|
57
57
|
it "should make the keep false when false or nil" do
|
58
58
|
spec = Riak::WalkSpec.new(nil, nil, nil)
|
59
|
-
spec.keep.
|
59
|
+
expect(spec.keep).to be_falsey
|
60
60
|
spec = Riak::WalkSpec.new(nil, nil, false)
|
61
|
-
spec.keep.
|
61
|
+
expect(spec.keep).to be_falsey
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
65
|
it "should raise an ArgumentError for invalid arguments" do
|
66
|
-
|
67
|
-
|
68
|
-
|
66
|
+
expect { Riak::WalkSpec.new }.to raise_error(ArgumentError)
|
67
|
+
expect { Riak::WalkSpec.new("foo") }.to raise_error(ArgumentError)
|
68
|
+
expect { Riak::WalkSpec.new("foo","bar") }.to raise_error(ArgumentError)
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
@@ -75,31 +75,31 @@ describe Riak::WalkSpec do
|
|
75
75
|
end
|
76
76
|
|
77
77
|
it "should be the empty spec by default" do
|
78
|
-
@spec.to_s.
|
78
|
+
expect(@spec.to_s).to eq("_,_,_")
|
79
79
|
end
|
80
80
|
|
81
81
|
it "should include the bucket when set" do
|
82
82
|
@spec.bucket = "foo"
|
83
|
-
@spec.to_s.
|
83
|
+
expect(@spec.to_s).to eq("foo,_,_")
|
84
84
|
end
|
85
85
|
|
86
86
|
it "should include the tag when set" do
|
87
87
|
@spec.tag = "next"
|
88
|
-
@spec.to_s.
|
88
|
+
expect(@spec.to_s).to eq("_,next,_")
|
89
89
|
end
|
90
90
|
|
91
91
|
it "should include the keep when true" do
|
92
92
|
@spec.keep = true
|
93
|
-
@spec.to_s.
|
93
|
+
expect(@spec.to_s).to eq("_,_,1")
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
97
|
describe "creating from a list of parameters" do
|
98
98
|
it "should detect hashes and WalkSpecs interleaved with other parameters" do
|
99
99
|
specs = Riak::WalkSpec.normalize(nil,"next",nil,{:bucket => "foo"},Riak::WalkSpec.new({:tag => "child", :keep => true}))
|
100
|
-
specs.
|
101
|
-
specs.
|
102
|
-
specs.join("/").
|
100
|
+
expect(specs.size).to eq(3)
|
101
|
+
expect(specs).to be_all {|s| s.kind_of?(Riak::WalkSpec) }
|
102
|
+
expect(specs.join("/")).to eq("_,next,_/foo,_,_/_,child,1")
|
103
103
|
end
|
104
104
|
|
105
105
|
it "should raise an error when given invalid number of parameters" do
|
@@ -113,7 +113,7 @@ describe Riak::WalkSpec do
|
|
113
113
|
end
|
114
114
|
|
115
115
|
it "should not match objects that aren't links or walk specs" do
|
116
|
-
@spec.
|
116
|
+
expect(@spec).not_to be === "foo"
|
117
117
|
end
|
118
118
|
|
119
119
|
describe "matching links" do
|
@@ -122,32 +122,32 @@ describe Riak::WalkSpec do
|
|
122
122
|
end
|
123
123
|
|
124
124
|
it "should match a link when the bucket and tag are not specified" do
|
125
|
-
@spec.
|
125
|
+
expect(@spec).to be === @link
|
126
126
|
end
|
127
127
|
|
128
128
|
it "should match a link when the bucket is the same" do
|
129
129
|
@spec.bucket = "foo"
|
130
|
-
@spec.
|
130
|
+
expect(@spec).to be === @link
|
131
131
|
end
|
132
132
|
|
133
133
|
it "should not match a link when the bucket is different" do
|
134
134
|
@spec.bucket = "bar"
|
135
|
-
@spec.
|
135
|
+
expect(@spec).not_to be === @link
|
136
136
|
end
|
137
137
|
|
138
138
|
it "should match a link when the tag is the same" do
|
139
139
|
@spec.tag = "next"
|
140
|
-
@spec.
|
140
|
+
expect(@spec).to be === @link
|
141
141
|
end
|
142
142
|
|
143
143
|
it "should not match a link when the tag is different" do
|
144
144
|
@spec.tag = "previous"
|
145
|
-
@spec.
|
145
|
+
expect(@spec).not_to be === @link
|
146
146
|
end
|
147
147
|
|
148
148
|
it "should match a link when the bucket and tag are the same" do
|
149
149
|
@spec.bucket = "foo"
|
150
|
-
@spec.
|
150
|
+
expect(@spec).to be === @link
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
@@ -157,42 +157,42 @@ describe Riak::WalkSpec do
|
|
157
157
|
end
|
158
158
|
|
159
159
|
it "should match a walk spec that is equivalent" do
|
160
|
-
@spec.
|
160
|
+
expect(@spec).to be === @other
|
161
161
|
end
|
162
162
|
|
163
163
|
it "should not match a walk spec that has a different keep value" do
|
164
164
|
@other.keep = true
|
165
|
-
@spec.
|
165
|
+
expect(@spec).not_to be === @other
|
166
166
|
end
|
167
167
|
|
168
168
|
it "should match a walk spec with a more specific bucket" do
|
169
169
|
@other.bucket = "foo"
|
170
|
-
@spec.
|
170
|
+
expect(@spec).to be === @other
|
171
171
|
end
|
172
172
|
|
173
173
|
it "should match a walk spec with the same bucket" do
|
174
174
|
@other.bucket = "foo"; @spec.bucket = "foo"
|
175
|
-
@spec.
|
175
|
+
expect(@spec).to be === @other
|
176
176
|
end
|
177
177
|
|
178
178
|
it "should not match a walk spec with a different bucket" do
|
179
179
|
@other.bucket = "foo"; @spec.bucket = "bar"
|
180
|
-
@spec.
|
180
|
+
expect(@spec).not_to be === @other
|
181
181
|
end
|
182
182
|
|
183
183
|
it "should match a walk spec with a more specific tag" do
|
184
184
|
@other.tag = "next"
|
185
|
-
@spec.
|
185
|
+
expect(@spec).to be === @other
|
186
186
|
end
|
187
187
|
|
188
188
|
it "should match a walk spec with the same tag" do
|
189
189
|
@other.tag = "next"; @spec.tag = "next"
|
190
|
-
@spec.
|
190
|
+
expect(@spec).to be === @other
|
191
191
|
end
|
192
192
|
|
193
193
|
it "should not match a walk spec with a different tag" do
|
194
194
|
@other.tag = "next"; @spec.tag = "previous"
|
195
|
-
@spec.
|
195
|
+
expect(@spec).not_to be === @other
|
196
196
|
end
|
197
197
|
end
|
198
198
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
2
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
3
|
|
4
|
+
if ENV['COVERAGE']
|
5
|
+
require 'simplecov'
|
6
|
+
SimpleCov.start
|
7
|
+
end
|
8
|
+
|
4
9
|
require 'rubygems' # Use the gems path only for the spec suite
|
5
10
|
require 'riak'
|
6
11
|
require 'rspec'
|
7
|
-
require 'fakeweb'
|
8
12
|
require 'stringio'
|
9
13
|
|
10
14
|
# Only the tests should really get away with this.
|
@@ -12,15 +16,10 @@ Riak.disable_list_keys_warnings = true
|
|
12
16
|
|
13
17
|
%w[integration_setup
|
14
18
|
version_filter
|
15
|
-
|
16
|
-
http_backend_implementation_examples
|
19
|
+
wait_until
|
17
20
|
search_corpus_setup
|
18
21
|
unified_backend_examples
|
19
|
-
|
20
|
-
mock_server
|
21
|
-
drb_mock_server
|
22
|
-
test_server
|
23
|
-
riak_test].each do |file|
|
22
|
+
test_client].each do |file|
|
24
23
|
require File.join("support", file)
|
25
24
|
end
|
26
25
|
|
@@ -28,17 +27,14 @@ RSpec.configure do |config|
|
|
28
27
|
#config.debug = true
|
29
28
|
config.mock_with :rspec
|
30
29
|
|
31
|
-
config.before(:all, :integration => true) do
|
32
|
-
FakeWeb.allow_net_connect = true
|
33
|
-
end
|
34
|
-
|
35
|
-
config.after(:all, :integration => true) do
|
36
|
-
FakeWeb.allow_net_connect = false
|
37
|
-
end
|
38
|
-
|
39
30
|
config.before(:each) do
|
40
31
|
Riak::RObject.on_conflict_hooks.clear
|
41
|
-
|
32
|
+
end
|
33
|
+
|
34
|
+
if TestClient.test_client_configuration[:authentication]
|
35
|
+
config.filter_run_excluding no_security: true
|
36
|
+
else
|
37
|
+
config.filter_run_excluding yes_security: true
|
42
38
|
end
|
43
39
|
|
44
40
|
config.filter_run :focus => true
|
@@ -50,9 +46,5 @@ RSpec.configure do |config|
|
|
50
46
|
config.order = :random
|
51
47
|
end
|
52
48
|
|
53
|
-
|
54
|
-
require 'instrumentable'
|
55
|
-
rescue LoadError => e
|
56
|
-
config.filter_run_excluding instrumentation: true
|
57
|
-
end
|
49
|
+
config.raise_errors_for_deprecations!
|
58
50
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
**DO NOT USE THESE IN PRODUCTION**
|
2
|
+
|
3
|
+
This directory has certificates and a key for testing Riak authentication.
|
4
|
+
|
5
|
+
* server.key - a private key for a Riak server
|
6
|
+
* server.crt - the certificate for server.key
|
7
|
+
* ca.crt - a certificate for the CA that issued server.crt
|
8
|
+
* empty_ca.crt - a certificate for a CA that has and cannot ever issue a
|
9
|
+
certificate (I deleted its private key)
|
10
|
+
|
11
|
+
**DO NOT USE THESE IN PRODUCTION**
|
12
|
+
|
13
|
+
These were generated using https://github.com/basho-labs/riak-ruby-ca .
|
@@ -0,0 +1,22 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIDnjCCAoYCCQCfWsYVjCNEnTANBgkqhkiG9w0BAQUFADCBkDELMAkGA1UEBhMC
|
3
|
+
VVMxEzARBgNVBAgMCldhc2hpbmd0b24xEDAOBgNVBAcMB1NlYXR0bGUxDjAMBgNV
|
4
|
+
BAoMBUJhc2hvMRswGQYDVQQLDBJSaWFrIFB5dGhvbiBDbGllbnQxCzAJBgNVBAMM
|
5
|
+
AkNBMSAwHgYJKoZIhvcNAQkBFhFjbGllbnRzQGJhc2hvLmNvbTAeFw0xNDA1Mjcx
|
6
|
+
OTQyNDhaFw0yNDA1MjQxOTQyNDhaMIGQMQswCQYDVQQGEwJVUzETMBEGA1UECAwK
|
7
|
+
V2FzaGluZ3RvbjEQMA4GA1UEBwwHU2VhdHRsZTEOMAwGA1UECgwFQmFzaG8xGzAZ
|
8
|
+
BgNVBAsMElJpYWsgUHl0aG9uIENsaWVudDELMAkGA1UEAwwCQ0ExIDAeBgkqhkiG
|
9
|
+
9w0BCQEWEWNsaWVudHNAYmFzaG8uY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
|
10
|
+
MIIBCgKCAQEAyb+RlRZKQc5RkUK1CIeiWizz52uy98CJzpEdgZfLJuWv2wCqWZLD
|
11
|
+
j3BWpa0uSQCT7F7EdXBpjFOCYx48nTTbNekL2osYm5lH/9QP3tZp+oomSxeZTc7C
|
12
|
+
DsnW2/7KPmgE+B8Zs7Q1v2VXj2NyaUmozDWbp80VPMA332B61TTOGXKthQeD/n6W
|
13
|
+
/mkH044oG5PMOvMMlNaYx0dsRy73m49DwIG/iZs0ri/sFuOKapOM+Jyi31GF7f50
|
14
|
+
hDLNhpOZi2wvAoEdE5c0BfwILqR5rJBsfZzjUnTdYnLE9C1xR0ntE+MgCrxMdvM7
|
15
|
+
VtJR0GNSQuW9LUxA6MeYimqHkfjtgDyX8wIDAQABMA0GCSqGSIb3DQEBBQUAA4IB
|
16
|
+
AQB9IRE9eir6w2VkVHZanzOrbJVI0xO4o9+y0EXXl575C4uUs3+T7VBo8RQt2Pkn
|
17
|
+
JULRVkff37XdblNLEQc5qNoSVu0vXLOjqybletXLD6ysaCn/4EkVrDrM9T5xO01H
|
18
|
+
TDUnzBap+Z/YQc6iGaeFUaxPNYBqBypSHxqU2rbtIiok3xNXxgv65ijpdWSL/zzO
|
19
|
+
g0P1cGECnsLRgui3AGVa5LioYUvy2eUj+xoasFpArZ3Cn5OTeAFHnnYFbKgdNQWm
|
20
|
+
z98RktSlUMDE6EFnmzSBj/3l/CyEzZ2XTz//N3hPZs3LnEccGWUzadqQyO5pgExV
|
21
|
+
VEcFwFceAhIM4PsZteI4m9nG
|
22
|
+
-----END CERTIFICATE-----
|
@@ -0,0 +1,95 @@
|
|
1
|
+
Certificate:
|
2
|
+
Data:
|
3
|
+
Version: 3 (0x2)
|
4
|
+
Serial Number: 6741516 (0x66de0c)
|
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:46 2014 GMT
|
9
|
+
Not After : May 24 19:42:46 2024 GMT
|
10
|
+
Subject: C=US, ST=Washington, O=Basho, OU=Riak Python Client, CN=certuser/emailAddress=clients@basho.com
|
11
|
+
Subject Public Key Info:
|
12
|
+
Public Key Algorithm: rsaEncryption
|
13
|
+
Public-Key: (2048 bit)
|
14
|
+
Modulus:
|
15
|
+
00:b1:89:99:8c:dc:2c:c3:1d:fb:a2:c3:fd:bf:a4:
|
16
|
+
2c:b2:b7:6c:9b:af:f9:d2:de:42:d9:9b:c5:1c:e8:
|
17
|
+
3f:54:db:85:68:a7:d0:4a:5e:52:5c:0e:2e:77:24:
|
18
|
+
76:c8:cd:4a:e7:27:5c:48:00:ff:14:75:ce:c2:a2:
|
19
|
+
c8:70:e6:2b:d6:9f:d5:e9:04:88:5c:c1:3a:94:f8:
|
20
|
+
89:48:74:9e:bf:ef:25:d1:99:b1:5f:d3:bc:c5:21:
|
21
|
+
f4:e9:56:51:08:9f:2d:b0:c1:cf:6b:cc:09:fb:9a:
|
22
|
+
ea:12:a3:ae:57:70:14:63:c5:8b:ae:92:16:c9:ec:
|
23
|
+
7e:bc:03:5a:c9:94:b8:d3:1d:32:d8:1f:90:7b:9f:
|
24
|
+
75:f3:01:30:a7:bd:a7:f9:c4:b1:ad:5d:0e:76:7f:
|
25
|
+
dd:df:01:a1:b3:18:e7:76:d6:e1:14:6d:5c:7a:86:
|
26
|
+
6f:56:05:a8:5d:0f:70:b2:68:ca:ac:80:11:2a:71:
|
27
|
+
cc:4a:17:07:6e:d3:d3:9c:3e:51:a8:83:55:9a:2f:
|
28
|
+
10:85:e0:2d:81:be:3d:8e:d4:f7:ff:0b:1b:95:f9:
|
29
|
+
fc:7e:fa:c7:5a:88:ed:ae:55:c6:42:69:80:15:45:
|
30
|
+
87:31:ab:bb:17:70:d8:d9:c1:48:41:cf:75:3b:ad:
|
31
|
+
0f:46:20:11:59:fd:b8:96:a4:ea:a0:85:7e:42:a6:
|
32
|
+
19:81
|
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
|
+
A6:FF:15:58:E1:37:34:03:E4:1D:46:56:A4:66:60:62:CD:02:9E:85
|
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:E1:10:A9:1E:39:1D:6B:C1
|
48
|
+
|
49
|
+
X509v3 Extended Key Usage:
|
50
|
+
TLS Web Server Authentication, TLS Web Client Authentication
|
51
|
+
Signature Algorithm: sha1WithRSAEncryption
|
52
|
+
bf:db:c4:09:e5:d3:51:5f:81:79:fc:04:b4:97:e7:4a:be:86:
|
53
|
+
3e:33:0a:c6:00:24:15:85:9a:d4:5c:dc:7c:d4:88:c6:c8:d3:
|
54
|
+
26:64:1d:0f:97:36:70:2b:04:c2:c3:b1:fb:d7:36:e2:51:80:
|
55
|
+
a9:0c:ab:8a:fd:4f:50:cb:0e:23:e6:b2:e4:6c:59:0b:44:c2:
|
56
|
+
66:2f:6c:60:b5:3f:e0:b8:e0:01:a5:1b:57:83:4e:38:a4:6a:
|
57
|
+
56:10:ec:9b:17:57:7c:4a:0a:8b:13:b5:19:69:e2:9f:47:20:
|
58
|
+
14:83:bf:f1:5e:cd:b8:5c:09:f0:a9:d1:4e:63:a4:2d:73:bb:
|
59
|
+
1d:56:d3:89:d1:ac:ca:f9:c8:4b:8c:e2:a8:65:aa:c6:af:9c:
|
60
|
+
dd:c9:36:2d:ba:16:b1:6d:52:44:f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