kanrisuru 0.8.23 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/CHANGELOG.md +36 -19
- data/README.md +1 -0
- data/kanrisuru.gemspec +2 -1
- data/lib/kanrisuru/core/archive.rb +6 -5
- data/lib/kanrisuru/remote/cluster.rb +33 -1
- data/lib/kanrisuru/remote/cpu.rb +3 -3
- data/lib/kanrisuru/remote/env.rb +8 -0
- data/lib/kanrisuru/version.rb +1 -1
- data/spec/functional/core/archive_spec.rb +194 -0
- data/spec/functional/remote/cluster_spec.rb +57 -0
- data/spec/functional/remote/env_spec.rb +50 -0
- data/spec/helper/stub_network.rb +25 -1
- data/spec/{functional → integration}/os_package_spec.rb +0 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/unit/command_spec.rb +31 -0
- data/spec/unit/core/apt_spec.rb +20 -0
- data/spec/unit/core/archive_spec.rb +20 -0
- data/spec/unit/core/disk_spec.rb +23 -0
- data/spec/unit/core/dmi_spec.rb +20 -0
- data/spec/unit/core/file_spec.rb +35 -0
- data/spec/unit/core/find_spec.rb +20 -0
- data/spec/unit/core/group_spec.rb +24 -0
- data/spec/unit/core/ip_spec.rb +20 -0
- data/spec/unit/core/path_spec.rb +25 -0
- data/spec/unit/core/socket_spec.rb +20 -0
- data/spec/unit/core/stat_spec.rb +27 -0
- data/spec/unit/core/system_spec.rb +35 -0
- data/spec/unit/core/transfer_spec.rb +22 -0
- data/spec/unit/core/user_spec.rb +25 -0
- data/spec/unit/core/yum_spec.rb +20 -0
- data/spec/unit/core/zypper_spec.rb +20 -0
- data/spec/unit/mode_spec.rb +31 -0
- data/spec/unit/remote/cluster_spec.rb +34 -0
- data/spec/unit/remote/cpu_spec.rb +50 -0
- data/spec/unit/remote/env_spec.rb +19 -0
- data/spec/unit/{fstab_spec.rb → remote/fstab_spec.rb} +0 -0
- metadata +27 -5
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe Kanrisuru::Command do
|
6
|
+
it 'responds to methods' do
|
7
|
+
command = Kanrisuru::Command.new('ls')
|
8
|
+
expect(command).to respond_to(:exit_status)
|
9
|
+
expect(command).to respond_to(:raw_result)
|
10
|
+
expect(command).to respond_to(:program)
|
11
|
+
expect(command).to respond_to(:success?)
|
12
|
+
expect(command).to respond_to(:failure?)
|
13
|
+
expect(command).to respond_to(:to_i)
|
14
|
+
expect(command).to respond_to(:to_s)
|
15
|
+
expect(command).to respond_to(:to_a)
|
16
|
+
expect(command).to respond_to(:to_json)
|
17
|
+
expect(command).to respond_to(:prepared_command)
|
18
|
+
expect(command).to respond_to(:raw_command)
|
19
|
+
expect(command).to respond_to(:handle_status)
|
20
|
+
expect(command).to respond_to(:handle_data)
|
21
|
+
expect(command).to respond_to(:handle_signal)
|
22
|
+
expect(command).to respond_to(:+)
|
23
|
+
expect(command).to respond_to(:<<)
|
24
|
+
expect(command).to respond_to(:|)
|
25
|
+
expect(command).to respond_to(:pipe)
|
26
|
+
expect(command).to respond_to(:append_value)
|
27
|
+
expect(command).to respond_to(:append_arg)
|
28
|
+
expect(command).to respond_to(:append_flag)
|
29
|
+
expect(command).to respond_to(:append_valid_exit_code)
|
30
|
+
end
|
31
|
+
end
|
data/spec/unit/core/apt_spec.rb
CHANGED
@@ -3,6 +3,26 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe Kanrisuru::Core::Apt do
|
6
|
+
before(:all) do
|
7
|
+
StubNetwork.stub!
|
8
|
+
end
|
9
|
+
|
10
|
+
after(:all) do
|
11
|
+
StubNetwork.unstub!
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:host) do
|
15
|
+
Kanrisuru::Remote::Host.new(
|
16
|
+
host: 'localhost',
|
17
|
+
username: 'ubuntu',
|
18
|
+
keys: ['id_rsa']
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'responds to methods' do
|
23
|
+
expect(host).to respond_to(:apt)
|
24
|
+
end
|
25
|
+
|
6
26
|
it 'responds to apt fields' do
|
7
27
|
expect(Kanrisuru::Core::Apt::Source.new).to respond_to(
|
8
28
|
:url, :dist, :architecture
|
@@ -3,6 +3,26 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe Kanrisuru::Core::Archive do
|
6
|
+
before(:all) do
|
7
|
+
StubNetwork.stub!
|
8
|
+
end
|
9
|
+
|
10
|
+
after(:all) do
|
11
|
+
StubNetwork.unstub!
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:host) do
|
15
|
+
Kanrisuru::Remote::Host.new(
|
16
|
+
host: 'localhost',
|
17
|
+
username: 'ubuntu',
|
18
|
+
keys: ['id_rsa']
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'responds to methods' do
|
23
|
+
expect(host).to respond_to(:tar)
|
24
|
+
end
|
25
|
+
|
6
26
|
it 'responds to archive fields' do
|
7
27
|
expect(Kanrisuru::Core::Archive::FilePath.new).to respond_to(
|
8
28
|
:path
|
data/spec/unit/core/disk_spec.rb
CHANGED
@@ -3,6 +3,29 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe Kanrisuru::Core::Disk do
|
6
|
+
before(:all) do
|
7
|
+
StubNetwork.stub!
|
8
|
+
end
|
9
|
+
|
10
|
+
after(:all) do
|
11
|
+
StubNetwork.unstub!
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:host) do
|
15
|
+
Kanrisuru::Remote::Host.new(
|
16
|
+
host: 'localhost',
|
17
|
+
username: 'ubuntu',
|
18
|
+
keys: ['id_rsa']
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'responds to methods' do
|
23
|
+
expect(host).to respond_to(:df)
|
24
|
+
expect(host).to respond_to(:du)
|
25
|
+
expect(host).to respond_to(:blkid)
|
26
|
+
expect(host).to respond_to(:lsblk)
|
27
|
+
end
|
28
|
+
|
6
29
|
it 'responds to disk fields' do
|
7
30
|
expect(Kanrisuru::Core::Disk::DiskUsage.new).to respond_to(:fsize, :path)
|
8
31
|
expect(Kanrisuru::Core::Disk::DiskFree.new).to respond_to(
|
data/spec/unit/core/dmi_spec.rb
CHANGED
@@ -3,6 +3,26 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe Kanrisuru::Core::Dmi do
|
6
|
+
before(:all) do
|
7
|
+
StubNetwork.stub!
|
8
|
+
end
|
9
|
+
|
10
|
+
after(:all) do
|
11
|
+
StubNetwork.unstub!
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:host) do
|
15
|
+
Kanrisuru::Remote::Host.new(
|
16
|
+
host: 'localhost',
|
17
|
+
username: 'ubuntu',
|
18
|
+
keys: ['id_rsa']
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'responds to methods' do
|
23
|
+
expect(host).to respond_to(:dmi)
|
24
|
+
end
|
25
|
+
|
6
26
|
it 'responds to dmi type fields' do
|
7
27
|
expect(Kanrisuru::Core::Dmi::BIOS.new).to respond_to(
|
8
28
|
:dmi_type, :dmi_handle, :dmi_size,
|
data/spec/unit/core/file_spec.rb
CHANGED
@@ -3,6 +3,41 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe Kanrisuru::Core::File do
|
6
|
+
before(:all) do
|
7
|
+
StubNetwork.stub!
|
8
|
+
end
|
9
|
+
|
10
|
+
after(:all) do
|
11
|
+
StubNetwork.unstub!
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:host) do
|
15
|
+
Kanrisuru::Remote::Host.new(
|
16
|
+
host: 'localhost',
|
17
|
+
username: 'ubuntu',
|
18
|
+
keys: ['id_rsa']
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'responds to methods' do
|
23
|
+
expect(host).to respond_to(:touch)
|
24
|
+
expect(host).to respond_to(:cp)
|
25
|
+
expect(host).to respond_to(:copy)
|
26
|
+
expect(host).to respond_to(:mkdir)
|
27
|
+
expect(host).to respond_to(:mv)
|
28
|
+
expect(host).to respond_to(:move)
|
29
|
+
expect(host).to respond_to(:link)
|
30
|
+
expect(host).to respond_to(:symlink)
|
31
|
+
expect(host).to respond_to(:ln)
|
32
|
+
expect(host).to respond_to(:ln_s)
|
33
|
+
expect(host).to respond_to(:chmod)
|
34
|
+
expect(host).to respond_to(:chown)
|
35
|
+
expect(host).to respond_to(:unlink)
|
36
|
+
expect(host).to respond_to(:rm)
|
37
|
+
expect(host).to respond_to(:rmdir)
|
38
|
+
expect(host).to respond_to(:wc)
|
39
|
+
end
|
40
|
+
|
6
41
|
it 'responds to file fields' do
|
7
42
|
expect(Kanrisuru::Core::File::FileCount.new).to respond_to(:lines, :words, :characters)
|
8
43
|
end
|
data/spec/unit/core/find_spec.rb
CHANGED
@@ -3,6 +3,26 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe Kanrisuru::Core::Find do
|
6
|
+
before(:all) do
|
7
|
+
StubNetwork.stub!
|
8
|
+
end
|
9
|
+
|
10
|
+
after(:all) do
|
11
|
+
StubNetwork.unstub!
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:host) do
|
15
|
+
Kanrisuru::Remote::Host.new(
|
16
|
+
host: 'localhost',
|
17
|
+
username: 'ubuntu',
|
18
|
+
keys: ['id_rsa']
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'responds to methods' do
|
23
|
+
expect(host).to respond_to(:find)
|
24
|
+
end
|
25
|
+
|
6
26
|
it 'responds to find fields' do
|
7
27
|
expect(Kanrisuru::Core::Find::FilePath.new).to respond_to(:path)
|
8
28
|
expect(Kanrisuru::Core::Find::REGEX_TYPES).to(
|
@@ -3,6 +3,30 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe Kanrisuru::Core::Group do
|
6
|
+
before(:all) do
|
7
|
+
StubNetwork.stub!
|
8
|
+
end
|
9
|
+
|
10
|
+
after(:all) do
|
11
|
+
StubNetwork.unstub!
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:host) do
|
15
|
+
Kanrisuru::Remote::Host.new(
|
16
|
+
host: 'localhost',
|
17
|
+
username: 'ubuntu',
|
18
|
+
keys: ['id_rsa']
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'responds to methods' do
|
23
|
+
expect(host).to respond_to(:group?)
|
24
|
+
expect(host).to respond_to(:get_gid)
|
25
|
+
expect(host).to respond_to(:create_group)
|
26
|
+
expect(host).to respond_to(:update_group)
|
27
|
+
expect(host).to respond_to(:delete_group)
|
28
|
+
end
|
29
|
+
|
6
30
|
it 'responds to group fields' do
|
7
31
|
expect(Kanrisuru::Core::Group::Group.new).to respond_to(:gid, :name, :users)
|
8
32
|
expect(Kanrisuru::Core::Group::GroupUser.new).to respond_to(:uid, :name)
|
data/spec/unit/core/ip_spec.rb
CHANGED
@@ -3,6 +3,26 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe Kanrisuru::Core::IP do
|
6
|
+
before(:all) do
|
7
|
+
StubNetwork.stub!
|
8
|
+
end
|
9
|
+
|
10
|
+
after(:all) do
|
11
|
+
StubNetwork.unstub!
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:host) do
|
15
|
+
Kanrisuru::Remote::Host.new(
|
16
|
+
host: 'localhost',
|
17
|
+
username: 'ubuntu',
|
18
|
+
keys: ['id_rsa']
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'responds to methods' do
|
23
|
+
expect(host).to respond_to(:ip)
|
24
|
+
end
|
25
|
+
|
6
26
|
it 'responds to ip fields' do
|
7
27
|
expect(Kanrisuru::Core::IP::IPROUTE2_JSON_VERSION).to(
|
8
28
|
eq(180_129)
|
data/spec/unit/core/path_spec.rb
CHANGED
@@ -3,6 +3,31 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe Kanrisuru::Core::Path do
|
6
|
+
before(:all) do
|
7
|
+
StubNetwork.stub!
|
8
|
+
end
|
9
|
+
|
10
|
+
after(:all) do
|
11
|
+
StubNetwork.unstub!
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:host) do
|
15
|
+
Kanrisuru::Remote::Host.new(
|
16
|
+
host: 'localhost',
|
17
|
+
username: 'ubuntu',
|
18
|
+
keys: ['id_rsa']
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'responds to methods' do
|
23
|
+
expect(host).to respond_to(:ls)
|
24
|
+
expect(host).to respond_to(:pwd)
|
25
|
+
expect(host).to respond_to(:realpath)
|
26
|
+
expect(host).to respond_to(:readlink)
|
27
|
+
expect(host).to respond_to(:whoami)
|
28
|
+
expect(host).to respond_to(:which)
|
29
|
+
end
|
30
|
+
|
6
31
|
it 'responds to path fields' do
|
7
32
|
expect(Kanrisuru::Core::Path::FilePath.new).to respond_to(:path)
|
8
33
|
expect(Kanrisuru::Core::Path::FileInfoId.new).to respond_to(
|
@@ -3,6 +3,26 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe Kanrisuru::Core::Socket do
|
6
|
+
before(:all) do
|
7
|
+
StubNetwork.stub!
|
8
|
+
end
|
9
|
+
|
10
|
+
after(:all) do
|
11
|
+
StubNetwork.unstub!
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:host) do
|
15
|
+
Kanrisuru::Remote::Host.new(
|
16
|
+
host: 'localhost',
|
17
|
+
username: 'ubuntu',
|
18
|
+
keys: ['id_rsa']
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'responds to methods' do
|
23
|
+
expect(host).to respond_to(:ss)
|
24
|
+
end
|
25
|
+
|
6
26
|
it 'responds to socket fields' do
|
7
27
|
expect(Kanrisuru::Core::Socket::Statistics.new).to respond_to(
|
8
28
|
:netid, :state, :receive_queue, :send_queue,
|
data/spec/unit/core/stat_spec.rb
CHANGED
@@ -3,6 +3,33 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe Kanrisuru::Core::Stat do
|
6
|
+
before(:all) do
|
7
|
+
StubNetwork.stub!
|
8
|
+
end
|
9
|
+
|
10
|
+
after(:all) do
|
11
|
+
StubNetwork.unstub!
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:host) do
|
15
|
+
Kanrisuru::Remote::Host.new(
|
16
|
+
host: 'localhost',
|
17
|
+
username: 'ubuntu',
|
18
|
+
keys: ['id_rsa']
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'responds to methods' do
|
23
|
+
expect(host).to respond_to(:dir?)
|
24
|
+
expect(host).to respond_to(:file?)
|
25
|
+
expect(host).to respond_to(:block_device?)
|
26
|
+
expect(host).to respond_to(:char_device?)
|
27
|
+
expect(host).to respond_to(:symlink?)
|
28
|
+
expect(host).to respond_to(:file_type?)
|
29
|
+
expect(host).to respond_to(:inode?)
|
30
|
+
expect(host).to respond_to(:stat)
|
31
|
+
end
|
32
|
+
|
6
33
|
it 'responds to stat fields' do
|
7
34
|
expect(Kanrisuru::Core::Stat::FileStat.new).to respond_to(
|
8
35
|
:mode, :blocks, :device, :file_type,
|
@@ -3,6 +3,41 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe Kanrisuru::Core::System do
|
6
|
+
before(:all) do
|
7
|
+
StubNetwork.stub!
|
8
|
+
end
|
9
|
+
|
10
|
+
after(:all) do
|
11
|
+
StubNetwork.unstub!
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:host) do
|
15
|
+
Kanrisuru::Remote::Host.new(
|
16
|
+
host: 'localhost',
|
17
|
+
username: 'ubuntu',
|
18
|
+
keys: ['id_rsa']
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'responds to methods' do
|
23
|
+
expect(host).to respond_to(:load_env)
|
24
|
+
expect(host).to respond_to(:cpu_info)
|
25
|
+
expect(host).to respond_to(:lscpu)
|
26
|
+
expect(host).to respond_to(:load_average)
|
27
|
+
expect(host).to respond_to(:free)
|
28
|
+
expect(host).to respond_to(:ps)
|
29
|
+
expect(host).to respond_to(:kill)
|
30
|
+
expect(host).to respond_to(:kernel_statistics)
|
31
|
+
expect(host).to respond_to(:kstat)
|
32
|
+
expect(host).to respond_to(:lsof)
|
33
|
+
expect(host).to respond_to(:last)
|
34
|
+
expect(host).to respond_to(:uptime)
|
35
|
+
expect(host).to respond_to(:w)
|
36
|
+
expect(host).to respond_to(:who)
|
37
|
+
expect(host).to respond_to(:reboot)
|
38
|
+
expect(host).to respond_to(:poweroff)
|
39
|
+
end
|
40
|
+
|
6
41
|
it 'responds to system fields' do
|
7
42
|
expect(Kanrisuru::Core::System::CPUArchitectureVulnerability.new).to respond_to(
|
8
43
|
:name,
|
@@ -3,6 +3,28 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe Kanrisuru::Core::Transfer do
|
6
|
+
before(:all) do
|
7
|
+
StubNetwork.stub!
|
8
|
+
end
|
9
|
+
|
10
|
+
after(:all) do
|
11
|
+
StubNetwork.unstub!
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:host) do
|
15
|
+
Kanrisuru::Remote::Host.new(
|
16
|
+
host: 'localhost',
|
17
|
+
username: 'ubuntu',
|
18
|
+
keys: ['id_rsa']
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'responds to methods' do
|
23
|
+
expect(host).to respond_to(:download)
|
24
|
+
expect(host).to respond_to(:upload)
|
25
|
+
expect(host).to respond_to(:wget)
|
26
|
+
end
|
27
|
+
|
6
28
|
it 'responds to transfer fields' do
|
7
29
|
expect(Kanrisuru::Core::Transfer::WGET_FILENAME_MODES).to eq(
|
8
30
|
%w[unix windows nocontrol ascii lowercase uppercase]
|
data/spec/unit/core/user_spec.rb
CHANGED
@@ -3,6 +3,31 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe Kanrisuru::Core::User do
|
6
|
+
before(:all) do
|
7
|
+
StubNetwork.stub!
|
8
|
+
end
|
9
|
+
|
10
|
+
after(:all) do
|
11
|
+
StubNetwork.unstub!
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:host) do
|
15
|
+
Kanrisuru::Remote::Host.new(
|
16
|
+
host: 'localhost',
|
17
|
+
username: 'ubuntu',
|
18
|
+
keys: ['id_rsa']
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'responds to methods' do
|
23
|
+
expect(host).to respond_to(:user?)
|
24
|
+
expect(host).to respond_to(:get_uid)
|
25
|
+
expect(host).to respond_to(:get_user)
|
26
|
+
expect(host).to respond_to(:create_user)
|
27
|
+
expect(host).to respond_to(:update_user)
|
28
|
+
expect(host).to respond_to(:delete_user)
|
29
|
+
end
|
30
|
+
|
6
31
|
it 'responds to user fields' do
|
7
32
|
expect(Kanrisuru::Core::User::User.new).to respond_to(:uid, :name, :home, :shell, :groups)
|
8
33
|
expect(Kanrisuru::Core::User::UserGroup.new).to respond_to(:gid, :name)
|
data/spec/unit/core/yum_spec.rb
CHANGED
@@ -3,6 +3,26 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe Kanrisuru::Core::Yum do
|
6
|
+
before(:all) do
|
7
|
+
StubNetwork.stub!('centos')
|
8
|
+
end
|
9
|
+
|
10
|
+
after(:all) do
|
11
|
+
StubNetwork.unstub!
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:host) do
|
15
|
+
Kanrisuru::Remote::Host.new(
|
16
|
+
host: 'centos-host',
|
17
|
+
username: 'centos',
|
18
|
+
keys: ['id_rsa']
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'responds to methods' do
|
23
|
+
expect(host).to respond_to(:yum)
|
24
|
+
end
|
25
|
+
|
6
26
|
it 'responds to yum fields' do
|
7
27
|
expect(Kanrisuru::Core::Yum::PackageOverview.new).to respond_to(
|
8
28
|
:package, :architecture, :version, :installed
|
@@ -3,6 +3,26 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe Kanrisuru::Core::Zypper do
|
6
|
+
before(:all) do
|
7
|
+
StubNetwork.stub!('opensuse')
|
8
|
+
end
|
9
|
+
|
10
|
+
after(:all) do
|
11
|
+
StubNetwork.unstub!
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:host) do
|
15
|
+
Kanrisuru::Remote::Host.new(
|
16
|
+
host: 'opensuse-host',
|
17
|
+
username: 'opensuse',
|
18
|
+
keys: ['id_rsa']
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'responds to methods' do
|
23
|
+
expect(host).to respond_to(:zypper)
|
24
|
+
end
|
25
|
+
|
6
26
|
it 'responds to zypper fields' do
|
7
27
|
expect(Kanrisuru::Core::Zypper::PACKAGE_TYPES).to(
|
8
28
|
eq(%w[package patch pattern product srcpackage application])
|
data/spec/unit/mode_spec.rb
CHANGED
@@ -3,6 +3,18 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe Kanrisuru::Mode do
|
6
|
+
it 'responds to methods' do
|
7
|
+
mode = described_class.new('644')
|
8
|
+
expect(mode).to respond_to(:directory?)
|
9
|
+
expect(mode).to respond_to(:symbolic)
|
10
|
+
expect(mode).to respond_to(:symbolic=)
|
11
|
+
expect(mode).to respond_to(:numeric)
|
12
|
+
expect(mode).to respond_to(:numeric=)
|
13
|
+
expect(mode).to respond_to(:inspect)
|
14
|
+
expect(mode).to respond_to(:to_s)
|
15
|
+
expect(mode).to respond_to(:to_i)
|
16
|
+
end
|
17
|
+
|
6
18
|
it 'parses int mode' do
|
7
19
|
mode = described_class.new('644')
|
8
20
|
expect(mode.directory?).to eq(false)
|
@@ -205,4 +217,23 @@ RSpec.describe Kanrisuru::Mode do
|
|
205
217
|
mode.symbolic = '-w'
|
206
218
|
expect(mode.symbolic).to eq('---xr-xr--')
|
207
219
|
end
|
220
|
+
|
221
|
+
context Kanrisuru::Mode::Permission do
|
222
|
+
it 'responds to methods' do
|
223
|
+
mode = Kanrisuru::Mode::Permission.new('644', 'rw-rw-r--')
|
224
|
+
expect(mode).to respond_to(:to_i)
|
225
|
+
expect(mode).to respond_to(:to_s)
|
226
|
+
expect(mode).to respond_to(:all?)
|
227
|
+
expect(mode).to respond_to(:numeric)
|
228
|
+
expect(mode).to respond_to(:numeric=)
|
229
|
+
expect(mode).to respond_to(:symbolic=)
|
230
|
+
expect(mode).to respond_to(:symbolic)
|
231
|
+
expect(mode).to respond_to(:read=)
|
232
|
+
expect(mode).to respond_to(:read?)
|
233
|
+
expect(mode).to respond_to(:write=)
|
234
|
+
expect(mode).to respond_to(:write?)
|
235
|
+
expect(mode).to respond_to(:execute=)
|
236
|
+
expect(mode).to respond_to(:execute?)
|
237
|
+
end
|
238
|
+
end
|
208
239
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
RSpec.describe Kanrisuru::Remote::Cluster do
|
2
|
+
before(:all) do
|
3
|
+
StubNetwork.stub!
|
4
|
+
end
|
5
|
+
|
6
|
+
after(:all) do
|
7
|
+
StubNetwork.unstub!
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:host1) do
|
11
|
+
Kanrisuru::Remote::Host.new(
|
12
|
+
host: 'localhost',
|
13
|
+
username: 'ubuntu',
|
14
|
+
keys: ['id_rsa']
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'responds to methods' do
|
19
|
+
cluster = Kanrisuru::Remote::Cluster.new(host1)
|
20
|
+
expect(cluster).to respond_to(:hosts)
|
21
|
+
expect(cluster).to respond_to(:[])
|
22
|
+
expect(cluster).to respond_to(:<<)
|
23
|
+
expect(cluster).to respond_to(:delete)
|
24
|
+
expect(cluster).to respond_to(:execute)
|
25
|
+
expect(cluster).to respond_to(:execute_shell)
|
26
|
+
expect(cluster).to respond_to(:each)
|
27
|
+
expect(cluster).to respond_to(:hostname)
|
28
|
+
expect(cluster).to respond_to(:ping?)
|
29
|
+
expect(cluster).to respond_to(:su)
|
30
|
+
expect(cluster).to respond_to(:chdir)
|
31
|
+
expect(cluster).to respond_to(:cd)
|
32
|
+
expect(cluster).to respond_to(:disconnect)
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe Kanrisuru::Remote::Cpu do
|
6
|
+
before(:all) do
|
7
|
+
StubNetwork.stub!
|
8
|
+
end
|
9
|
+
|
10
|
+
after(:all) do
|
11
|
+
StubNetwork.unstub!
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:host) do
|
15
|
+
Kanrisuru::Remote::Host.new(
|
16
|
+
host: 'localhost',
|
17
|
+
username: 'ubuntu',
|
18
|
+
keys: ['id_rsa']
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'responds to methods' do
|
23
|
+
cpu = Kanrisuru::Remote::Cpu.new(host)
|
24
|
+
|
25
|
+
expect(cpu).to respond_to(:load_average)
|
26
|
+
expect(cpu).to respond_to(:load_average1)
|
27
|
+
expect(cpu).to respond_to(:load_average5)
|
28
|
+
expect(cpu).to respond_to(:load_average15)
|
29
|
+
expect(cpu).to respond_to(:sockets)
|
30
|
+
expect(cpu).to respond_to(:cores)
|
31
|
+
expect(cpu).to respond_to(:total)
|
32
|
+
expect(cpu).to respond_to(:count)
|
33
|
+
expect(cpu).to respond_to(:threads_per_core)
|
34
|
+
expect(cpu).to respond_to(:cores_per_socket)
|
35
|
+
expect(cpu).to respond_to(:numa_nodes)
|
36
|
+
expect(cpu).to respond_to(:vendor_id)
|
37
|
+
expect(cpu).to respond_to(:cpu_family)
|
38
|
+
expect(cpu).to respond_to(:model)
|
39
|
+
expect(cpu).to respond_to(:model_name)
|
40
|
+
expect(cpu).to respond_to(:byte_order)
|
41
|
+
expect(cpu).to respond_to(:address_sizes)
|
42
|
+
expect(cpu).to respond_to(:cpu_mhz)
|
43
|
+
expect(cpu).to respond_to(:cpu_max_mhz)
|
44
|
+
expect(cpu).to respond_to(:cpu_min_mhz)
|
45
|
+
expect(cpu).to respond_to(:hypervisor)
|
46
|
+
expect(cpu).to respond_to(:virtualization_type)
|
47
|
+
expect(cpu).to respond_to(:flags)
|
48
|
+
expect(cpu).to respond_to(:hyperthreading?)
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe Kanrisuru::Remote::Env do
|
6
|
+
|
7
|
+
it 'responds to methods' do
|
8
|
+
env = Kanrisuru::Remote::Env.new
|
9
|
+
expect(env).to respond_to(:to_h)
|
10
|
+
expect(env).to respond_to(:to_s)
|
11
|
+
expect(env).to respond_to(:clear)
|
12
|
+
expect(env).to respond_to(:count)
|
13
|
+
expect(env).to respond_to(:count)
|
14
|
+
expect(env).to respond_to(:delete)
|
15
|
+
expect(env).to respond_to(:[])
|
16
|
+
expect(env).to respond_to(:[]=)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
File without changes
|