ceph-ruby-livelink 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,88 @@
1
+ require 'spec_helper'
2
+
3
+ describe CephRuby::Xattr do
4
+ let(:config) { cluster_config }
5
+ let(:cluster) { ::CephRuby::Cluster.new(config) }
6
+ let(:pool_name) { config[:pool][:name] }
7
+ let(:crush_id) { config[:pool][:rule_id] }
8
+ let(:pool) { cluster.pool(pool_name) }
9
+ let(:object_name) { config[:pool][:object_name] }
10
+
11
+ describe 'pool creation', requires_create_delete: true do
12
+ subject { pool }
13
+ it 'should be creatable' do
14
+ expect { pool.create(rule_id: crush_id) }.to_not raise_exception
15
+ end
16
+ end
17
+
18
+ describe 'for a Named Rados Object' do
19
+ let(:rados_object) { pool.rados_object(object_name) }
20
+ let(:rados_object_content) do
21
+ 'subject content subject content '\
22
+ 'subject content subject content '\
23
+ 'subject content subject content '\
24
+ 'subject content subject content'
25
+ end
26
+
27
+ subject { rados_object }
28
+ let(:xattribute_key) { 'testxattr_key' }
29
+ let(:xattribute_val) { 'testxattr_value' }
30
+ let(:xattribute_large_val) { 'abcdefghijklmnopqrstuvwxyz0123456789~!@#$^' }
31
+ it 'Should be a ::CephRuby::RadosObject object' do
32
+ expect(subject).to be_a ::CephRuby::RadosObject
33
+ end
34
+
35
+ describe 'during object creation' do
36
+ it 'should be writable' do
37
+ expect { subject.write(0, rados_object_content) }.not_to raise_exception
38
+ end
39
+ end
40
+
41
+ describe 'after object creation' do
42
+ subject { rados_object.xattr_enumerator }
43
+
44
+ describe 'methods' do
45
+ it 'should respond to each' do
46
+ expect(subject).to respond_to :each
47
+ end
48
+
49
+ it 'should respond to close' do
50
+ expect(subject).to respond_to :close
51
+ end
52
+
53
+ it 'should respond to open' do
54
+ expect(subject).to respond_to :open
55
+ end
56
+
57
+ it 'should respond to open?' do
58
+ expect(subject).to respond_to :open?
59
+ end
60
+ end
61
+
62
+ describe 'with no xattr associated' do
63
+ it 'should have no entries' do
64
+ expect(subject.inject(0) { |a, _e| a + 1 }).to be 0
65
+ end
66
+ end
67
+
68
+ describe 'after xattr added' do
69
+ before { rados_object.xattr(xattribute_key).value = xattribute_val }
70
+
71
+ it 'should yield Xattr objects' do
72
+ expect(subject.first).to be_a ::CephRuby::Xattr
73
+ end
74
+
75
+ it 'should have the xattr in the list' do
76
+ expect(subject.any? { |x| x.name == xattribute_key }).to be true
77
+ end
78
+ end
79
+ end
80
+ end
81
+
82
+ describe 'pool tidyup', requires_create_delete: true do
83
+ subject { pool }
84
+ it 'should be destroyable' do
85
+ expect { pool.destroy }.to_not raise_exception
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,122 @@
1
+ require 'spec_helper'
2
+
3
+ describe CephRuby::Xattr do
4
+ let(:config) { cluster_config }
5
+ let(:cluster) { ::CephRuby::Cluster.new(config) }
6
+ let(:pool_name) { config[:pool][:name] }
7
+ let(:crush_id) { config[:pool][:rule_id] }
8
+ let(:pool) { cluster.pool(pool_name) }
9
+ let(:object_name) { config[:pool][:object_name] }
10
+
11
+ describe 'pool creation', requires_create_delete: true do
12
+ subject { pool }
13
+ it 'should be creatable' do
14
+ expect { pool.create(rule_id: crush_id) }.to_not raise_exception
15
+ end
16
+ end
17
+
18
+ describe 'for a Named Rados Object' do
19
+ let(:rados_object) { pool.rados_object(object_name) }
20
+ let(:rados_object_content) do
21
+ 'subject content subject content '\
22
+ 'subject content subject content '\
23
+ 'subject content subject content '\
24
+ 'subject content subject content'
25
+ end
26
+
27
+ subject { rados_object }
28
+ let(:xattribute_key) { 'testxattr_key' }
29
+ let(:xattribute_val) { 'testxattr_value' }
30
+ let(:xattribute_large_val) { 'abcdefghijklmnopqrstuvwxyz0123456789~!@#$^' }
31
+ it 'Should be a ::CephRuby::RadosObject object' do
32
+ expect(subject).to be_a ::CephRuby::RadosObject
33
+ end
34
+
35
+ describe 'before object creation' do
36
+ it 'should not exist' do
37
+ expect(subject.exist?).to be false
38
+ end
39
+
40
+ describe 'Xattr' do
41
+ subject { rados_object.xattr(xattribute_key) }
42
+
43
+ it 'should raise an exception if added to a nil rados object' do
44
+ expect { subject }.to raise_exception Errno::ENOENT
45
+ end
46
+ end
47
+ end
48
+
49
+ describe 'during object creation' do
50
+ it 'should be writable' do
51
+ expect { subject.write(0, rados_object_content) }.not_to raise_exception
52
+ end
53
+ end
54
+
55
+ describe 'after object creation' do
56
+ subject { rados_object.xattr(xattribute_key) }
57
+
58
+ describe 'methods' do
59
+ it 'should respond to value' do
60
+ expect(subject).to respond_to :value
61
+ end
62
+
63
+ it 'should respond to value=' do
64
+ expect(subject).to respond_to :value
65
+ end
66
+
67
+ it 'should respond to destroy' do
68
+ expect(subject).to respond_to :destroy
69
+ end
70
+ end
71
+
72
+ describe 'calling value on an empty xattr' do
73
+ it 'should throw an exception' do
74
+ expect { subject.value }.to raise_exception(Errno::ENODATA)
75
+ end
76
+ end
77
+
78
+ describe 'calling value=' do
79
+ it 'should not throw an exception' do
80
+ expect { subject.value = xattribute_val }.not_to raise_exception
81
+ end
82
+
83
+ describe 'then calling value' do
84
+ it 'should return the value' do
85
+ expect(subject.value).to eq(xattribute_val)
86
+ end
87
+ end
88
+ end
89
+
90
+ describe 'calling value= with larger value' do
91
+ it 'should not throw an exception' do
92
+ expect { subject.value = xattribute_large_val }.not_to raise_exception
93
+ end
94
+
95
+ describe 'then calling value' do
96
+ it 'should match the value' do
97
+ expect(subject.value).to eq(xattribute_large_val)
98
+ end
99
+ end
100
+ end
101
+
102
+ describe 'calling value= with the original value' do
103
+ it 'should not throw an exception' do
104
+ expect { subject.value = xattribute_val }.not_to raise_exception
105
+ end
106
+
107
+ describe 'then calling value' do
108
+ it 'should return the value' do
109
+ expect(subject.value).to eq(xattribute_val)
110
+ end
111
+ end
112
+ end
113
+ end
114
+ end
115
+
116
+ describe 'pool tidyup', requires_create_delete: true do
117
+ subject { pool }
118
+ it 'should be destroyable' do
119
+ expect { pool.destroy }.to_not raise_exception
120
+ end
121
+ end
122
+ end
@@ -0,0 +1,23 @@
1
+ require 'ceph-ruby'
2
+ require 'yaml'
3
+
4
+ def cluster_config
5
+ YAML.load(File.read('.cluster.yml')) if File.exist? '.cluster.yml'
6
+ end
7
+
8
+ def spec_config
9
+ YAML.load(File.read('.cluster.yml')) if File.exist? '.cluster.yml'
10
+ end
11
+ RSpec.configure do |c|
12
+ config = cluster_config
13
+ c.fail_fast = true
14
+ c.filter_run_excluding(
15
+ requires_cluster_readable: true
16
+ ) unless config[:readable]
17
+ c.filter_run_excluding(
18
+ requires_create_delete: true
19
+ ) unless config[:pool][:create_delete]
20
+ c.filter_run_excluding(
21
+ requires_create_delete: false
22
+ ) if config[:pool][:create_delete]
23
+ end
data/tasks/rspec.rake ADDED
@@ -0,0 +1,4 @@
1
+ require 'rspec/core/rake_task'
2
+
3
+ desc 'rspec tasks for spec directory'
4
+ RSpec::Core::RakeTask.new(:spec)
@@ -0,0 +1,13 @@
1
+ require 'rubocop/rake_task'
2
+
3
+ desc 'Rub RoboCop on the lib and spec directory'
4
+ RuboCop::RakeTask.new(:rubocop_dev) do |task|
5
+ task.patterns = ['lib/**/*.rb', 'spec/**/*.rb']
6
+ task.fail_on_error = false
7
+ end
8
+
9
+ RuboCop::RakeTask.new(:rubocop_test) do |task|
10
+ task.patterns = ['lib/**/*.rb', 'spec/**/*.rb']
11
+ task.formatters = ['files']
12
+ task.fail_on_error = true
13
+ end
metadata ADDED
@@ -0,0 +1,236 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ceph-ruby-livelink
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.5.1
5
+ platform: ruby
6
+ authors:
7
+ - Netskin GmbH
8
+ - Corin Langosch
9
+ - LivelinkTechnology LTD
10
+ - Stuart Harland
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+ date: 2016-05-23 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: ffi
18
+ requirement: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - "~>"
21
+ - !ruby/object:Gem::Version
22
+ version: '1.9'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.9'
30
+ - !ruby/object:Gem::Dependency
31
+ name: activesupport
32
+ requirement: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - "~>"
35
+ - !ruby/object:Gem::Version
36
+ version: '3.0'
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '3.0'
44
+ - !ruby/object:Gem::Dependency
45
+ name: guard
46
+ requirement: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - "~>"
49
+ - !ruby/object:Gem::Version
50
+ version: '2.13'
51
+ type: :development
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '2.13'
58
+ - !ruby/object:Gem::Dependency
59
+ name: guard-rake
60
+ requirement: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - "~>"
63
+ - !ruby/object:Gem::Version
64
+ version: '1.0'
65
+ type: :development
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - "~>"
70
+ - !ruby/object:Gem::Version
71
+ version: '1.0'
72
+ - !ruby/object:Gem::Dependency
73
+ name: guard-rspec
74
+ requirement: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - "~>"
77
+ - !ruby/object:Gem::Version
78
+ version: '4.6'
79
+ type: :development
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - "~>"
84
+ - !ruby/object:Gem::Version
85
+ version: '4.6'
86
+ - !ruby/object:Gem::Dependency
87
+ name: guard-bundler
88
+ requirement: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - "~>"
91
+ - !ruby/object:Gem::Version
92
+ version: '2.1'
93
+ type: :development
94
+ prerelease: false
95
+ version_requirements: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: '2.1'
100
+ - !ruby/object:Gem::Dependency
101
+ name: rubocop
102
+ requirement: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - "~>"
105
+ - !ruby/object:Gem::Version
106
+ version: '0.39'
107
+ type: :development
108
+ prerelease: false
109
+ version_requirements: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - "~>"
112
+ - !ruby/object:Gem::Version
113
+ version: '0.39'
114
+ - !ruby/object:Gem::Dependency
115
+ name: rspec
116
+ requirement: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - "~>"
119
+ - !ruby/object:Gem::Version
120
+ version: '3.4'
121
+ type: :development
122
+ prerelease: false
123
+ version_requirements: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - "~>"
126
+ - !ruby/object:Gem::Version
127
+ version: '3.4'
128
+ - !ruby/object:Gem::Dependency
129
+ name: rake
130
+ requirement: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - "~>"
133
+ - !ruby/object:Gem::Version
134
+ version: '11.1'
135
+ type: :development
136
+ prerelease: false
137
+ version_requirements: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - "~>"
140
+ - !ruby/object:Gem::Version
141
+ version: '11.1'
142
+ - !ruby/object:Gem::Dependency
143
+ name: bundler
144
+ requirement: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - "~>"
147
+ - !ruby/object:Gem::Version
148
+ version: '1.3'
149
+ type: :development
150
+ prerelease: false
151
+ version_requirements: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - "~>"
154
+ - !ruby/object:Gem::Version
155
+ version: '1.3'
156
+ description: Easy management of Ceph
157
+ email:
158
+ - info@netskin.com
159
+ - info@corinlangosch.com
160
+ - infraops@livelinktechnology.net
161
+ - s.harland@livelinktechnology.net
162
+ executables: []
163
+ extensions: []
164
+ extra_rdoc_files: []
165
+ files:
166
+ - ".cluster.example.yml"
167
+ - ".gitignore"
168
+ - ".rspec"
169
+ - ".rubocop.yml"
170
+ - Gemfile
171
+ - Guardfile
172
+ - LICENSE.txt
173
+ - README.md
174
+ - Rakefile
175
+ - ceph-ruby.gemspec
176
+ - lib/ceph-ruby.rb
177
+ - lib/ceph-ruby/cluster.rb
178
+ - lib/ceph-ruby/cluster_helper.rb
179
+ - lib/ceph-ruby/lib/rados.rb
180
+ - lib/ceph-ruby/lib/rbd.rb
181
+ - lib/ceph-ruby/pool.rb
182
+ - lib/ceph-ruby/pool_enumerator.rb
183
+ - lib/ceph-ruby/pool_helper.rb
184
+ - lib/ceph-ruby/rados_aio_completion.rb
185
+ - lib/ceph-ruby/rados_aio_object.rb
186
+ - lib/ceph-ruby/rados_block_device.rb
187
+ - lib/ceph-ruby/rados_block_device_helper.rb
188
+ - lib/ceph-ruby/rados_object.rb
189
+ - lib/ceph-ruby/rados_object_enumerator.rb
190
+ - lib/ceph-ruby/version.rb
191
+ - lib/ceph-ruby/xattr.rb
192
+ - lib/ceph-ruby/xattr_enumerator.rb
193
+ - spec/ceph_ruby_cluster_spec.rb
194
+ - spec/ceph_ruby_pool_enumerator_spec.rb
195
+ - spec/ceph_ruby_pool_spec.rb
196
+ - spec/ceph_ruby_rados_object_enumerator_spec.rb
197
+ - spec/ceph_ruby_rados_object_spec.rb
198
+ - spec/ceph_ruby_xattr_enumerator_spec.rb
199
+ - spec/ceph_ruby_xattr_spec.rb
200
+ - spec/spec_helper.rb
201
+ - tasks/rspec.rake
202
+ - tasks/rubocop.rake
203
+ homepage: http://github.com/livelink/ceph-ruby
204
+ licenses:
205
+ - MIT
206
+ metadata: {}
207
+ post_install_message:
208
+ rdoc_options: []
209
+ require_paths:
210
+ - lib
211
+ required_ruby_version: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ required_rubygems_version: !ruby/object:Gem::Requirement
217
+ requirements:
218
+ - - ">="
219
+ - !ruby/object:Gem::Version
220
+ version: '0'
221
+ requirements: []
222
+ rubyforge_project:
223
+ rubygems_version: 2.6.2
224
+ signing_key:
225
+ specification_version: 4
226
+ summary: Easy management of Ceph Distributed Storage System
227
+ test_files:
228
+ - spec/ceph_ruby_cluster_spec.rb
229
+ - spec/ceph_ruby_pool_enumerator_spec.rb
230
+ - spec/ceph_ruby_pool_spec.rb
231
+ - spec/ceph_ruby_rados_object_enumerator_spec.rb
232
+ - spec/ceph_ruby_rados_object_spec.rb
233
+ - spec/ceph_ruby_xattr_enumerator_spec.rb
234
+ - spec/ceph_ruby_xattr_spec.rb
235
+ - spec/spec_helper.rb
236
+ has_rdoc: