libgfapi-ruby 0.0.6 → 0.0.7
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.
- checksums.yaml +4 -4
- data/README.md +19 -0
- data/lib/glusterfs/version.rb +1 -1
- data/libgfapi-ruby.gemspec +1 -0
- data/spec/glusterfs/memleak_spec.rb +70 -0
- metadata +17 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc23e8e61cab7ae1e59207844201a7f1d3e61919
|
4
|
+
data.tar.gz: a06dd442af33340a906cac88244668b90554b585
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4483213f2ef51f6c96c225e04f6b794da819a275332e91edc8f06510ed50a18e4f3740985d3e03221369e512e2794ec400b29114d34f7c2a3e165a023f4c245e
|
7
|
+
data.tar.gz: ef0c69e51653edd3075105aa89e5a87d1da6d45401fad0d2330a0a1966400371d9330ce587920dc572c7b7f19cfb3897740daae06368b5faefedd8f4ad7443dc
|
data/README.md
CHANGED
@@ -66,6 +66,25 @@ file.unlink
|
|
66
66
|
volume.unmount
|
67
67
|
```
|
68
68
|
|
69
|
+
## Running Specs
|
70
|
+
|
71
|
+
Run specs with `rake spec`. However, you need glusterfs-server running somewhere, and a test mount.
|
72
|
+
If you have it in the computer you want to run your tests at (Vagrant works fine), you can do this:
|
73
|
+
|
74
|
+
1. Add `127.0.0.1 distfs` to `/etc/hosts`
|
75
|
+
2. Run `gluster volume create dist-volume distfs:/dist1 force`
|
76
|
+
3. Run `gluster volume start dist-volume`
|
77
|
+
4. Run `rake spec`
|
78
|
+
|
79
|
+
Another option - use existing cluster, set following env variables before running tests:
|
80
|
+
|
81
|
+
```bash
|
82
|
+
export GFS_VOLUME='volume-name'
|
83
|
+
export GFS_SERVER_HOST='1.2.3.4'
|
84
|
+
export GFS_SERVER_PORT=24007
|
85
|
+
rake spec
|
86
|
+
```
|
87
|
+
|
69
88
|
## Contributing
|
70
89
|
|
71
90
|
1. Fork it ( http://github.com/spajus/libgfapi-ruby/fork )
|
data/lib/glusterfs/version.rb
CHANGED
data/libgfapi-ruby.gemspec
CHANGED
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'ruby-mass'
|
2
|
+
module GlusterFS
|
3
|
+
|
4
|
+
def self.mem_size
|
5
|
+
# ObjectSpace.garbage_collect
|
6
|
+
# sleep 3
|
7
|
+
_, size = `ps ax -o pid,rss | grep -E "^[[:space:]]*#{$$}"`.strip.split.map(&:to_i)
|
8
|
+
size.to_i
|
9
|
+
end
|
10
|
+
|
11
|
+
describe 'memleaks' do
|
12
|
+
|
13
|
+
let(:iterations) { 10000 }
|
14
|
+
|
15
|
+
before(:all) do
|
16
|
+
puts "GC Settings"
|
17
|
+
puts "RUBY_HEAP_MIN_SLOTS=#{ENV['RUBY_HEAP_MIN_SLOTS']}"
|
18
|
+
puts "RUBY_HEAP_SLOTS_INCREMENT=#{ENV['RUBY_HEAP_SLOTS_INCREMENT']}"
|
19
|
+
puts "RUBY_HEAP_SLOTS_GROWTH_FACTOR=#{ENV['RUBY_HEAP_SLOTS_GROWTH_FACTOR']}"
|
20
|
+
puts "RUBY_GC_MALLOC_LIMIT=#{ENV['RUBY_GC_MALLOC_LIMIT']}"
|
21
|
+
puts "RUBY_FREE_MIN=#{ENV['RUBY_FREE_MIN']}"
|
22
|
+
puts "Initial memory use: #{GlusterFS.mem_size}"
|
23
|
+
Mass.print
|
24
|
+
end
|
25
|
+
|
26
|
+
let(:random_blob) do
|
27
|
+
o = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten
|
28
|
+
(0...15000).map { o[rand(o.length)] }.join
|
29
|
+
end
|
30
|
+
let(:volume) { Volume.new(GFS_VOLUME)
|
31
|
+
.mount(GFS_SERVER_HOST, GFS_SERVER_PORT) }
|
32
|
+
let(:root_dir) { Directory.new(volume, '/memtest-root') }
|
33
|
+
|
34
|
+
context 'create many directories' do
|
35
|
+
before { root_dir.create }
|
36
|
+
after { root_dir.delete }
|
37
|
+
specify do
|
38
|
+
puts "Iterations: #{iterations}"
|
39
|
+
mem_size_before = GlusterFS.mem_size
|
40
|
+
iterations.times do |i|
|
41
|
+
dir = Directory.new(volume, "#{root_dir.path}/subdir-#{i}")
|
42
|
+
dir.create
|
43
|
+
dir.delete
|
44
|
+
end
|
45
|
+
mem_size = GlusterFS.mem_size
|
46
|
+
puts "Mem growth: #{mem_size - mem_size_before}"
|
47
|
+
Mass.print
|
48
|
+
(mem_size - mem_size_before).should be < 10240
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context 'create many files' do
|
53
|
+
before { root_dir.create }
|
54
|
+
after { root_dir.delete }
|
55
|
+
specify do
|
56
|
+
puts "Iterations: #{iterations}"
|
57
|
+
mem_size_before = GlusterFS.mem_size
|
58
|
+
iterations.times do |i|
|
59
|
+
file = File.new(volume, "#{root_dir.path}/file-#{i}")
|
60
|
+
file.write(random_blob)
|
61
|
+
file.delete
|
62
|
+
end
|
63
|
+
mem_size = GlusterFS.mem_size
|
64
|
+
puts "Mem growth: #{mem_size - mem_size_before}"
|
65
|
+
Mass.print
|
66
|
+
(mem_size - mem_size_before).should be < 10240
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libgfapi-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Varaneckas
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: ruby-mass
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description: Ruby bindings for libgfapi (GlusterFS API)
|
70
84
|
email:
|
71
85
|
- tomas.varaneckas@gmail.com
|
@@ -89,6 +103,7 @@ files:
|
|
89
103
|
- libgfapi-ruby.gemspec
|
90
104
|
- spec/glusterfs/directory_spec.rb
|
91
105
|
- spec/glusterfs/file_spec.rb
|
106
|
+
- spec/glusterfs/memleak_spec.rb
|
92
107
|
- spec/glusterfs/volume_spec.rb
|
93
108
|
- spec/spec_helper.rb
|
94
109
|
homepage: https://github.com/spajus/libgfapi-ruby
|
@@ -118,6 +133,7 @@ summary: Ruby bindings for libgfapi (GlusterFS API)
|
|
118
133
|
test_files:
|
119
134
|
- spec/glusterfs/directory_spec.rb
|
120
135
|
- spec/glusterfs/file_spec.rb
|
136
|
+
- spec/glusterfs/memleak_spec.rb
|
121
137
|
- spec/glusterfs/volume_spec.rb
|
122
138
|
- spec/spec_helper.rb
|
123
139
|
has_rdoc:
|