kanrisuru 0.8.11 → 0.8.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -1
- data/README.md +2 -2
- data/lib/kanrisuru/core/file.rb +13 -4
- data/lib/kanrisuru/core/stat.rb +1 -3
- data/lib/kanrisuru/remote/cluster.rb +1 -1
- data/lib/kanrisuru/version.rb +1 -1
- data/spec/functional/core/stat_spec.rb +19 -89
- data/spec/functional/os_package_spec.rb +3 -3
- data/spec/helper/stub_network.rb +45 -0
- data/spec/{functional → integration}/core/apt_spec.rb +0 -0
- data/spec/{functional → integration}/core/archive_spec.rb +0 -0
- data/spec/{functional → integration}/core/disk_spec.rb +0 -0
- data/spec/{functional → integration}/core/dmi_spec.rb +0 -0
- data/spec/{functional → integration}/core/file_spec.rb +33 -5
- data/spec/{functional → integration}/core/find_spec.rb +0 -0
- data/spec/{functional → integration}/core/group_spec.rb +0 -0
- data/spec/{functional → integration}/core/ip_spec.rb +0 -0
- data/spec/{functional → integration}/core/path_spec.rb +0 -0
- data/spec/{functional → integration}/core/socket_spec.rb +0 -0
- data/spec/integration/core/stat_spec.rb +98 -0
- data/spec/{functional → integration}/core/stream_spec.rb +0 -0
- data/spec/{functional → integration}/core/system_spec.rb +0 -0
- data/spec/{functional → integration}/core/transfer_spec.rb +0 -0
- data/spec/{functional → integration}/core/user_spec.rb +0 -0
- data/spec/{functional → integration}/core/yum_spec.rb +0 -0
- data/spec/{functional → integration}/core/zypper_spec.rb +0 -0
- data/spec/{functional → integration}/remote/cluster_spec.rb +4 -4
- data/spec/{functional → integration}/remote/cpu_spec.rb +0 -0
- data/spec/{functional → integration}/remote/env_spec.rb +0 -0
- data/spec/{functional → integration}/remote/fstab_spec.rb +0 -0
- data/spec/{functional → integration}/remote/host_spec.rb +0 -0
- data/spec/{functional → integration}/remote/memory_spec.rb +0 -0
- data/spec/{functional → integration}/remote/os_spec.rb +0 -0
- data/spec/{functional → integration}/remote/remote_file_spec.rb +0 -0
- data/spec/spec_helper.rb +1 -0
- metadata +28 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 522ae1903fe51ff350abc0fafa252d1b66f970710d4bed41748be03cc25ead3d
|
4
|
+
data.tar.gz: 501c4b568aeed1bca4e22658291ebab44e9cb9ebb84c23f5154dc4c97e5daf08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59fbae207747c7b7c93461a48f12cd959d8dcd2b2853619cb15624627534bca2a84fdf88c068285ef2cbb7a1ac48c74d592f784374847e3f89b35faa85de5366
|
7
|
+
data.tar.gz: 8981e523f2373b7eb4740e1c6b1af2318cb45ba960a92e620f368d502a5359f68402fa23c2607f449e563c451b6b5d0efce9cba8ef45ffa4252b4158bd9a09a8
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
|
+
## Kanrisuru 0.8.15 (October 12, 20201)
|
2
|
+
* Move functional specs to integration. Anything that performs an actual network request will be under the integrations test.
|
3
|
+
* Create a `StubNetwork` to quickly monkey patch the `Kanrisuru::Remote::Host` to simulate a `Net::SSH` channel request. Will add additional functionality for different simulations later on.
|
4
|
+
* Start with testing the `stat` command as a functional test.
|
5
|
+
|
6
|
+
## Kanrisuru 0.8.14 (October 8, 20201)
|
7
|
+
* Update `Kanrisuru::Remote::Cluster` instantiation method to use array splat instead of passing array directly.
|
8
|
+
|
9
|
+
## Kanrisuru 0.8.13 (October 4, 20201)
|
10
|
+
* Fix `wc` command. Ensure result parsing is cast to integer values.
|
11
|
+
|
12
|
+
## Kanrisuru 0.8.12 (October 4, 20201)
|
13
|
+
* Refactor `rmdir` command to only work on empty directories.
|
14
|
+
|
1
15
|
## Kanrisuru 0.8.11 (October 1, 20201)
|
2
|
-
* Allow `Kanrisuru::Mode` as mode option in mkdir method.
|
16
|
+
* Allow `Kanrisuru::Mode` as mode type option in mkdir method.
|
3
17
|
|
4
18
|
## Kanrisuru 0.8.10 (August 24, 20201)
|
5
19
|
* Fix bug with rspec test case.
|
data/README.md
CHANGED
@@ -48,7 +48,7 @@ result.path # => /home/ubuntu
|
|
48
48
|
|
49
49
|
### Cluster
|
50
50
|
```ruby
|
51
|
-
cluster = Kanrisuru::Remote::Cluster.new(
|
51
|
+
cluster = Kanrisuru::Remote::Cluster.new({
|
52
52
|
host: 'host1', username: 'ubuntu', keys: ['~/.ssh/id_rsa']
|
53
53
|
}, {
|
54
54
|
host: 'host2', username: 'alice', keys: ['~/.ssh/id_rsa']
|
@@ -72,7 +72,7 @@ host.execute(command)
|
|
72
72
|
command.success? #=> true
|
73
73
|
command.to_s #=> Linux
|
74
74
|
|
75
|
-
cluster = Kanrisuru::Remote::Cluster.new(
|
75
|
+
cluster = Kanrisuru::Remote::Cluster.new(host, {host: 'host2', username: 'alice', keys: ['~/.ssh/id_rsa']})
|
76
76
|
|
77
77
|
cluster.execute('uname') #=> {host: 'host1', result: 'Linux'}, {host: 'host2', result: 'Linux'}
|
78
78
|
```
|
data/lib/kanrisuru/core/file.rb
CHANGED
@@ -206,10 +206,19 @@ module Kanrisuru
|
|
206
206
|
Kanrisuru::Result.new(command)
|
207
207
|
end
|
208
208
|
|
209
|
-
def rmdir(
|
210
|
-
|
209
|
+
def rmdir(paths, opts = {})
|
210
|
+
paths = [paths] if paths.instance_of?(String)
|
211
|
+
paths.each do |path|
|
212
|
+
raise ArgumentError, "Can't delete root path" if path == '/' || realpath(path).path == '/'
|
213
|
+
end
|
211
214
|
|
212
|
-
|
215
|
+
command = Kanrisuru::Command.new("rmdir #{paths.join(' ')}")
|
216
|
+
command.append_flag('--ignore-fail-on-non-empty', opts[:silent])
|
217
|
+
command.append_flag('--parents', opts[:parents])
|
218
|
+
|
219
|
+
execute_shell(command)
|
220
|
+
|
221
|
+
Kanrisuru::Result.new(command)
|
213
222
|
end
|
214
223
|
|
215
224
|
def mkdir(path, opts = {})
|
@@ -323,7 +332,7 @@ module Kanrisuru
|
|
323
332
|
execute_shell(command)
|
324
333
|
|
325
334
|
Kanrisuru::Result.new(command) do |cmd|
|
326
|
-
items = cmd.
|
335
|
+
items = cmd.to_s.split
|
327
336
|
FileCount.new(items[0].to_i, items[1].to_i, items[2].to_i)
|
328
337
|
end
|
329
338
|
end
|
data/lib/kanrisuru/core/stat.rb
CHANGED
@@ -66,10 +66,8 @@ module Kanrisuru
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def stat(path, opts = {})
|
69
|
-
follow = opts[:follow]
|
70
|
-
|
71
69
|
command = Kanrisuru::Command.new('stat')
|
72
|
-
command.append_flag('-L', follow)
|
70
|
+
command.append_flag('-L', opts[:follow])
|
73
71
|
command.append_arg('-c', '%A,%b,%D,%F,%g,%G,%h,%i,%n,%s,%u,%U,%x,%y,%z')
|
74
72
|
command << path
|
75
73
|
|
data/lib/kanrisuru/version.rb
CHANGED
@@ -2,97 +2,27 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
6
|
-
TestHosts.each_os do |os_name|
|
7
|
-
context "with #{os_name}" do
|
8
|
-
let(:host_json) { TestHosts.host(os_name) }
|
9
|
-
let(:host) do
|
10
|
-
Kanrisuru::Remote::Host.new(
|
11
|
-
host: host_json['hostname'],
|
12
|
-
username: host_json['username'],
|
13
|
-
keys: [host_json['ssh_key']]
|
14
|
-
)
|
15
|
-
end
|
16
|
-
|
17
|
-
after do
|
18
|
-
host.disconnect
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'checks file type correctly' do
|
22
|
-
expect(host.dir?('/')).to eq(true)
|
23
|
-
expect(host.file?('/etc/hosts')).to eq(true)
|
24
|
-
|
25
|
-
case os_name
|
26
|
-
when 'sles'
|
27
|
-
expect(host.block_device?('/dev/xvda')).to eq(true)
|
28
|
-
else
|
29
|
-
expect(host.block_device?('/dev/vda')).to eq(true)
|
30
|
-
end
|
31
|
-
|
32
|
-
expect(host.char_device?('/dev/tty')).to eq(true)
|
33
|
-
expect(host.symlink?('/etc/mtab')).to eq(true)
|
34
|
-
expect(host.inode?('/proc/uptime')).to eq(true)
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'gets file stat' do
|
38
|
-
result = host.stat(host_json['home'])
|
39
|
-
|
40
|
-
expect(result.mode).to be_instance_of(Kanrisuru::Mode)
|
41
|
-
expect(result.mode.directory?).to eq(true)
|
42
|
-
|
43
|
-
case os_name
|
44
|
-
when 'centos', 'rhel', 'fedora'
|
45
|
-
expect(result.mode.numeric).to eq('700')
|
46
|
-
expect(result.mode.to_i).to eq(0o700)
|
47
|
-
|
48
|
-
expect(result.mode.group.read?).to eq(false)
|
49
|
-
expect(result.mode.group.write?).to eq(false)
|
50
|
-
expect(result.mode.group.execute?).to eq(false)
|
51
|
-
|
52
|
-
expect(result.mode.other.read?).to eq(false)
|
53
|
-
expect(result.mode.other.write?).to eq(false)
|
54
|
-
expect(result.mode.other.execute?).to eq(false)
|
5
|
+
StubNetwork.stub!
|
55
6
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
expect(result.mode.group.read?).to eq(true)
|
66
|
-
expect(result.mode.group.write?).to eq(false)
|
67
|
-
expect(result.mode.group.execute?).to eq(true)
|
68
|
-
|
69
|
-
expect(result.mode.other.read?).to eq(true)
|
70
|
-
expect(result.mode.other.write?).to eq(false)
|
71
|
-
expect(result.mode.other.execute?).to eq(true)
|
72
|
-
|
73
|
-
expect(result.mode.owner.read?).to eq(true)
|
74
|
-
expect(result.mode.owner.write?).to eq(true)
|
75
|
-
expect(result.mode.owner.execute?).to eq(true)
|
76
|
-
|
77
|
-
expect(result.mode.symbolic).to eq('drwxr-xr-x')
|
78
|
-
end
|
79
|
-
|
80
|
-
expect(result.file_type).to eq('directory')
|
81
|
-
|
82
|
-
case os_name
|
83
|
-
when 'opensuse', 'sles'
|
84
|
-
expect(result.gid).to eq(100)
|
85
|
-
expect(result.group).to eq('users')
|
86
|
-
else
|
87
|
-
expect(result.gid).to eq(1000)
|
88
|
-
expect(result.group).to eq(host_json['username'])
|
89
|
-
end
|
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
|
90
15
|
|
91
|
-
|
92
|
-
|
16
|
+
it 'prepares stat command' do
|
17
|
+
result = host.stat('~/file1.txt')
|
18
|
+
expect(result.command.raw_command).to eq(
|
19
|
+
'stat -c %A,%b,%D,%F,%g,%G,%h,%i,%n,%s,%u,%U,%x,%y,%z ~/file1.txt'
|
20
|
+
)
|
93
21
|
|
94
|
-
|
95
|
-
|
96
|
-
|
22
|
+
result = host.stat('~/file2.txt', follow: true)
|
23
|
+
expect(result.command.raw_command).to eq(
|
24
|
+
'stat -L -c %A,%b,%D,%F,%g,%G,%h,%i,%n,%s,%u,%U,%x,%y,%z ~/file1.txt'
|
25
|
+
)
|
97
26
|
end
|
27
|
+
|
98
28
|
end
|
@@ -111,7 +111,7 @@ RSpec.describe Kanrisuru::OsPackage do
|
|
111
111
|
host = Kanrisuru::Remote::Host.new(host: '127.0.0.1', username: 'ubuntu', keys: ['~/.ssh/id_rsa'])
|
112
112
|
host2 = Kanrisuru::Remote::Host.new(host: 'localhost', username: 'ubuntu', keys: ['~/.ssh/id_rsa'])
|
113
113
|
|
114
|
-
cluster = Kanrisuru::Remote::Cluster.new(
|
114
|
+
cluster = Kanrisuru::Remote::Cluster.new(host, host2)
|
115
115
|
|
116
116
|
expect(host).to respond_to(:tester)
|
117
117
|
expect(host.tester).to eq('hello ubuntu')
|
@@ -125,7 +125,7 @@ RSpec.describe Kanrisuru::OsPackage do
|
|
125
125
|
host = Kanrisuru::Remote::Host.new(host: '127.0.0.1', username: 'ubuntu', keys: ['~/.ssh/id_rsa'])
|
126
126
|
host2 = Kanrisuru::Remote::Host.new(host: 'localhost', username: 'ubuntu', keys: ['~/.ssh/id_rsa'])
|
127
127
|
|
128
|
-
cluster = Kanrisuru::Remote::Cluster.new(
|
128
|
+
cluster = Kanrisuru::Remote::Cluster.new(host, host2)
|
129
129
|
|
130
130
|
expect(host).to respond_to(:asdf)
|
131
131
|
expect(host.asdf).to respond_to(:tester)
|
@@ -151,7 +151,7 @@ RSpec.describe Kanrisuru::OsPackage do
|
|
151
151
|
host2 = Kanrisuru::Remote::Host.new(host: 'centos-host', username: 'centos', keys: ['~/.ssh/id_rsa'])
|
152
152
|
host3 = Kanrisuru::Remote::Host.new(host: 'opensuse-host', username: 'opensuse', keys: ['~/.ssh/id_rsa'])
|
153
153
|
|
154
|
-
cluster = Kanrisuru::Remote::Cluster.new(
|
154
|
+
cluster = Kanrisuru::Remote::Cluster.new(host1, host2, host3)
|
155
155
|
|
156
156
|
expect(host1).to respond_to(:output)
|
157
157
|
expect(host2).to respond_to(:output)
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class StubNetwork
|
4
|
+
class << self
|
5
|
+
|
6
|
+
def stub!
|
7
|
+
## Stub out the execute_with_retries method to
|
8
|
+
## test functionality of host commands
|
9
|
+
Kanrisuru::Remote::Host.class_eval do
|
10
|
+
private
|
11
|
+
|
12
|
+
def execute_with_retries(command)
|
13
|
+
command.handle_status(0)
|
14
|
+
command.handle_data(nil)
|
15
|
+
|
16
|
+
command
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
Kanrisuru::Remote::Os.class_eval do
|
21
|
+
def initialize(host)
|
22
|
+
@host = host
|
23
|
+
|
24
|
+
@kernel_name = 'Linux'
|
25
|
+
@kernel_version = '#91-Ubuntu SMP Thu Jul 15 19:09:17 UTC 2021'
|
26
|
+
@operating_system = 'GNU/Linux'
|
27
|
+
@hardware_platform = "x86_64"
|
28
|
+
@processor = "x86_64"
|
29
|
+
@release = "ubuntu"
|
30
|
+
@version = 20.0
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
Kanrisuru::Result.class_eval do
|
35
|
+
def initialize(command, &block)
|
36
|
+
@command = command
|
37
|
+
@data = nil
|
38
|
+
|
39
|
+
@error = @command.to_a if @command.failure?
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -40,8 +40,8 @@ RSpec.describe Kanrisuru::Core::File do
|
|
40
40
|
keys: [host_json['ssh_key']]
|
41
41
|
)
|
42
42
|
|
43
|
-
host.
|
44
|
-
host.
|
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")
|
45
45
|
host.disconnect
|
46
46
|
end
|
47
47
|
|
@@ -322,16 +322,44 @@ RSpec.describe Kanrisuru::Core::File do
|
|
322
322
|
expect(host.empty_file?(path)).to eq(false)
|
323
323
|
end
|
324
324
|
|
325
|
+
it 'removes directories' do
|
326
|
+
result = host.mkdir("#{spec_dir}/directory/1", silent: true)
|
327
|
+
expect(result).to be_success
|
328
|
+
|
329
|
+
result = host.mkdir("#{spec_dir}/directory/2", silent: true)
|
330
|
+
expect(result).to be_success
|
331
|
+
|
332
|
+
result = host.mkdir("#{spec_dir}/directory/3", silent: true)
|
333
|
+
expect(result).to be_success
|
334
|
+
|
335
|
+
result = host.rmdir(["#{spec_dir}/directory/1", "#{spec_dir}/directory/2"])
|
336
|
+
expect(result).to be_success
|
337
|
+
|
338
|
+
## Can't delete non empty dir
|
339
|
+
result = host.rmdir("#{spec_dir}/directory")
|
340
|
+
expect(result).to be_failure
|
341
|
+
|
342
|
+
result = host.rmdir("#{spec_dir}/directory/3")
|
343
|
+
expect(result).to be_success
|
344
|
+
end
|
345
|
+
|
325
346
|
it 'counts a file' do
|
326
347
|
result = host.wc('/etc/hosts')
|
327
348
|
|
328
349
|
expect(result.success?).to eq(true)
|
329
350
|
expect(result).to respond_to(:lines, :words, :characters)
|
330
351
|
|
331
|
-
|
332
|
-
|
352
|
+
## Need to remap data including newline chars to get byte size
|
353
|
+
data = host.cat('/etc/hosts').command.raw_result
|
354
|
+
doc = data.map(&:lines).flatten
|
355
|
+
|
356
|
+
lines = doc.length
|
357
|
+
words = doc.map(&:split).flatten
|
358
|
+
chars = doc.map(&:length).flatten
|
333
359
|
|
334
|
-
expect(lines).to eq(
|
360
|
+
expect(result.lines).to eq(doc.length)
|
361
|
+
expect(result.words).to eq(words.length)
|
362
|
+
expect(result.characters).to eq(chars.sum)
|
335
363
|
end
|
336
364
|
end
|
337
365
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,98 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe Kanrisuru::Core::Stat do
|
6
|
+
TestHosts.each_os do |os_name|
|
7
|
+
context "with #{os_name}" do
|
8
|
+
let(:host_json) { TestHosts.host(os_name) }
|
9
|
+
let(:host) do
|
10
|
+
Kanrisuru::Remote::Host.new(
|
11
|
+
host: host_json['hostname'],
|
12
|
+
username: host_json['username'],
|
13
|
+
keys: [host_json['ssh_key']]
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
after do
|
18
|
+
host.disconnect
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'checks file type correctly' do
|
22
|
+
expect(host.dir?('/')).to eq(true)
|
23
|
+
expect(host.file?('/etc/hosts')).to eq(true)
|
24
|
+
|
25
|
+
case os_name
|
26
|
+
when 'sles'
|
27
|
+
expect(host.block_device?('/dev/xvda')).to eq(true)
|
28
|
+
else
|
29
|
+
expect(host.block_device?('/dev/vda')).to eq(true)
|
30
|
+
end
|
31
|
+
|
32
|
+
expect(host.char_device?('/dev/tty')).to eq(true)
|
33
|
+
expect(host.symlink?('/etc/mtab')).to eq(true)
|
34
|
+
expect(host.inode?('/proc/uptime')).to eq(true)
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'gets file stat' do
|
38
|
+
result = host.stat(host_json['home'])
|
39
|
+
|
40
|
+
expect(result.mode).to be_instance_of(Kanrisuru::Mode)
|
41
|
+
expect(result.mode.directory?).to eq(true)
|
42
|
+
|
43
|
+
case os_name
|
44
|
+
when 'centos', 'rhel', 'fedora'
|
45
|
+
expect(result.mode.numeric).to eq('700')
|
46
|
+
expect(result.mode.to_i).to eq(0o700)
|
47
|
+
|
48
|
+
expect(result.mode.group.read?).to eq(false)
|
49
|
+
expect(result.mode.group.write?).to eq(false)
|
50
|
+
expect(result.mode.group.execute?).to eq(false)
|
51
|
+
|
52
|
+
expect(result.mode.other.read?).to eq(false)
|
53
|
+
expect(result.mode.other.write?).to eq(false)
|
54
|
+
expect(result.mode.other.execute?).to eq(false)
|
55
|
+
|
56
|
+
expect(result.mode.owner.read?).to eq(true)
|
57
|
+
expect(result.mode.owner.write?).to eq(true)
|
58
|
+
expect(result.mode.owner.execute?).to eq(true)
|
59
|
+
|
60
|
+
expect(result.mode.symbolic).to eq('drwx------')
|
61
|
+
else
|
62
|
+
expect(result.mode.numeric).to eq('755')
|
63
|
+
expect(result.mode.to_i).to eq(0o755)
|
64
|
+
|
65
|
+
expect(result.mode.group.read?).to eq(true)
|
66
|
+
expect(result.mode.group.write?).to eq(false)
|
67
|
+
expect(result.mode.group.execute?).to eq(true)
|
68
|
+
|
69
|
+
expect(result.mode.other.read?).to eq(true)
|
70
|
+
expect(result.mode.other.write?).to eq(false)
|
71
|
+
expect(result.mode.other.execute?).to eq(true)
|
72
|
+
|
73
|
+
expect(result.mode.owner.read?).to eq(true)
|
74
|
+
expect(result.mode.owner.write?).to eq(true)
|
75
|
+
expect(result.mode.owner.execute?).to eq(true)
|
76
|
+
|
77
|
+
expect(result.mode.symbolic).to eq('drwxr-xr-x')
|
78
|
+
end
|
79
|
+
|
80
|
+
expect(result.file_type).to eq('directory')
|
81
|
+
|
82
|
+
case os_name
|
83
|
+
when 'opensuse', 'sles'
|
84
|
+
expect(result.gid).to eq(100)
|
85
|
+
expect(result.group).to eq('users')
|
86
|
+
else
|
87
|
+
expect(result.gid).to eq(1000)
|
88
|
+
expect(result.group).to eq(host_json['username'])
|
89
|
+
end
|
90
|
+
|
91
|
+
expect(result.uid).to eq(1000)
|
92
|
+
expect(result.user).to eq(host_json['username'])
|
93
|
+
|
94
|
+
expect(result.fsize).to be >= 0
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -5,7 +5,7 @@ require 'spec_helper'
|
|
5
5
|
RSpec.describe Kanrisuru::Remote::Cluster do
|
6
6
|
context 'with ubuntu' do
|
7
7
|
it 'gets hostname for cluster' do
|
8
|
-
cluster = described_class.new(
|
8
|
+
cluster = described_class.new({
|
9
9
|
host: 'localhost',
|
10
10
|
username: 'ubuntu',
|
11
11
|
keys: ['~/.ssh/id_rsa']
|
@@ -13,7 +13,7 @@ RSpec.describe Kanrisuru::Remote::Cluster do
|
|
13
13
|
host: '127.0.0.1',
|
14
14
|
username: 'ubuntu',
|
15
15
|
keys: ['~/.ssh/id_rsa']
|
16
|
-
}
|
16
|
+
})
|
17
17
|
|
18
18
|
expect(cluster.hostname).to match([
|
19
19
|
{ host: 'localhost', result: 'ubuntu' },
|
@@ -24,7 +24,7 @@ RSpec.describe Kanrisuru::Remote::Cluster do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'can ping host cluster' do
|
27
|
-
cluster = described_class.new(
|
27
|
+
cluster = described_class.new({
|
28
28
|
host: 'localhost',
|
29
29
|
username: 'ubuntu',
|
30
30
|
keys: ['~/.ssh/id_rsa']
|
@@ -32,7 +32,7 @@ RSpec.describe Kanrisuru::Remote::Cluster do
|
|
32
32
|
host: '127.0.0.1',
|
33
33
|
username: 'ubuntu',
|
34
34
|
keys: ['~/.ssh/id_rsa']
|
35
|
-
}
|
35
|
+
})
|
36
36
|
|
37
37
|
expect(cluster.ping?).to match([
|
38
38
|
{ host: 'localhost', result: true },
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kanrisuru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Mammina
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -173,34 +173,36 @@ files:
|
|
173
173
|
- lib/kanrisuru/util/os_family.rb
|
174
174
|
- lib/kanrisuru/util/signal.rb
|
175
175
|
- lib/kanrisuru/version.rb
|
176
|
-
- spec/functional/core/apt_spec.rb
|
177
|
-
- spec/functional/core/archive_spec.rb
|
178
|
-
- spec/functional/core/disk_spec.rb
|
179
|
-
- spec/functional/core/dmi_spec.rb
|
180
|
-
- spec/functional/core/file_spec.rb
|
181
|
-
- spec/functional/core/find_spec.rb
|
182
|
-
- spec/functional/core/group_spec.rb
|
183
|
-
- spec/functional/core/ip_spec.rb
|
184
|
-
- spec/functional/core/path_spec.rb
|
185
|
-
- spec/functional/core/socket_spec.rb
|
186
176
|
- spec/functional/core/stat_spec.rb
|
187
|
-
- spec/functional/core/stream_spec.rb
|
188
|
-
- spec/functional/core/system_spec.rb
|
189
|
-
- spec/functional/core/transfer_spec.rb
|
190
|
-
- spec/functional/core/user_spec.rb
|
191
|
-
- spec/functional/core/yum_spec.rb
|
192
|
-
- spec/functional/core/zypper_spec.rb
|
193
177
|
- spec/functional/os_package_spec.rb
|
194
|
-
- spec/
|
195
|
-
- spec/functional/remote/cpu_spec.rb
|
196
|
-
- spec/functional/remote/env_spec.rb
|
197
|
-
- spec/functional/remote/fstab_spec.rb
|
198
|
-
- spec/functional/remote/host_spec.rb
|
199
|
-
- spec/functional/remote/memory_spec.rb
|
200
|
-
- spec/functional/remote/os_spec.rb
|
201
|
-
- spec/functional/remote/remote_file_spec.rb
|
178
|
+
- spec/helper/stub_network.rb
|
202
179
|
- spec/helper/test_hosts.rb
|
203
180
|
- spec/hosts.json
|
181
|
+
- spec/integration/core/apt_spec.rb
|
182
|
+
- spec/integration/core/archive_spec.rb
|
183
|
+
- spec/integration/core/disk_spec.rb
|
184
|
+
- spec/integration/core/dmi_spec.rb
|
185
|
+
- spec/integration/core/file_spec.rb
|
186
|
+
- spec/integration/core/find_spec.rb
|
187
|
+
- spec/integration/core/group_spec.rb
|
188
|
+
- spec/integration/core/ip_spec.rb
|
189
|
+
- spec/integration/core/path_spec.rb
|
190
|
+
- spec/integration/core/socket_spec.rb
|
191
|
+
- spec/integration/core/stat_spec.rb
|
192
|
+
- spec/integration/core/stream_spec.rb
|
193
|
+
- spec/integration/core/system_spec.rb
|
194
|
+
- spec/integration/core/transfer_spec.rb
|
195
|
+
- spec/integration/core/user_spec.rb
|
196
|
+
- spec/integration/core/yum_spec.rb
|
197
|
+
- spec/integration/core/zypper_spec.rb
|
198
|
+
- spec/integration/remote/cluster_spec.rb
|
199
|
+
- spec/integration/remote/cpu_spec.rb
|
200
|
+
- spec/integration/remote/env_spec.rb
|
201
|
+
- spec/integration/remote/fstab_spec.rb
|
202
|
+
- spec/integration/remote/host_spec.rb
|
203
|
+
- spec/integration/remote/memory_spec.rb
|
204
|
+
- spec/integration/remote/os_spec.rb
|
205
|
+
- spec/integration/remote/remote_file_spec.rb
|
204
206
|
- spec/spec_helper.rb
|
205
207
|
- spec/unit/core/apt_spec.rb
|
206
208
|
- spec/unit/core/archive_spec.rb
|