filecluster 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,6 +1,7 @@
1
1
  *.gem
2
2
  *.rbc
3
3
  .bundle
4
+ .idea
4
5
  .config
5
6
  .yardoc
6
7
  Gemfile.lock
@@ -112,8 +112,8 @@ module FC
112
112
  def md5_sum(file_name)
113
113
  dst_path = "#{self.path}#{file_name}"
114
114
  cmd = self.class.curr_host == host ?
115
- "find #{dst_path} -type f -exec md5sum {} \\; | awk '{print $1}' | sort | md5sum" :
116
- "ssh -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \"find #{dst_path} -type f -exec md5sum {} \\; | awk '{print \\$1}' | sort | md5sum\""
115
+ "find #{dst_path.shellescape} -type f -exec md5sum {} \\; | awk '{print $1}' | sort | md5sum" :
116
+ "ssh -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \"find #{dst_path.shellescape} -type f -exec md5sum {} \\; | awk '{print \\$1}' | sort | md5sum\""
117
117
  r = `#{cmd} 2>&1`
118
118
  raise r if $?.exitstatus != 0
119
119
  r.to_s[0..31]
@@ -1,3 +1,3 @@
1
1
  module FC
2
- VERSION = "0.3.5"
2
+ VERSION = "0.3.6"
3
3
  end
@@ -6,16 +6,14 @@ class FunctionalTest < Test::Unit::TestCase
6
6
  # tmp fake storages dirs
7
7
  `rm -rf /tmp/host*-sd*`
8
8
  `mkdir -p /tmp/host1-sda/ /tmp/host2-sda/`
9
- `rm -rf /tmp/fc_test_dir`
10
- `mkdir -p /tmp/fc_test_dir`
11
9
 
12
10
  # test file to copy
13
- @@test_file_path = '/tmp/fc_test_file'
14
- `dd if=/dev/urandom of=#{@@test_file_path} bs=100K count=1 2>&1`
15
- @@test_dir_path = '/tmp/fc_test_dir'
16
- `mkdir -p #{@@test_dir_path}/aaa #{@@test_dir_path}/bbb`
17
- `cp #{@@test_file_path} #{@@test_dir_path}/aaa/test1`
18
- `cp #{@@test_file_path} #{@@test_dir_path}/bbb/test2`
11
+ @@test_file_path = '/tmp/fc test_file "~!@#$%^&*()_+|\';'
12
+ `dd if=/dev/urandom of=#{@@test_file_path.shellescape} bs=100K count=1 2>&1`
13
+ @@test_dir_path = '/tmp/fc test_dir'
14
+ `mkdir -p #{@@test_dir_path.shellescape}/aaa #{@@test_dir_path.shellescape}/bbb`
15
+ `cp #{@@test_file_path.shellescape} #{@@test_dir_path.shellescape}/aaa/test1`
16
+ `cp #{@@test_file_path.shellescape} #{@@test_dir_path.shellescape}/bbb/test2`
19
17
 
20
18
  @@storages = []
21
19
  @@storages << FC::Storage.new(:name => 'host1-sda', :host => 'host1', :path => '/tmp/host1-sda/', :size_limit => 1000000, :check_time => Time.new.to_i)
@@ -37,9 +35,9 @@ class FunctionalTest < Test::Unit::TestCase
37
35
  FC::DB.query("DELETE FROM items")
38
36
  FC::DB.query("DELETE FROM policies")
39
37
  FC::DB.query("DELETE FROM storages")
40
- `rm -rf /tmp/host*-sd*`
41
- `rm -rf #{@@test_file_path}`
42
- `rm -rf #{@@test_dir_path}`
38
+ #`rm -rf /tmp/host*-sd*`
39
+ #`rm -rf #{@@test_file_path.shellescape}`
40
+ #`rm -rf #{@@test_dir_path.shellescape}`
43
41
  end
44
42
  end
45
43
 
@@ -51,7 +49,7 @@ class FunctionalTest < Test::Unit::TestCase
51
49
  should "item create_from_local successful" do
52
50
  assert_nothing_raised { @item = FC::Item.create_from_local(@@test_file_path, '/bla/bla/test1', @@policies[0], {:tag => 'test'}) }
53
51
  assert_kind_of FC::Item, @item
54
- assert_equal `du -sb /tmp/host1-sda/bla/bla/test1 2>&1`.to_i, `du -sb #{@@test_file_path} 2>&1`.to_i
52
+ assert_equal `du -sb /tmp/host1-sda/bla/bla/test1 2>&1`.to_i, `du -sb #{@@test_file_path.shellescape} 2>&1`.to_i
55
53
  assert_equal `du -sb /tmp/host1-sda/bla/bla/test1 2>&1`.to_i, @item.size
56
54
  assert_equal 'ready', @item.status
57
55
  item_storages = @item.get_item_storages
@@ -65,7 +63,7 @@ class FunctionalTest < Test::Unit::TestCase
65
63
  assert_nothing_raised { @item = FC::Item.create_from_local(@@test_dir_path, '/bla/bla/test_dir', @@policies[0], {:tag => 'test_dir'}) }
66
64
  assert_kind_of FC::Item, @item
67
65
  assert_equal true, @item.dir?
68
- assert_equal `du -sb /tmp/host1-sda/bla/bla/test_dir 2>&1`.to_i, `du -sb #{@@test_dir_path} 2>&1`.to_i
66
+ assert_equal `du -sb /tmp/host1-sda/bla/bla/test_dir 2>&1`.to_i, `du -sb #{@@test_dir_path.shellescape} 2>&1`.to_i
69
67
  assert_equal `du -sb /tmp/host1-sda/bla/bla/test_dir 2>&1`.to_i, @item.size
70
68
  assert_equal 'ready', @item.status
71
69
  item_storages = @item.get_item_storages
@@ -108,14 +106,13 @@ class FunctionalTest < Test::Unit::TestCase
108
106
  @item = FC::Item.create_from_local(@@test_file_path, 'test5', @@policies[0], {:tag => 'test'})
109
107
  item_storage = @item.make_item_storage(@@storages[0], status = 'copy')
110
108
  `dd if=/dev/urandom of=#{@@storages[0].path}#{@item.name} bs=100K count=1 2>&1`
111
- #`dd if=/dev/urandom of=#{@@storages[0].path}#{@item.name} bs=100K count=1 2>&1`
112
109
  assert_raise(RuntimeError) { @item.copy_item_storage(@@storages[0], @@storages[1], item_storage) }
113
110
  assert_equal errors_count+1, FC::Error.where.count, "Error not saved after check md5"
114
111
  end
115
112
 
116
113
  should "item create_from_local inplace" do
117
- tmp_file_path = "/tmp/host2-sda/inplace_test"
118
- `cp #{@@test_file_path} #{tmp_file_path}`
119
- assert_nothing_raised { @item = FC::Item.create_from_local(tmp_file_path, 'inplace_test', @@policies[0]) }
114
+ tmp_file_path = "/tmp/host2-sda/inplace test"
115
+ `cp #{@@test_file_path.shellescape} #{tmp_file_path.shellescape}`
116
+ assert_nothing_raised { @item = FC::Item.create_from_local(tmp_file_path, 'inplace test', @@policies[0]) }
120
117
  end
121
118
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filecluster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-26 00:00:00.000000000 Z
12
+ date: 2014-04-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rb-readline
@@ -134,6 +134,7 @@ extensions: []
134
134
  extra_rdoc_files: []
135
135
  files:
136
136
  - .gitignore
137
+ - .idea/dataSources.xml
137
138
  - Gemfile
138
139
  - LICENSE
139
140
  - README.md
@@ -193,7 +194,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
193
194
  version: '0'
194
195
  segments:
195
196
  - 0
196
- hash: 3774757635760642720
197
+ hash: 1955679762041563204
197
198
  required_rubygems_version: !ruby/object:Gem::Requirement
198
199
  none: false
199
200
  requirements:
@@ -202,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
203
  version: '0'
203
204
  segments:
204
205
  - 0
205
- hash: 3774757635760642720
206
+ hash: 1955679762041563204
206
207
  requirements: []
207
208
  rubyforge_project:
208
209
  rubygems_version: 1.8.24