train 1.5.11 → 1.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/train/transports/winrm.rb +16 -4
- data/lib/train/version.rb +1 -1
- metadata +3 -165
- data/.rubocop.yml +0 -77
- data/CHANGELOG.md +0 -900
- data/Gemfile +0 -41
- data/README.md +0 -212
- data/Rakefile +0 -73
- data/test/fixtures/plugins/train-test-fixture/LICENSE +0 -201
- data/test/fixtures/plugins/train-test-fixture/README.md +0 -5
- data/test/fixtures/plugins/train-test-fixture/lib/train-test-fixture/connection.rb +0 -35
- data/test/fixtures/plugins/train-test-fixture/lib/train-test-fixture/platform.rb +0 -18
- data/test/fixtures/plugins/train-test-fixture/lib/train-test-fixture/transport.rb +0 -14
- data/test/fixtures/plugins/train-test-fixture/lib/train-test-fixture/version.rb +0 -5
- data/test/fixtures/plugins/train-test-fixture/lib/train-test-fixture.rb +0 -4
- data/test/fixtures/plugins/train-test-fixture/pkg/train-test-fixture-0.1.0.gem +0 -0
- data/test/fixtures/plugins/train-test-fixture/train-test-fixture.gemspec +0 -35
- data/test/integration/.kitchen.yml +0 -43
- data/test/integration/Berksfile +0 -3
- data/test/integration/bootstrap.sh +0 -22
- data/test/integration/chefignore +0 -1
- data/test/integration/cookbooks/test/metadata.rb +0 -1
- data/test/integration/cookbooks/test/recipes/default.rb +0 -100
- data/test/integration/cookbooks/test/recipes/prep_files.rb +0 -56
- data/test/integration/docker_run.rb +0 -153
- data/test/integration/docker_test.rb +0 -24
- data/test/integration/docker_test_container.rb +0 -24
- data/test/integration/helper.rb +0 -61
- data/test/integration/sudo/customcommand.rb +0 -15
- data/test/integration/sudo/nopasswd.rb +0 -16
- data/test/integration/sudo/passwd.rb +0 -21
- data/test/integration/sudo/reqtty.rb +0 -17
- data/test/integration/sudo/run_as.rb +0 -12
- data/test/integration/test-travis-centos.yml +0 -6
- data/test/integration/test-travis-debian.yml +0 -6
- data/test/integration/test-travis-fedora.yml +0 -8
- data/test/integration/test-travis-oel.yml +0 -6
- data/test/integration/test-travis-ubuntu.yml +0 -8
- data/test/integration/test_local.rb +0 -19
- data/test/integration/test_ssh.rb +0 -39
- data/test/integration/tests/path_block_device_test.rb +0 -74
- data/test/integration/tests/path_character_device_test.rb +0 -74
- data/test/integration/tests/path_file_test.rb +0 -99
- data/test/integration/tests/path_folder_test.rb +0 -90
- data/test/integration/tests/path_missing_test.rb +0 -76
- data/test/integration/tests/path_pipe_test.rb +0 -62
- data/test/integration/tests/path_symlink_test.rb +0 -95
- data/test/integration/tests/run_command_test.rb +0 -35
- data/test/unit/extras/command_wrapper_test.rb +0 -110
- data/test/unit/extras/stat_test.rb +0 -210
- data/test/unit/file/local/unix_test.rb +0 -224
- data/test/unit/file/local/windows_test.rb +0 -101
- data/test/unit/file/local_test.rb +0 -121
- data/test/unit/file/remote/aix_test.rb +0 -81
- data/test/unit/file/remote/linux_test.rb +0 -221
- data/test/unit/file/remote/qnx_test.rb +0 -80
- data/test/unit/file/remote/unix_test.rb +0 -119
- data/test/unit/file/remote/windows_test.rb +0 -72
- data/test/unit/file/remote_test.rb +0 -62
- data/test/unit/file_test.rb +0 -129
- data/test/unit/helper.rb +0 -7
- data/test/unit/platforms/detect/os_common_test.rb +0 -85
- data/test/unit/platforms/detect/os_linux_test.rb +0 -132
- data/test/unit/platforms/detect/os_windows_test.rb +0 -107
- data/test/unit/platforms/detect/scanner_test.rb +0 -61
- data/test/unit/platforms/detect/uuid_test.rb +0 -133
- data/test/unit/platforms/family_test.rb +0 -32
- data/test/unit/platforms/os_detect_test.rb +0 -249
- data/test/unit/platforms/platform_test.rb +0 -405
- data/test/unit/platforms/platforms_test.rb +0 -52
- data/test/unit/plugins/connection_test.rb +0 -219
- data/test/unit/plugins/transport_test.rb +0 -111
- data/test/unit/plugins_test.rb +0 -22
- data/test/unit/train_test.rb +0 -247
- data/test/unit/transports/aws_test.rb +0 -120
- data/test/unit/transports/azure_test.rb +0 -145
- data/test/unit/transports/cisco_ios_connection.rb +0 -92
- data/test/unit/transports/gcp_test.rb +0 -266
- data/test/unit/transports/helpers/azure/file_credentials_test.rb +0 -129
- data/test/unit/transports/local_test.rb +0 -183
- data/test/unit/transports/mock_test.rb +0 -150
- data/test/unit/transports/ssh_test.rb +0 -330
- data/test/unit/transports/vmware_test.rb +0 -159
- data/test/unit/version_test.rb +0 -8
- data/test/windows/local_test.rb +0 -243
- data/test/windows/winrm_test.rb +0 -187
- data/train.gemspec +0 -45
@@ -1,74 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
describe 'file interface' do
|
4
|
-
let(:backend) { get_backend.call }
|
5
|
-
|
6
|
-
describe 'block device' do
|
7
|
-
let(:file) { backend.file('/tmp/block_device') }
|
8
|
-
|
9
|
-
it 'exists' do
|
10
|
-
file.exist?.must_equal(true)
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'is a block device' do
|
14
|
-
file.block_device?.must_equal(true)
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'has type :block_device' do
|
18
|
-
file.type.must_equal(:block_device)
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'has no content' do
|
22
|
-
file.content.must_equal('')
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'has owner name root' do
|
26
|
-
file.owner.must_equal('root')
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'has group name' do
|
30
|
-
file.group.must_equal(Test.root_group(backend.os))
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'has mode 0666' do
|
34
|
-
file.mode.must_equal(00666)
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'checks mode? 0666' do
|
38
|
-
file.mode?(00666).must_equal(true)
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'has no link_path' do
|
42
|
-
file.link_path.must_be_nil
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'has the correct md5sum' do
|
46
|
-
file.md5sum.must_equal('d41d8cd98f00b204e9800998ecf8427e')
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'has the correct sha256sum' do
|
50
|
-
file.sha256sum.must_equal('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'has a modified time' do
|
54
|
-
file.mtime.must_be_close_to(Time.now.to_i - Test.mtime/2, Test.mtime)
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'has inode size of 0' do
|
58
|
-
file.size.must_equal(0)
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'has selinux label handling' do
|
62
|
-
res = Test.selinux_label(backend, file.path)
|
63
|
-
file.selinux_label.must_equal(res)
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'has no product_version' do
|
67
|
-
file.product_version.must_be_nil
|
68
|
-
end
|
69
|
-
|
70
|
-
it 'has no file_version' do
|
71
|
-
file.file_version.must_be_nil
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
describe 'file interface' do
|
4
|
-
let(:backend) { get_backend.call }
|
5
|
-
|
6
|
-
describe 'character device' do
|
7
|
-
let(:file) { backend.file('/dev/null') }
|
8
|
-
|
9
|
-
it 'exists' do
|
10
|
-
file.exist?.must_equal(true)
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'is a character device' do
|
14
|
-
file.character_device?.must_equal(true)
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'has type :character_device' do
|
18
|
-
file.type.must_equal(:character_device)
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'has empty content' do
|
22
|
-
file.content.must_equal('')
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'has owner name root' do
|
26
|
-
file.owner.must_equal('root')
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'has group name' do
|
30
|
-
file.group.must_equal(Test.root_group(backend.os))
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'has mode 0666' do
|
34
|
-
file.mode.must_equal(00666)
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'checks mode? 0666' do
|
38
|
-
file.mode?(00666).must_equal(true)
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'has no link_path' do
|
42
|
-
file.link_path.must_be_nil
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'has an md5sum' do
|
46
|
-
file.md5sum.must_equal('d41d8cd98f00b204e9800998ecf8427e')
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'has an sha256sum' do
|
50
|
-
file.sha256sum.must_equal('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'has a modified time' do
|
54
|
-
file.mtime.must_be_close_to(Time.now.to_i - Test.mtime/2, Test.mtime)
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'has inode size of 0' do
|
58
|
-
file.size.must_equal(0)
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'has selinux label handling' do
|
62
|
-
res = Test.selinux_label(backend, file.path)
|
63
|
-
file.selinux_label.must_equal(res)
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'has no product_version' do
|
67
|
-
file.product_version.must_be_nil
|
68
|
-
end
|
69
|
-
|
70
|
-
it 'has no file_version' do
|
71
|
-
file.file_version.must_be_nil
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
@@ -1,99 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
describe 'file interface' do
|
4
|
-
let(:backend) { get_backend.call }
|
5
|
-
|
6
|
-
describe 'regular file' do
|
7
|
-
let(:file) { backend.file('/tmp/file') }
|
8
|
-
|
9
|
-
it 'exists' do
|
10
|
-
file.exist?.must_equal(true)
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'is a file' do
|
14
|
-
file.file?.must_equal(true)
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'has type :file' do
|
18
|
-
file.type.must_equal(:file)
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'has content' do
|
22
|
-
file.content.must_equal('hello world')
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'has owner name root' do
|
26
|
-
file.owner.must_equal('root')
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'has group name' do
|
30
|
-
file.group.must_equal(Test.root_group(backend.os))
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'has mode 0765' do
|
34
|
-
file.mode.must_equal(00765)
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'checks mode? 0765' do
|
38
|
-
file.mode?(00765).must_equal(true)
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'doesnt check mode? 0764' do
|
42
|
-
file.mode?(00764).must_equal(false)
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'has no link_path' do
|
46
|
-
file.link_path.must_be_nil
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'has an md5sum' do
|
50
|
-
file.md5sum.must_equal('5eb63bbbe01eeed093cb22bb8f5acdc3')
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'has an sha256sum' do
|
54
|
-
file.sha256sum.must_equal('b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9')
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'has a modified time' do
|
58
|
-
file.mtime.must_be_close_to(Time.now.to_i - Test.mtime/2, Test.mtime)
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'has size' do
|
62
|
-
# Must be around 11 Bytes, +- 4
|
63
|
-
file.size.must_be_close_to(11, 4)
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'has selinux label handling' do
|
67
|
-
res = Test.selinux_label(backend, file.path)
|
68
|
-
file.selinux_label.must_equal(res)
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'has no product_version' do
|
72
|
-
file.product_version.must_be_nil
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'has no file_version' do
|
76
|
-
file.file_version.must_be_nil
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'provides a json representation' do
|
80
|
-
j = file.to_json
|
81
|
-
j.must_be_kind_of Hash
|
82
|
-
j['type'].must_equal :file
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
describe 'regular file' do
|
87
|
-
let(:file) { backend.file('/tmp/sfile') }
|
88
|
-
it 'has mode 7765' do
|
89
|
-
file.mode.must_equal(07765)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
describe 'regular file' do
|
94
|
-
let(:file) { backend.file('/tmp/spaced file') }
|
95
|
-
it 'has content' do
|
96
|
-
file.content.must_equal('hello space')
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
@@ -1,90 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
describe 'file interface' do
|
4
|
-
let(:backend) { get_backend.call }
|
5
|
-
|
6
|
-
describe 'a folder' do
|
7
|
-
let(:file) { backend.file('/tmp/folder') }
|
8
|
-
|
9
|
-
it 'exists' do
|
10
|
-
file.exist?.must_equal(true)
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'is a directory' do
|
14
|
-
file.directory?.must_equal(true)
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'has type :directory' do
|
18
|
-
file.type.must_equal(:directory)
|
19
|
-
end
|
20
|
-
|
21
|
-
case get_backend.call.os[:family]
|
22
|
-
when 'freebsd'
|
23
|
-
it 'has freebsd folder content behavior' do
|
24
|
-
file.content.must_equal("\u0003\u0000")
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'has an md5sum' do
|
28
|
-
file.md5sum.must_equal('598f4fe64aefab8f00bcbea4c9239abf')
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'has an sha256sum' do
|
32
|
-
file.sha256sum.must_equal('9b4fb24edd6d1d8830e272398263cdbf026b97392cc35387b991dc0248a628f9')
|
33
|
-
end
|
34
|
-
|
35
|
-
else
|
36
|
-
it 'has no content' do
|
37
|
-
file.content.must_be_nil
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'raises an error if md5sum is attempted' do
|
41
|
-
proc { file.md5sum }.must_raise RuntimeError
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'raises an error if sha256sum is attempted' do
|
45
|
-
proc { file.sha256sum }.must_raise RuntimeError
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'has owner name root' do
|
50
|
-
file.owner.must_equal('root')
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'has group name' do
|
54
|
-
file.group.must_equal(Test.root_group(backend.os))
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'has mode 0567' do
|
58
|
-
file.mode.must_equal(00567)
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'checks mode? 0567' do
|
62
|
-
file.mode?(00567).must_equal(true)
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'has no link_path' do
|
66
|
-
file.link_path.must_be_nil
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'has a modified time' do
|
70
|
-
file.mtime.must_be_close_to(Time.now.to_i - Test.mtime/2, Test.mtime)
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'has inode size' do
|
74
|
-
file.size.must_be_close_to(4096, 4096)
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'has selinux label handling' do
|
78
|
-
res = Test.selinux_label(backend, file.path)
|
79
|
-
file.selinux_label.must_equal(res)
|
80
|
-
end
|
81
|
-
|
82
|
-
it 'has no product_version' do
|
83
|
-
file.product_version.must_be_nil
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'has no file_version' do
|
87
|
-
file.file_version.must_be_nil
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
@@ -1,76 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
describe 'file interface' do
|
4
|
-
let(:backend) { get_backend.call }
|
5
|
-
|
6
|
-
describe 'a path that doesnt exist' do
|
7
|
-
let(:file) {
|
8
|
-
backend.file('/do_not_create_this_path_please_or_my_tests_will_fail')
|
9
|
-
}
|
10
|
-
|
11
|
-
it 'does not exist' do
|
12
|
-
file.exist?.must_equal(false)
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'is not a file' do
|
16
|
-
file.file?.must_equal(false)
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'has type nil' do
|
20
|
-
file.type.must_be_nil
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'has no content' do
|
24
|
-
file.content.must_be_nil
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'has no owner' do
|
28
|
-
file.owner.must_be_nil
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'has no group' do
|
32
|
-
file.group.must_be_nil
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'has mode nil' do
|
36
|
-
file.mode.must_be_nil
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'checks mode? nil' do
|
40
|
-
file.mode?(nil).must_equal(true)
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'has no link_path' do
|
44
|
-
file.link_path.must_be_nil
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'raises an error if md5sum is attempted' do
|
48
|
-
proc { file.md5sum }.must_raise RuntimeError
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'raises an error if sha256sum is attempted' do
|
52
|
-
proc { file.sha256sum }.must_raise RuntimeError
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'has a modified time' do
|
56
|
-
file.mtime.must_be_nil
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'has inode size' do
|
60
|
-
# Must be around 11 Bytes, +- 4
|
61
|
-
file.size.must_be_nil
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'has no selinux_label' do
|
65
|
-
file.selinux_label.must_be_nil
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'has no product_version' do
|
69
|
-
file.product_version.must_be_nil
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'has no file_version' do
|
73
|
-
file.file_version.must_be_nil
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
describe 'file interface' do
|
4
|
-
let(:backend) { get_backend.call }
|
5
|
-
|
6
|
-
describe 'pipe / fifo' do
|
7
|
-
let(:file) { backend.file('/tmp/pipe') }
|
8
|
-
|
9
|
-
it 'exists' do
|
10
|
-
file.exist?.must_equal(true)
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'is a pipe' do
|
14
|
-
file.pipe?.must_equal(true)
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'has type :pipe' do
|
18
|
-
file.type.must_equal(:pipe)
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'has owner name root' do
|
22
|
-
file.owner.must_equal('root')
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'has group name' do
|
26
|
-
file.group.must_equal(Test.root_group(backend.os))
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'has mode 0644' do
|
30
|
-
file.mode.must_equal(00644)
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'checks mode? 0644' do
|
34
|
-
file.mode?(00644).must_equal(true)
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'has no link_path' do
|
38
|
-
file.link_path.must_be_nil
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'has a modified time' do
|
42
|
-
file.mtime.must_be_close_to(Time.now.to_i - Test.mtime/2, Test.mtime)
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'has inode size of 0' do
|
46
|
-
file.size.must_equal(0)
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'has selinux label handling' do
|
50
|
-
res = Test.selinux_label(backend, file.path)
|
51
|
-
file.selinux_label.must_equal(res)
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'has no product_version' do
|
55
|
-
file.product_version.must_be_nil
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'has no file_version' do
|
59
|
-
file.file_version.must_be_nil
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,95 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
describe 'file interface' do
|
4
|
-
let(:backend) { get_backend.call }
|
5
|
-
|
6
|
-
describe 'symlink file' do
|
7
|
-
let(:file) { backend.file('/tmp/symlink') }
|
8
|
-
|
9
|
-
it 'exists' do
|
10
|
-
file.exist?.must_equal(true)
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'is a symlink' do
|
14
|
-
file.symlink?.must_equal(true)
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'is pointing to a file' do
|
18
|
-
file.file?.must_equal(true)
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'is not pointing to a folder' do
|
22
|
-
file.directory?.must_equal(false)
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'has type :file' do
|
26
|
-
file.type.must_equal(:file)
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'has content' do
|
30
|
-
file.content.must_equal('hello world')
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'has owner name root' do
|
34
|
-
file.owner.must_equal('root')
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'has uid 0' do
|
38
|
-
file.uid.must_equal(0)
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'has group name' do
|
42
|
-
file.group.must_equal(Test.root_group(backend.os))
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'has gid 0' do
|
46
|
-
file.gid.must_equal(0)
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'has mode 0777' do
|
50
|
-
file.source.mode.must_equal(00777)
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'has mode 0765' do
|
54
|
-
file.mode.must_equal(00765)
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'checks mode? 0765' do
|
58
|
-
file.mode?(00765).must_equal(true)
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'has link_path' do
|
62
|
-
file.link_path.must_equal('/tmp/file')
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'has an md5sum' do
|
66
|
-
file.md5sum.must_equal('5eb63bbbe01eeed093cb22bb8f5acdc3')
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'has an sha256sum' do
|
70
|
-
file.sha256sum.must_equal('b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9')
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'has a modified time' do
|
74
|
-
file.mtime.must_be_close_to(Time.now.to_i - Test.mtime/2, Test.mtime)
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'has size' do
|
78
|
-
# Must be around 11 Bytes, +- 4
|
79
|
-
file.size.must_be_close_to(11, 4)
|
80
|
-
end
|
81
|
-
|
82
|
-
it 'has selinux label handling' do
|
83
|
-
res = Test.selinux_label(backend, file.path)
|
84
|
-
file.selinux_label.must_equal(res)
|
85
|
-
end
|
86
|
-
|
87
|
-
it 'has no product_version' do
|
88
|
-
file.product_version.must_be_nil
|
89
|
-
end
|
90
|
-
|
91
|
-
it 'has no file_version' do
|
92
|
-
file.file_version.must_be_nil
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
describe 'run_command' do
|
4
|
-
let(:backend) { get_backend.call() }
|
5
|
-
|
6
|
-
it 'can echo commands' do
|
7
|
-
res = backend.run_command('echo hello world')
|
8
|
-
res.stdout.must_equal("hello world\n")
|
9
|
-
res.stderr.must_equal('')
|
10
|
-
res.exit_status.must_equal(0)
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'can run frozen commands' do
|
14
|
-
res = backend.run_command('echo hello world'.freeze)
|
15
|
-
res.stdout.must_equal("hello world\n")
|
16
|
-
res.stderr.must_equal('')
|
17
|
-
res.exit_status.must_equal(0)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'can echo commands to stderr' do
|
21
|
-
# TODO: Specinfra often fails on this test.
|
22
|
-
# Fix and re-enable it.
|
23
|
-
res = backend.run_command('>&2 echo hello world')
|
24
|
-
res.stdout.must_equal('')
|
25
|
-
res.stderr.must_equal("hello world\n")
|
26
|
-
res.exit_status.must_equal(0)
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'prints a correct exit status' do
|
30
|
-
res = backend.run_command('exit 123')
|
31
|
-
res.stdout.must_equal('')
|
32
|
-
res.stderr.must_equal('')
|
33
|
-
res.exit_status.must_equal(123)
|
34
|
-
end
|
35
|
-
end
|