kanrisuru 0.8.14 → 0.8.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/lib/kanrisuru/core/disk.rb +1 -1
  4. data/lib/kanrisuru/core/find.rb +12 -5
  5. data/lib/kanrisuru/core/stat.rb +1 -3
  6. data/lib/kanrisuru/core/transfer.rb +12 -1
  7. data/lib/kanrisuru/version.rb +1 -1
  8. data/spec/functional/core/find_spec.rb +156 -45
  9. data/spec/functional/core/path_spec.rb +32 -80
  10. data/spec/functional/core/stat_spec.rb +14 -89
  11. data/spec/functional/core/stream_spec.rb +103 -112
  12. data/spec/functional/core/transfer_spec.rb +175 -102
  13. data/spec/helper/expect_helpers.rb +8 -0
  14. data/spec/helper/stub_network.rb +43 -0
  15. data/spec/{functional → integration}/core/apt_spec.rb +0 -0
  16. data/spec/{functional → integration}/core/archive_spec.rb +0 -0
  17. data/spec/{functional → integration}/core/disk_spec.rb +1 -1
  18. data/spec/{functional → integration}/core/dmi_spec.rb +0 -0
  19. data/spec/{functional → integration}/core/file_spec.rb +8 -5
  20. data/spec/integration/core/find_spec.rb +52 -0
  21. data/spec/{functional → integration}/core/group_spec.rb +0 -0
  22. data/spec/{functional → integration}/core/ip_spec.rb +0 -0
  23. data/spec/integration/core/path_spec.rb +93 -0
  24. data/spec/{functional → integration}/core/socket_spec.rb +0 -0
  25. data/spec/integration/core/stat_spec.rb +98 -0
  26. data/spec/integration/core/stream_spec.rb +117 -0
  27. data/spec/{functional → integration}/core/system_spec.rb +0 -0
  28. data/spec/integration/core/transfer_spec.rb +108 -0
  29. data/spec/{functional → integration}/core/user_spec.rb +0 -0
  30. data/spec/{functional → integration}/core/yum_spec.rb +0 -0
  31. data/spec/{functional → integration}/core/zypper_spec.rb +0 -0
  32. data/spec/{functional → integration}/remote/cluster_spec.rb +0 -0
  33. data/spec/{functional → integration}/remote/cpu_spec.rb +0 -0
  34. data/spec/{functional → integration}/remote/env_spec.rb +0 -0
  35. data/spec/{functional → integration}/remote/fstab_spec.rb +0 -0
  36. data/spec/{functional → integration}/remote/host_spec.rb +0 -0
  37. data/spec/{functional → integration}/remote/memory_spec.rb +0 -0
  38. data/spec/{functional → integration}/remote/os_spec.rb +0 -0
  39. data/spec/{functional → integration}/remote/remote_file_spec.rb +0 -0
  40. data/spec/spec_helper.rb +3 -0
  41. data/spec/unit/core/find_spec.rb +3 -0
  42. metadata +29 -22
@@ -1,117 +1,108 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'spec_helper'
4
+
5
+ StubNetwork.stub!
6
+
3
7
  RSpec.describe Kanrisuru::Core::Stream do
4
- TestHosts.each_os do |os_name|
5
- context "with #{os_name}" do
6
- before(:all) do
7
- host_json = TestHosts.host(os_name)
8
- host = Kanrisuru::Remote::Host.new(
9
- host: host_json['hostname'],
10
- username: host_json['username'],
11
- keys: [host_json['ssh_key']]
12
- )
13
-
14
- host.mkdir("#{host_json['home']}/.kanrisuru_spec_files", silent: true)
15
- host.disconnect
16
- end
17
-
18
- let(:host_json) { TestHosts.host(os_name) }
19
- let(:host) do
20
- Kanrisuru::Remote::Host.new(
21
- host: host_json['hostname'],
22
- username: host_json['username'],
23
- keys: [host_json['ssh_key']]
24
- )
25
- end
26
-
27
- let(:spec_dir) { "#{host_json['home']}/.kanrisuru_spec_files" }
28
-
29
- after do
30
- host.disconnect
31
- end
32
-
33
- after(:all) do
34
- host_json = TestHosts.host(os_name)
35
- host = Kanrisuru::Remote::Host.new(
36
- host: host_json['hostname'],
37
- username: host_json['username'],
38
- keys: [host_json['ssh_key']]
39
- )
40
-
41
- host.rmdir("#{host_json['home']}/.kanrisuru_spec_files")
42
- host.disconnect
43
- end
44
-
45
- it 'outputs beginning of a file' do
46
- file = host.file("#{spec_dir}/test-file.txt")
47
- file.touch
48
- file.append do |f|
49
- f << 'This'
50
- f << 'is'
51
- f << 'a'
52
- f << 'file!'
53
- end
54
-
55
- result = host.head("#{spec_dir}/test-file.txt", lines: 2)
56
- expect(result).to be_success
57
- expect(result.data.length).to eq(2)
58
- expect(result.data).to eq(%w[This is])
59
- end
60
-
61
- it 'outputs end of a file' do
62
- file = host.file("#{spec_dir}/test-file.txt")
63
- file.touch
64
- file.append do |f|
65
- f << 'This'
66
- f << 'is'
67
- f << 'a'
68
- f << 'file!'
69
- end
70
-
71
- result = host.tail("#{spec_dir}/test-file.txt", lines: 2)
72
- expect(result).to be_success
73
- expect(result.data.length).to eq(2)
74
- expect(result.data).to eq(['a', 'file!'])
75
- end
76
-
77
- it 'reads a chunk of text from a file' do
78
- file = host.file("#{spec_dir}/test-file-chunk.txt")
79
- file.touch
80
- file.append do |f|
81
- f << 'This'
82
- f << 'is'
83
- f << 'is'
84
- f << 'a'
85
- f << 'file'
86
- f << 'forever...'
87
- end
88
-
89
- result = host.read_file_chunk("#{spec_dir}/test-file-chunk.txt", 2, 4)
90
- expect(result).to be_success
91
- expect(result.data.length).to eq(3)
92
- expect(result.data).to eq(%w[is is a])
93
- end
94
-
95
- it 'cats a file' do
96
- result = host.cat('/etc/group')
97
- expect(result.success?).to eq(true)
98
- expect(result.data.include?('root:x:0:')).to eq(true)
99
- end
100
-
101
- it 'echoes to stdout' do
102
- result = host.echo('Hello world')
103
- expect(result.data).to eq('Hello world')
104
- end
105
-
106
- it 'seds file to stdout' do
107
- path = "#{spec_dir}/test-file.txt"
108
- result = host.echo("Hello world, this is a Cat test file.\nCat\nCat\nDog", new_file: path, mode: 'write')
109
- expect(result).to be_success
110
-
111
- result = host.sed(path, 'Cat', 'Dog')
112
- expect(result).to be_success
113
- expect(result.data).to eq("Hello world, this is a Dog test file.\nDog\nDog\nDog")
114
- end
115
- end
8
+ let(:host) do
9
+ Kanrisuru::Remote::Host.new(
10
+ host: 'localhost',
11
+ username: 'ubuntu',
12
+ keys: ['id_rsa']
13
+ )
14
+ end
15
+
16
+ it 'prepares head command' do
17
+ result = host.head('/var/log/syslog')
18
+ expect_command(result, 'head /var/log/syslog')
19
+
20
+ result = host.head('/var/log/syslog', bytes: 1024)
21
+ expect_command(result, 'head -c 1024 /var/log/syslog')
22
+
23
+ result = host.head('/var/log/syslog', lines: 50)
24
+ expect_command(result, 'head -n 50 /var/log/syslog')
25
+ end
26
+
27
+ it 'prepares tail command' do
28
+ result = host.tail('/var/log/syslog')
29
+ expect_command(result, 'tail /var/log/syslog')
30
+
31
+ result = host.tail('/var/log/syslog', bytes: 1024)
32
+ expect_command(result, 'tail -c 1024 /var/log/syslog')
33
+
34
+ result = host.tail('/var/log/syslog', lines: 50)
35
+ expect_command(result, 'tail -n 50 /var/log/syslog')
36
+ end
37
+
38
+ it 'prepares read_file_chunk command' do
39
+ result = host.read_file_chunk('/var/log/apache2/access.log', 10, 20)
40
+ expect_command(result, 'tail -n +10 /var/log/apache2/access.log | head -n 11')
41
+
42
+ result = host.read_file_chunk('/var/log/apache2/access.log', 0, 0)
43
+ expect_command(result, 'tail -n +0 /var/log/apache2/access.log | head -n 1')
44
+
45
+ expect do
46
+ host.read_file_chunk('file.log', 10, '20')
47
+ end.to raise_error(ArgumentError)
48
+
49
+ expect do
50
+ host.read_file_chunk('file.log', '10', 20)
51
+ end.to raise_error(ArgumentError)
52
+
53
+ expect do
54
+ host.read_file_chunk('file.log', 10, 9)
55
+ end.to raise_error(ArgumentError)
56
+
57
+ expect do
58
+ host.read_file_chunk('file.log', -1, 1)
59
+ end.to raise_error(ArgumentError)
60
+
61
+ expect do
62
+ host.read_file_chunk('file.log', 10, -2)
63
+ end.to raise_error(ArgumentError)
64
+ end
65
+
66
+ it 'prepares sed command' do
67
+ result = host.sed('~/file.txt', 'Cat', 'Dog')
68
+ expect_command(result, "sed 's/Cat/Dog/g' '~/file.txt'")
69
+
70
+ result = host.sed('~/file.txt', 'Cat', 'Doggz', in_place: true, new_file: '~/file2.txt', mode: 'write')
71
+ expect_command(result, "sed -i 's/Cat/Doggz/g' '~/file.txt' > ~/file2.txt")
72
+
73
+ result = host.sed('~/file.txt', 'Cat', 'Dogo', regexp_extended: true, new_file: '~/file2.txt', mode: 'append')
74
+ expect_command(result, "sed -r 's/Cat/Dogo/g' '~/file.txt' >> ~/file2.txt")
75
+ end
76
+
77
+ it 'prepares echo command' do
78
+ expect_command(host.echo('Hello world'), "echo 'Hello world'")
79
+ expect_command(host.echo('Hello\\n world', backslash: true), "echo -e 'Hello\\n world'")
80
+
81
+ expect_command(host.echo('Hello world', new_file: '~/file1.txt', mode: 'write'),
82
+ "echo 'Hello world' > ~/file1.txt")
83
+
84
+ expect_command(host.echo('Goodbye', new_file: '~/file1.txt', mode: 'append'),
85
+ "echo 'Goodbye' >> ~/file1.txt")
86
+ end
87
+
88
+ it 'prepares cat command' do
89
+ expect_command(host.cat('/etc/group'), 'cat /etc/group')
90
+ expect_command(host.cat('/etc/group', show_all: true), 'cat -A /etc/group')
91
+ expect_command(host.cat('/etc/group',
92
+ show_tabs: true,
93
+ number: true,
94
+ squeeze_blank: true,
95
+ show_nonprinting: true,
96
+ show_ends: true,
97
+ number_nonblank: true), 'cat -T -n -s -v -E -b /etc/group')
98
+
99
+ expect_command(host.cat(['~/file1.txt', '~/file2.txt', '~/file3.txt']),
100
+ 'cat ~/file1.txt ~/file2.txt ~/file3.txt')
101
+
102
+ expect_command(host.cat(['~/file1.txt', '~/file2.txt', '~/file3.txt'], mode: 'write', new_file: 'combined.txt'),
103
+ 'cat ~/file1.txt ~/file2.txt ~/file3.txt > combined.txt')
104
+
105
+ expect_command(host.cat(['~/file1.txt', '~/file2.txt', '~/file3.txt'], mode: 'append', new_file: 'combined.txt'),
106
+ 'cat ~/file1.txt ~/file2.txt ~/file3.txt >> combined.txt')
116
107
  end
117
108
  end
@@ -2,107 +2,180 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe Kanrisuru::Core::File do
6
- TestHosts.each_os do |os_name|
7
- context "with #{os_name}" do
8
- before(:all) do
9
- host_json = TestHosts.host(os_name)
10
- host = Kanrisuru::Remote::Host.new(
11
- host: host_json['hostname'],
12
- username: host_json['username'],
13
- keys: [host_json['ssh_key']]
14
- )
15
-
16
- host.mkdir("#{host_json['home']}/.kanrisuru_spec_files", silent: true)
17
- host.disconnect
18
- end
19
-
20
- let(:host_json) { TestHosts.host(os_name) }
21
- let(:host) do
22
- Kanrisuru::Remote::Host.new(
23
- host: host_json['hostname'],
24
- username: host_json['username'],
25
- keys: [host_json['ssh_key']]
26
- )
27
- end
28
-
29
- let(:spec_dir) { "#{host_json['home']}/.kanrisuru_spec_files" }
30
-
31
- after do
32
- host.disconnect
33
- end
34
-
35
- after(:all) do
36
- host_json = TestHosts.host(os_name)
37
- host = Kanrisuru::Remote::Host.new(
38
- host: host_json['hostname'],
39
- username: host_json['username'],
40
- keys: [host_json['ssh_key']]
41
- )
42
-
43
- host.rmdir("#{host_json['home']}/.kanrisuru_spec_files")
44
- host.disconnect
45
- end
46
-
47
- it 'uploads a template file' do
48
- path = '../templates/test.conf.erb'
49
- dest_path = "#{spec_dir}/test.conf"
50
-
51
- template = Kanrisuru::Template.new(path, array: %w[this is an array])
52
- result = host.upload(template.read, dest_path)
53
-
54
- expect(result).to be_success
55
- expect(result.mode.numeric).to eq('640')
56
- expect(result.user).to eq(host_json['username'])
57
-
58
- case os_name
59
- when 'sles', 'opensuse'
60
- expect(result.gid).to eq(100)
61
- expect(result.group).to eq('users')
62
- else
63
- expect(result.gid).to eq(1000)
64
- expect(result.group).to eq(host_json['username'])
65
- end
66
-
67
- expect(host.cat(dest_path).to_a).to eq([
68
- '<h1>Hello World</h1>',
69
- 'this',
70
- 'is',
71
- 'an',
72
- 'array'
73
- ])
74
- end
75
-
76
- it 'uploads a dir' do
77
- path = '../meta/'
78
- dest_path = "#{spec_dir}/meta"
79
-
80
- result = host.upload(path, dest_path, recursive: true)
81
- expect(result).to be_success
82
- end
83
-
84
- it 'downloads a file to local fs' do
85
- path = '../hosts-file'
86
- src_path = '/etc/hosts'
87
-
88
- result = host.download(src_path, path)
89
- expect(result).to eq(path)
90
- FileUtils.rm(path)
91
- end
92
-
93
- it 'downloads a file directly' do
94
- src_path = '/etc/hosts'
95
-
96
- result = host.download(src_path)
97
- expect(result).to be_instance_of(String)
98
- lines = result.split("\n")
99
- expect(lines.length).to be >= 1
100
- end
101
-
102
- it 'wgets url' do
103
- result = host.wget('https://example.com', directory_prefix: spec_dir)
104
- expect(result).to be_success
105
- end
106
- end
5
+ StubNetwork.stub!
6
+
7
+ RSpec.describe Kanrisuru::Core::Stat do
8
+ let(:host) do
9
+ Kanrisuru::Remote::Host.new(
10
+ host: 'localhost',
11
+ username: 'ubuntu',
12
+ keys: ['id_rsa']
13
+ )
14
+ end
15
+
16
+ it 'prepares wget command' do
17
+ url = 'https://rubygems.org'
18
+
19
+ expect_command(host.wget(url),
20
+ "wget #{url}"
21
+ )
22
+
23
+ ## Output options
24
+ expect_command(host.wget(url,
25
+ quiet: true, verbose: false, log_file: '/var/log/wget.log'),
26
+ "wget --quiet --no-verbose --output-file /var/log/wget.log #{url}"
27
+ )
28
+
29
+ expect_command(host.wget(url,
30
+ verbose: true, append_log_file: '/var/log/wget.log'),
31
+ "wget --verbose --append-output /var/log/wget.log #{url}"
32
+ )
33
+
34
+ ## Download options
35
+ expect_command(host.wget(url,
36
+ bind_address: '0.0.0.0',
37
+ retries: 3,
38
+ output_document: '/home/ubuntu/index.html',
39
+ no_clobber: true,
40
+ timeout: 30,
41
+ dns_timeout: 60,
42
+ connect_timeout: 60,
43
+ read_timeout: 15,
44
+ limit_rate: '120k',
45
+ wait: 5,
46
+ waitretry: 15,
47
+ random_wait: true,
48
+ no_proxy: true,
49
+ no_dns_cache: true
50
+ ),
51
+ "wget --bind-address 0.0.0.0 --tries 3 --output-document /home/ubuntu/index.html --no-clobber --timeout 30 --dns-timeout 60 --connect-timeout 60 --read-timeout 15 --limit-rate 120k --wait 5 --waitretry 15 --random-wait --no-proxy --no-dns-cache https://rubygems.org"
52
+ )
53
+
54
+ ## Other Options
55
+ expect_command(host.wget(url,
56
+ quota: 'inf',
57
+ family: 'inet',
58
+ restrict_file_names: ['unix', 'ascii', 'lowercase', 'uppercase'],
59
+ retry_connrefused: true,
60
+ user: 'admin',
61
+ password: 'admin',
62
+ no_iri: true,
63
+ ),
64
+ "wget --quota inf --restrict-file-names unix,ascii,lowercase,uppercase --inet4-only --retry-connrefused --user admin --password admin --no-iri #{url}"
65
+ )
66
+
67
+ ## Directories
68
+ expect_command(host.wget(url,
69
+ no_directories: true,
70
+ no_host_directories: true,
71
+ cut_dirs: 3,
72
+ directory_prefix: '~/downloads/'
73
+ ),
74
+ "wget --no-directories --no-host-directories --cut-dirs 3 --directory-prefix ~/downloads/ #{url}"
75
+ )
76
+
77
+ ## HTTP
78
+ expect_command(host.wget(url,
79
+ default_page: 'index.html',
80
+ adjust_extension: true,
81
+ http_user: 'admin',
82
+ http_password: 'admin',
83
+ load_cookies: '~/cookies.txt',
84
+ save_cookies: '~/cookies.txt',
85
+ no_cache: true,
86
+ keep_session_cookies: true,
87
+ ignore_length: true,
88
+ headers: {
89
+ 'Accept-Language' => 'hr',
90
+ 'Authorization' => 'Bearer 1234'
91
+ },
92
+ max_redirect: 5,
93
+ proxy_user: 'admin',
94
+ proxy_password: '12345678'
95
+ ),
96
+ "wget --default-page index.html --adjust-extension --http-user admin --http-password admin --load-cookies ~/cookies.txt --save-cookies ~/cookies.txt --no-cache --keep-session-cookies --ignore-length --max-redirect 5 --proxy-user admin --proxy-password 12345678 --header 'Accept-Language: hr' --header 'Authorization: Bearer 1234' #{url}"
97
+ )
98
+
99
+ expect_command(host.wget(url,
100
+ post_data: {
101
+ url: "https://example.com?param=123"
102
+ },
103
+ content_disposition: true,
104
+ secure_protocol: 'SSLv3',
105
+ no_check_certificate: true,
106
+ ),
107
+ "wget --post-data url=https%3A%2F%2Fexample.com%3Fparam%3D123 --content-disposition --secure-protocol SSLv3 --no-check-certificate #{url}"
108
+ )
109
+
110
+ expect {
111
+ host.wget(url, secure_protocol: 'SSL')
112
+ }.to raise_error(ArgumentError)
113
+
114
+ expect_command(host.wget(url,
115
+ certificate: '~/cert.pem',
116
+ certificate_type: 'PEM',
117
+ private_key: '~/key.pem',
118
+ private_key_type: 'PEM',
119
+ ca_certificate: '~/ca.pem',
120
+ random_file: '~/random'
121
+ ),
122
+ "wget --certificate ~/cert.pem --certificate-type PEM --private-key ~/key.pem --private-key-type PEM --ca-certificate ~/ca.pem --random-file ~/random #{url}"
123
+ )
124
+
125
+ expect_command(host.wget(url,
126
+ certificate: '~/cert.pem',
127
+ certificate_type: 'PEM',
128
+ private_key: '~/key.pem',
129
+ private_key_type: 'PEM',
130
+ ca_certificate: '~/ca.pem',
131
+ random_file: '~/random'
132
+ ),
133
+ "wget --certificate ~/cert.pem --certificate-type PEM --private-key ~/key.pem --private-key-type PEM --ca-certificate ~/ca.pem --random-file ~/random #{url}"
134
+ )
135
+
136
+ ## FTP
137
+ expect_command(host.wget(url,
138
+ ftp_user: 'admin',
139
+ ftp_password: '12345678',
140
+ no_remove_listing: true,
141
+ no_glob: true,
142
+ no_passive_ftp: true,
143
+ retr_symlinks: true
144
+ ),
145
+ "wget --ftp-user admin --ftp-password 12345678 --no-remove-listing --no-glob --no-passive-ftp --retr-symlinks #{url}"
146
+ )
147
+
148
+ ## Recursive Retrieval
149
+ expect_command(host.wget(url,
150
+ recursive: true,
151
+ depth: 10,
152
+ delete_after: true,
153
+ convert_links: true,
154
+ backup_converted: true,
155
+ mirror: true,
156
+ page_requisites: true,
157
+ strict_comments: true
158
+ ),
159
+ "wget --recursive --level 10 --delete-after --convert-links --backup-converted --mirror --page-requisites --strict-comments #{url}"
160
+ )
161
+
162
+ ## Recursive Accept/Reject
163
+ expect_command(host.wget(url,
164
+ accept_list: ['.txt', '.html'],
165
+ reject_list: ['.csv'],
166
+ domain_list: ['example.com'],
167
+ exclude_domain_list: ['hackernews.com'],
168
+ follow_tags: ['a', 'div', 'span'],
169
+ ignore_tags: ['area', 'link'],
170
+ include_directories: ['/gems'],
171
+ exclude_directories: ['/releases'],
172
+ follow_ftp: true,
173
+ ignore_case: true,
174
+ span_hosts: true,
175
+ relative: true,
176
+ no_parent: true
177
+ ),
178
+ "wget --accept .txt,.html --reject .csv --domains example.com --exclude-domains hackernews.com --follow-tags a,div,span --ignore-tags area,link --include-directories /gems --exclude-directories /releases --follow-ftp --ignore-case --span-hosts --relative --no-parent #{url}"
179
+ )
107
180
  end
108
181
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ def expect_command(result, string)
4
+ puts result.command.raw_command
5
+ expect(result.command.raw_command).to eq(
6
+ string
7
+ )
8
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ class StubNetwork
4
+ class << self
5
+ def stub!
6
+ ## Stub out the execute_with_retries method to
7
+ ## test functionality of host commands
8
+ Kanrisuru::Remote::Host.class_eval do
9
+ private
10
+
11
+ def execute_with_retries(command)
12
+ command.handle_status(0)
13
+ command.handle_data(nil)
14
+
15
+ command
16
+ end
17
+ end
18
+
19
+ Kanrisuru::Remote::Os.class_eval do
20
+ def initialize(host)
21
+ @host = host
22
+
23
+ @kernel_name = 'Linux'
24
+ @kernel_version = '#91-Ubuntu SMP Thu Jul 15 19:09:17 UTC 2021'
25
+ @operating_system = 'GNU/Linux'
26
+ @hardware_platform = 'x86_64'
27
+ @processor = 'x86_64'
28
+ @release = 'ubuntu'
29
+ @version = 20.0
30
+ end
31
+ end
32
+
33
+ Kanrisuru::Result.class_eval do
34
+ def initialize(command)
35
+ @command = command
36
+ @data = nil
37
+
38
+ @error = @command.to_a if @command.failure?
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
File without changes
@@ -41,7 +41,7 @@ RSpec.describe Kanrisuru::Core::Disk do
41
41
  :name, :label, :uuid, :type, :uuid_sub, :label_fatboot, :version, :usage,
42
42
  :part_uuid, :part_entry_scheme, :part_entry_uuid, :part_entry_type,
43
43
  :part_entry_number, :part_entry_offset, :part_entry_size, :part_entry_disk,
44
- :minimum_io_size, :physical_sector_size, :logical_sector_size,
44
+ :minimum_io_size, :physical_sector_size, :logical_sector_size
45
45
  )
46
46
  end
47
47
 
File without changes
@@ -41,7 +41,10 @@ RSpec.describe Kanrisuru::Core::File do
41
41
  )
42
42
 
43
43
  host.rm("#{host_json['home']}/.kanrisuru_spec_files", force: true, recursive: true)
44
- host.rm("#{host_json['home']}/extract-tar-files", force: true, recursive: true) if host.dir?("#{host_json['home']}/extract-tar-files")
44
+ if host.dir?("#{host_json['home']}/extract-tar-files")
45
+ host.rm("#{host_json['home']}/extract-tar-files", force: true,
46
+ recursive: true)
47
+ end
45
48
  host.disconnect
46
49
  end
47
50
 
@@ -68,9 +71,9 @@ RSpec.describe Kanrisuru::Core::File do
68
71
  expect(mode.symbolic).to eq('-rwxr--r--')
69
72
  expect(mode.to_i).to eq(0o744)
70
73
 
71
- expect {
74
+ expect do
72
75
  host.chmod(path, 600)
73
- }.to raise_error(ArgumentError)
76
+ end.to raise_error(ArgumentError)
74
77
  end
75
78
 
76
79
  it 'changes file owner and group' do
@@ -338,7 +341,7 @@ RSpec.describe Kanrisuru::Core::File do
338
341
  ## Can't delete non empty dir
339
342
  result = host.rmdir("#{spec_dir}/directory")
340
343
  expect(result).to be_failure
341
-
344
+
342
345
  result = host.rmdir("#{spec_dir}/directory/3")
343
346
  expect(result).to be_success
344
347
  end
@@ -355,7 +358,7 @@ RSpec.describe Kanrisuru::Core::File do
355
358
 
356
359
  lines = doc.length
357
360
  words = doc.map(&:split).flatten
358
- chars = doc.map(&:length).flatten
361
+ chars = doc.map(&:length).flatten
359
362
 
360
363
  expect(result.lines).to eq(doc.length)
361
364
  expect(result.words).to eq(words.length)