inspec 0.30.0 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +50 -2
- data/Gemfile +2 -1
- data/docs/cli.rst +1 -17
- data/docs/resources.rst +128 -0
- data/docs/shell.rst +130 -0
- data/inspec.gemspec +3 -4
- data/lib/bundles/inspec-compliance/.kitchen.yml +0 -1
- data/lib/bundles/inspec-compliance/README.md +8 -3
- data/lib/bundles/inspec-compliance/api.rb +21 -6
- data/lib/bundles/inspec-compliance/bootstrap.sh +13 -9
- data/lib/bundles/inspec-compliance/cli.rb +23 -19
- data/lib/bundles/inspec-compliance/target.rb +1 -0
- data/lib/bundles/inspec-compliance/test/integration/default/cli.rb +42 -5
- data/lib/bundles/inspec-init/cli.rb +9 -0
- data/lib/bundles/inspec-supermarket/cli.rb +9 -0
- data/lib/bundles/inspec-supermarket/target.rb +2 -1
- data/lib/fetchers/local.rb +5 -2
- data/lib/fetchers/url.rb +1 -0
- data/lib/inspec/base_cli.rb +2 -1
- data/lib/inspec/cli.rb +14 -5
- data/lib/inspec/dependencies/dependency_set.rb +38 -0
- data/lib/inspec/dependencies/requirement.rb +103 -0
- data/lib/inspec/{dependencies.rb → dependencies/resolver.rb} +13 -132
- data/lib/inspec/dependencies/vendor_index.rb +98 -0
- data/lib/inspec/plugins/source_reader.rb +4 -0
- data/lib/inspec/profile.rb +2 -2
- data/lib/inspec/resource.rb +2 -0
- data/lib/inspec/runner.rb +13 -1
- data/lib/inspec/runner_mock.rb +4 -0
- data/lib/inspec/runner_rspec.rb +6 -2
- data/lib/inspec/shell.rb +22 -1
- data/lib/inspec/version.rb +1 -1
- data/lib/resources/iis_site.rb +107 -0
- data/lib/resources/port.rb +11 -4
- data/lib/resources/ssh_conf.rb +10 -2
- data/lib/resources/ssl.rb +94 -0
- data/lib/resources/xinetd.rb +11 -2
- data/lib/utils/parser.rb +6 -1
- metadata +17 -561
- data/lib/utils/hash_map.rb +0 -37
- data/tasks/maintainers.rb +0 -213
- data/test/bench/startup/startup.flat.txt +0 -1005
- data/test/bench/startup/startup.graph.html +0 -71958
- data/test/bench/startup/startup.grind.dat +0 -101602
- data/test/bench/startup/startup.stack.html +0 -24516
- data/test/bench/startup.flat.txt +0 -998
- data/test/bench/startup.graph.html +0 -71420
- data/test/bench/startup.grind.dat +0 -103554
- data/test/bench/startup.stack.html +0 -25015
- data/test/cookbooks/os_prepare/attributes/default.rb +0 -2
- data/test/cookbooks/os_prepare/files/empty.iso +0 -0
- data/test/cookbooks/os_prepare/files/example.csv +0 -7
- data/test/cookbooks/os_prepare/files/example.ini +0 -6
- data/test/cookbooks/os_prepare/files/example.json +0 -12
- data/test/cookbooks/os_prepare/files/example.yml +0 -7
- data/test/cookbooks/os_prepare/metadata.rb +0 -13
- data/test/cookbooks/os_prepare/recipes/_runit_service_centos.rb +0 -34
- data/test/cookbooks/os_prepare/recipes/_upstart_service_centos.rb +0 -25
- data/test/cookbooks/os_prepare/recipes/apache.rb +0 -14
- data/test/cookbooks/os_prepare/recipes/apt.rb +0 -20
- data/test/cookbooks/os_prepare/recipes/auditctl.rb +0 -8
- data/test/cookbooks/os_prepare/recipes/default.rb +0 -29
- data/test/cookbooks/os_prepare/recipes/file.rb +0 -46
- data/test/cookbooks/os_prepare/recipes/iptables.rb +0 -13
- data/test/cookbooks/os_prepare/recipes/json_yaml_csv_ini.rb +0 -34
- data/test/cookbooks/os_prepare/recipes/mount.rb +0 -33
- data/test/cookbooks/os_prepare/recipes/package.rb +0 -25
- data/test/cookbooks/os_prepare/recipes/postgres.rb +0 -20
- data/test/cookbooks/os_prepare/recipes/prep_container.rb +0 -15
- data/test/cookbooks/os_prepare/recipes/registry_key.rb +0 -87
- data/test/cookbooks/os_prepare/recipes/service.rb +0 -19
- data/test/cookbooks/os_prepare/templates/default/sv-default-svlog-run.erb +0 -2
- data/test/docker_run.rb +0 -162
- data/test/docker_test.rb +0 -58
- data/test/functional/helper.rb +0 -37
- data/test/functional/inheritance_test.rb +0 -62
- data/test/functional/inspec_archive_test.rb +0 -80
- data/test/functional/inspec_compliance_test.rb +0 -61
- data/test/functional/inspec_exec_json_test.rb +0 -122
- data/test/functional/inspec_exec_jsonmin_test.rb +0 -59
- data/test/functional/inspec_exec_test.rb +0 -123
- data/test/functional/inspec_json_profile_test.rb +0 -103
- data/test/functional/inspec_test.rb +0 -91
- data/test/helper.rb +0 -329
- data/test/integration/default/_debug_spec.rb +0 -8
- data/test/integration/default/apache_conf_spec.rb +0 -21
- data/test/integration/default/apt_spec.rb +0 -37
- data/test/integration/default/auditd_rules_spec.rb +0 -32
- data/test/integration/default/cmp_matcher_spec.rb +0 -115
- data/test/integration/default/csv_spec.rb +0 -11
- data/test/integration/default/etc_group_spec.rb +0 -29
- data/test/integration/default/file_spec.rb +0 -195
- data/test/integration/default/group_spec.rb +0 -59
- data/test/integration/default/ini_spec.rb +0 -11
- data/test/integration/default/iptables_spec.rb +0 -29
- data/test/integration/default/json_spec.rb +0 -11
- data/test/integration/default/kernel_module_spec.rb +0 -23
- data/test/integration/default/kernel_parameter_spec.rb +0 -60
- data/test/integration/default/mount_spec.rb +0 -19
- data/test/integration/default/os_spec.rb +0 -13
- data/test/integration/default/package_spec.rb +0 -30
- data/test/integration/default/port_spec.rb +0 -27
- data/test/integration/default/postgres_session_spec.rb +0 -13
- data/test/integration/default/powershell_spec.rb +0 -42
- data/test/integration/default/registry_key_spec.rb +0 -109
- data/test/integration/default/secpol_spec.rb +0 -11
- data/test/integration/default/service_spec.rb +0 -128
- data/test/integration/default/user_spec.rb +0 -96
- data/test/integration/default/vbscript_spec.rb +0 -22
- data/test/integration/default/wmi_spec.rb +0 -66
- data/test/integration/default/yaml_spec.rb +0 -11
- data/test/resource/command_test.rb +0 -33
- data/test/resource/dsl_test.rb +0 -45
- data/test/resource/file_test.rb +0 -146
- data/test/resource/ssh_config.rb +0 -9
- data/test/resource/sshd_config.rb +0 -9
- data/test/test-extra.yaml +0 -11
- data/test/test.yaml +0 -11
- data/test/unit/control_test.rb +0 -58
- data/test/unit/fetchers/local_test.rb +0 -67
- data/test/unit/fetchers/mock_test.rb +0 -43
- data/test/unit/fetchers/tar_test.rb +0 -36
- data/test/unit/fetchers/url_test.rb +0 -152
- data/test/unit/fetchers/zip_test.rb +0 -36
- data/test/unit/fetchers_test.rb +0 -65
- data/test/unit/metadata_test.rb +0 -137
- data/test/unit/mock/cmd/$env-PATH +0 -1
- data/test/unit/mock/cmd/Get-NetAdapter +0 -24
- data/test/unit/mock/cmd/GetUserAccount +0 -33
- data/test/unit/mock/cmd/GetWin32Group +0 -23
- data/test/unit/mock/cmd/Resolve-DnsName +0 -26
- data/test/unit/mock/cmd/Test-NetConnection +0 -4
- data/test/unit/mock/cmd/auditctl +0 -3
- data/test/unit/mock/cmd/auditctl-legacy +0 -7
- data/test/unit/mock/cmd/auditctl-s +0 -8
- data/test/unit/mock/cmd/auditpol +0 -2
- data/test/unit/mock/cmd/brew-info-jq +0 -1
- data/test/unit/mock/cmd/chage-l-root +0 -7
- data/test/unit/mock/cmd/dpkg-s-curl +0 -21
- data/test/unit/mock/cmd/dscl +0 -5
- data/test/unit/mock/cmd/env +0 -1
- data/test/unit/mock/cmd/etc-apt +0 -7
- data/test/unit/mock/cmd/find-apache2-conf-enabled +0 -1
- data/test/unit/mock/cmd/find-apache2-ports-conf +0 -1
- data/test/unit/mock/cmd/find-etc-rc-d-name-S +0 -12
- data/test/unit/mock/cmd/find-net-interface +0 -9
- data/test/unit/mock/cmd/find-xinetd.d +0 -2
- data/test/unit/mock/cmd/gem-list-local-a-q-rubocop +0 -1
- data/test/unit/mock/cmd/get-net-tcpconnection +0 -24
- data/test/unit/mock/cmd/get-netadapter-binding-bridge +0 -4
- data/test/unit/mock/cmd/get-package-firefox +0 -30
- data/test/unit/mock/cmd/get-package-ruby +0 -18
- data/test/unit/mock/cmd/get-service-dhcp +0 -10
- data/test/unit/mock/cmd/get-windows-feature +0 -7
- data/test/unit/mock/cmd/get-wmiobject +0 -9
- data/test/unit/mock/cmd/getent-hosts-example.com +0 -1
- data/test/unit/mock/cmd/getent-passwd-jfolmer +0 -1
- data/test/unit/mock/cmd/getent-passwd-root +0 -1
- data/test/unit/mock/cmd/hpux-netstat-inet +0 -10
- data/test/unit/mock/cmd/hpux-netstat-inet6 +0 -11
- data/test/unit/mock/cmd/id-chartmann +0 -1
- data/test/unit/mock/cmd/id-jfolmer +0 -1
- data/test/unit/mock/cmd/id-root +0 -1
- data/test/unit/mock/cmd/initctl--version +0 -5
- data/test/unit/mock/cmd/initctl-show-config-ssh +0 -3
- data/test/unit/mock/cmd/initctl-status-ssh +0 -1
- data/test/unit/mock/cmd/iptables-s +0 -6
- data/test/unit/mock/cmd/launchctl-list +0 -3
- data/test/unit/mock/cmd/logins-x +0 -4
- data/test/unit/mock/cmd/ls-1-etc-init.d +0 -2
- data/test/unit/mock/cmd/ls-sys-class-net-br +0 -2
- data/test/unit/mock/cmd/lsmod +0 -2
- data/test/unit/mock/cmd/lsof-nP-i-FpctPn +0 -63
- data/test/unit/mock/cmd/mount +0 -1
- data/test/unit/mock/cmd/mount-multiple +0 -2
- data/test/unit/mock/cmd/netstat-an.utf8 +0 -13
- data/test/unit/mock/cmd/netstat-tulpen +0 -6
- data/test/unit/mock/cmd/npm-ls-g--json-bower +0 -9
- data/test/unit/mock/cmd/pacman-qi-curl +0 -21
- data/test/unit/mock/cmd/ping-example.com +0 -6
- data/test/unit/mock/cmd/pip-show-jinja2 +0 -11
- data/test/unit/mock/cmd/pkg-info-system-file-system-zfs +0 -8
- data/test/unit/mock/cmd/pkginfo-l-SUNWzfsr +0 -7
- data/test/unit/mock/cmd/ps-aux +0 -5
- data/test/unit/mock/cmd/ps-auxZ +0 -3
- data/test/unit/mock/cmd/pw-usershow-root-7 +0 -1
- data/test/unit/mock/cmd/reg_schedule +0 -6
- data/test/unit/mock/cmd/rpm-qia-curl +0 -24
- data/test/unit/mock/cmd/s11-netstat-an-finet-finet6 +0 -32
- data/test/unit/mock/cmd/sbin_sysctl +0 -1
- data/test/unit/mock/cmd/secedit-export +0 -7
- data/test/unit/mock/cmd/service-e +0 -2
- data/test/unit/mock/cmd/service-sendmail-onestatus +0 -3
- data/test/unit/mock/cmd/service-sshd-status +0 -1
- data/test/unit/mock/cmd/sockstat +0 -5
- data/test/unit/mock/cmd/success +0 -0
- data/test/unit/mock/cmd/swlist-l-product +0 -1
- data/test/unit/mock/cmd/systemctl-show-all-dbus +0 -6
- data/test/unit/mock/cmd/systemctl-show-all-sshd +0 -7
- data/test/unit/mock/cmd/win32_product +0 -8
- data/test/unit/mock/cmd/yum-repolist-all +0 -52
- data/test/unit/mock/files/apache2.conf +0 -14
- data/test/unit/mock/files/auditd.conf +0 -4
- data/test/unit/mock/files/bond0 +0 -37
- data/test/unit/mock/files/etcgroup +0 -3
- data/test/unit/mock/files/example.csv +0 -6
- data/test/unit/mock/files/grub.conf +0 -21
- data/test/unit/mock/files/inetd.conf +0 -2
- data/test/unit/mock/files/kitchen.yml +0 -7
- data/test/unit/mock/files/limits.conf +0 -5
- data/test/unit/mock/files/login.defs +0 -5
- data/test/unit/mock/files/mysql.conf +0 -8
- data/test/unit/mock/files/mysql2.conf +0 -2
- data/test/unit/mock/files/ntp.conf +0 -5
- data/test/unit/mock/files/passwd +0 -2
- data/test/unit/mock/files/policyfile.lock.json +0 -12
- data/test/unit/mock/files/ports.conf +0 -6
- data/test/unit/mock/files/rootwrap.conf +0 -7
- data/test/unit/mock/files/serve-cgi-bin.conf +0 -20
- data/test/unit/mock/files/shadow +0 -2
- data/test/unit/mock/files/ssh_config +0 -5
- data/test/unit/mock/files/sshd_config +0 -7
- data/test/unit/mock/files/sysctl.conf +0 -7
- data/test/unit/mock/files/xinetd.conf +0 -9
- data/test/unit/mock/files/xinetd.d/.gitkeep +0 -0
- data/test/unit/mock/files/xinetd.d_chargen-dgram +0 -9
- data/test/unit/mock/files/xinetd.d_chargen-stream +0 -9
- data/test/unit/mock/profiles/complete-metadata/inspec.yml +0 -7
- data/test/unit/mock/profiles/complete-profile/controls/filesystem_spec.rb +0 -16
- data/test/unit/mock/profiles/complete-profile/inspec.yml +0 -10
- data/test/unit/mock/profiles/complete-profile/libraries/testlib.rb +0 -1
- data/test/unit/mock/profiles/empty-metadata/inspec.yml +0 -0
- data/test/unit/mock/profiles/legacy-complete-metadata/metadata.rb +0 -7
- data/test/unit/mock/profiles/legacy-complete-metadata/test/.gitkeep +0 -0
- data/test/unit/mock/profiles/legacy-empty-metadata/controls/.gitkeep +0 -0
- data/test/unit/mock/profiles/legacy-empty-metadata/metadata.rb +0 -0
- data/test/unit/mock/profiles/legacy-simple-metadata/metadata.rb +0 -1
- data/test/unit/mock/profiles/legacy-simple-metadata/test/.gitkeep +0 -0
- data/test/unit/mock/profiles/library/controls/filesystem_spec.rb +0 -7
- data/test/unit/mock/profiles/library/inspec.yml +0 -10
- data/test/unit/mock/profiles/library/libraries/gordonlib.rb +0 -2
- data/test/unit/mock/profiles/library/libraries/testlib.rb +0 -12
- data/test/unit/mock/profiles/resource-tiny/inspec.yml +0 -10
- data/test/unit/mock/profiles/resource-tiny/libraries/resource.rb +0 -3
- data/test/unit/mock/profiles/simple-metadata/inspec.yml +0 -1
- data/test/unit/mock/profiles/skippy-profile-os/controls/one.rb +0 -3
- data/test/unit/mock/profiles/skippy-profile-os/inspec.yml +0 -5
- data/test/unit/mock/profiles/spec_only/specfile.rb +0 -11
- data/test/unit/mock/profiles/supported_inspec/inspec.yml +0 -2
- data/test/unit/mock/profiles/unsupported_inspec/inspec.yml +0 -2
- data/test/unit/objects_test.rb +0 -65
- data/test/unit/plugin_test.rb +0 -44
- data/test/unit/plugins/resource_test.rb +0 -60
- data/test/unit/profile_context_test.rb +0 -345
- data/test/unit/profile_test.rb +0 -252
- data/test/unit/resources/apache_conf_test.rb +0 -31
- data/test/unit/resources/apt_test.rb +0 -46
- data/test/unit/resources/audit_policy_test.rb +0 -13
- data/test/unit/resources/auditd_conf_test.rb +0 -15
- data/test/unit/resources/auditd_rules_test.rb +0 -91
- data/test/unit/resources/bash_test.rb +0 -29
- data/test/unit/resources/bond_test.rb +0 -24
- data/test/unit/resources/bridge_test.rb +0 -56
- data/test/unit/resources/csv_test.rb +0 -35
- data/test/unit/resources/etc_group_test.rb +0 -37
- data/test/unit/resources/file_test.rb +0 -202
- data/test/unit/resources/gem_test.rb +0 -20
- data/test/unit/resources/group_test.rb +0 -96
- data/test/unit/resources/grub_conf_test.rb +0 -29
- data/test/unit/resources/host_test.rb +0 -38
- data/test/unit/resources/inetd_conf_test.rb +0 -15
- data/test/unit/resources/ini_test.rb +0 -16
- data/test/unit/resources/interface_test.rb +0 -54
- data/test/unit/resources/iptables_test.rb +0 -35
- data/test/unit/resources/json_test.rb +0 -36
- data/test/unit/resources/kernel_module_test.rb +0 -23
- data/test/unit/resources/kernel_parameter_test.rb +0 -13
- data/test/unit/resources/limits_conf_test.rb +0 -14
- data/test/unit/resources/login_def_test.rb +0 -16
- data/test/unit/resources/mount_test.rb +0 -26
- data/test/unit/resources/mysql_conf_test.rb +0 -14
- data/test/unit/resources/npm_test.rb +0 -20
- data/test/unit/resources/ntp_conf_test.rb +0 -16
- data/test/unit/resources/oneget_test.rb +0 -45
- data/test/unit/resources/os_env_test.rb +0 -18
- data/test/unit/resources/os_test.rb +0 -40
- data/test/unit/resources/package_test.rb +0 -87
- data/test/unit/resources/parse_config_test.rb +0 -26
- data/test/unit/resources/passwd_test.rb +0 -111
- data/test/unit/resources/pip_test.rb +0 -15
- data/test/unit/resources/port_test.rb +0 -165
- data/test/unit/resources/powershell_test.rb +0 -32
- data/test/unit/resources/processes_test.rb +0 -72
- data/test/unit/resources/registry_key_test.rb +0 -18
- data/test/unit/resources/security_policy_test.rb +0 -16
- data/test/unit/resources/service_test.rb +0 -305
- data/test/unit/resources/shadow_test.rb +0 -67
- data/test/unit/resources/ssh_conf_test.rb +0 -33
- data/test/unit/resources/user_test.rb +0 -124
- data/test/unit/resources/vbscript_test.rb +0 -18
- data/test/unit/resources/windows_feature.rb +0 -17
- data/test/unit/resources/wmi_test.rb +0 -42
- data/test/unit/resources/xinetd_test.rb +0 -60
- data/test/unit/resources/yaml_test.rb +0 -34
- data/test/unit/resources/yum_test.rb +0 -68
- data/test/unit/shell_detector_test.rb +0 -78
- data/test/unit/source_reader_test.rb +0 -17
- data/test/unit/source_readers/flat_test.rb +0 -61
- data/test/unit/source_readers/inspec_test.rb +0 -38
- data/test/unit/utils/filter_array_test.rb +0 -59
- data/test/unit/utils/filter_table_test.rb +0 -177
- data/test/unit/utils/find_files_test.rb +0 -23
- data/test/unit/utils/passwd_parser_test.rb +0 -32
- data/test/unit/utils/simpleconfig_test.rb +0 -80
- data/test/unit/utils/solaris_netstat_parser.rb +0 -124
data/test/resource/file_test.rb
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
# author: Dominik Richter
|
|
3
|
-
# author: Christoph Hartmann
|
|
4
|
-
|
|
5
|
-
#
|
|
6
|
-
# On most systems I've used a link to /proc/kcore is placed at
|
|
7
|
-
# /dev/core. However, on TravisCI we also see it at /dev/kcore.
|
|
8
|
-
#
|
|
9
|
-
# Since we are using this file to test some properties of symlinks, we
|
|
10
|
-
# don't particularly care where it is, so here we use /dev/kcore if it
|
|
11
|
-
# exists and otherwise fall back to /dev/core.
|
|
12
|
-
#
|
|
13
|
-
kcore_dev = if file('/dev/kcore').exist?
|
|
14
|
-
'/dev/kcore'
|
|
15
|
-
else
|
|
16
|
-
'/dev/core'
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
describe file('/tmp') do
|
|
20
|
-
it { should exist }
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
describe file('/tmpest') do
|
|
24
|
-
it { should_not exist }
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
describe file('/tmp') do
|
|
28
|
-
its('type') { should eq :directory }
|
|
29
|
-
it { should be_directory }
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
describe file('/proc/version') do
|
|
33
|
-
its('type') { should eq :file }
|
|
34
|
-
it { should be_file }
|
|
35
|
-
it { should_not be_directory }
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
describe file('/dev/stdout') do
|
|
39
|
-
its('type') { should eq :pipe }
|
|
40
|
-
its('source.type') { should eq :symlink }
|
|
41
|
-
it { should be_symlink }
|
|
42
|
-
it { should be_pipe }
|
|
43
|
-
it { should_not be_file }
|
|
44
|
-
it { should_not be_directory }
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
describe file('/dev/zero') do
|
|
48
|
-
its('type') { should eq :character_device }
|
|
49
|
-
it { should be_character_device }
|
|
50
|
-
it { should_not be_file }
|
|
51
|
-
it { should_not be_directory }
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
# describe file('...') do
|
|
55
|
-
# its('type') { should eq :block_device }
|
|
56
|
-
# it { should be_block_device }
|
|
57
|
-
# end
|
|
58
|
-
|
|
59
|
-
# describe file('...') do
|
|
60
|
-
# its('type') { should eq :socket }
|
|
61
|
-
# it { should be_socket }
|
|
62
|
-
# end
|
|
63
|
-
|
|
64
|
-
# describe file('...') do
|
|
65
|
-
# its('type') { should eq :pipe }
|
|
66
|
-
# it { should be_pipe }
|
|
67
|
-
# end
|
|
68
|
-
|
|
69
|
-
describe file('/dev') do
|
|
70
|
-
its('mode') { should eq 00755 }
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
describe file('/dev') do
|
|
74
|
-
it { should be_mode 00755 }
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
describe file('/root') do
|
|
78
|
-
its('owner') { should eq 'root' }
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
describe file('/dev') do
|
|
82
|
-
it { should be_owned_by 'root' }
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
describe file('/root') do
|
|
86
|
-
its('group') { should eq 'root' }
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
describe file('/dev') do
|
|
90
|
-
it { should be_grouped_into 'root' }
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
describe file(kcore_dev) do
|
|
94
|
-
its('link_path') { should eq '/proc/kcore' }
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
describe file(kcore_dev) do
|
|
98
|
-
it { should be_linked_to '/proc/kcore' }
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
describe file('/proc/cpuinfo') do
|
|
102
|
-
its('content') { should match /^processor/ }
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
describe file('/').mtime.to_i do
|
|
106
|
-
it { should <= Time.now.to_i }
|
|
107
|
-
it { should >= Time.now.to_i - 1000}
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
describe file('/') do
|
|
111
|
-
its('size') { should be > 64 }
|
|
112
|
-
its('size') { should be < 10240 }
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
describe file('/proc/cpuinfo') do
|
|
116
|
-
its('size') { should be 0 }
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
# @TODO selinux_label
|
|
120
|
-
|
|
121
|
-
# @TODO skip as the mount command is not reliably present on all test containers
|
|
122
|
-
# describe file('/proc') do
|
|
123
|
-
# it { should be_mounted }
|
|
124
|
-
# end
|
|
125
|
-
|
|
126
|
-
describe file('/proc/cpuinfo') do
|
|
127
|
-
it { should_not be_mounted }
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
# @TODO immutable?
|
|
131
|
-
# @TODO product_version
|
|
132
|
-
# @TODO file_version
|
|
133
|
-
# @TODO version?
|
|
134
|
-
|
|
135
|
-
require 'digest'
|
|
136
|
-
cpuinfo = file('/proc/cpuinfo').content
|
|
137
|
-
|
|
138
|
-
md5sum = Digest::MD5.hexdigest(cpuinfo)
|
|
139
|
-
describe file('/proc/cpuinfo') do
|
|
140
|
-
its('md5sum') { should eq md5sum }
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
sha256sum = Digest::SHA256.hexdigest(cpuinfo)
|
|
144
|
-
describe file('/proc/cpuinfo') do
|
|
145
|
-
its('sha256sum') { should eq sha256sum }
|
|
146
|
-
end
|
data/test/resource/ssh_config.rb
DELETED
data/test/test-extra.yaml
DELETED
data/test/test.yaml
DELETED
data/test/unit/control_test.rb
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
# author: Christoph Hartmann
|
|
3
|
-
# author: Dominik Richter
|
|
4
|
-
|
|
5
|
-
require 'helper'
|
|
6
|
-
|
|
7
|
-
describe 'controls' do
|
|
8
|
-
def load(content)
|
|
9
|
-
data = {
|
|
10
|
-
'inspec.yml' => "name: mock",
|
|
11
|
-
'controls/mock.rb' => "control '1' do\n#{content}\nend\n",
|
|
12
|
-
}
|
|
13
|
-
opts = { test_collector: Inspec::RunnerMock.new }
|
|
14
|
-
Inspec::Profile.for_target(data, opts)
|
|
15
|
-
.params[:controls]['1']
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it 'works with empty refs' do
|
|
19
|
-
load('ref')[:refs].must_be :empty?
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it 'defines a simple ref' do
|
|
23
|
-
s = rand.to_s
|
|
24
|
-
load("ref #{s.inspect}")[:refs].must_equal [{:ref=>s}]
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
it 'defines a ref with url' do
|
|
28
|
-
s = rand.to_s
|
|
29
|
-
u = rand.to_s
|
|
30
|
-
load("ref #{s.inspect}, url: #{u.inspect}")[:refs].must_equal [{ref: s, url: u}]
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
it 'defines a ref without content but with url' do
|
|
34
|
-
u = rand.to_s
|
|
35
|
-
load("ref url: #{u.inspect}")[:refs].must_equal [{url: u}]
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
it 'works with empty tags' do
|
|
39
|
-
load('tag')[:tags].must_be :empty?
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
it 'defines a simple tag' do
|
|
43
|
-
s = rand.to_s
|
|
44
|
-
load("tag #{s.inspect}")[:tags].must_equal({ s => nil })
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
it 'define multiple tags' do
|
|
48
|
-
a, b, c = rand.to_s, rand.to_s, rand.to_s
|
|
49
|
-
load("tag #{a.inspect}, #{b.inspect}, #{c.inspect}")[:tags].must_equal(
|
|
50
|
-
{ a => nil, b => nil, c => nil })
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it 'tag by key=value' do
|
|
54
|
-
a, b = rand.to_s, rand.to_s
|
|
55
|
-
load("tag #{a.inspect} => #{b.inspect}")[:tags].must_equal(
|
|
56
|
-
{ a => b })
|
|
57
|
-
end
|
|
58
|
-
end
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
# author: Dominik Richter
|
|
3
|
-
# author: Christoph Hartmann
|
|
4
|
-
|
|
5
|
-
require 'helper'
|
|
6
|
-
|
|
7
|
-
describe Fetchers::Local do
|
|
8
|
-
let(:fetcher) { Fetchers::Local }
|
|
9
|
-
|
|
10
|
-
it 'registers with the fetchers registry' do
|
|
11
|
-
reg = Inspec::Fetcher.registry
|
|
12
|
-
_(reg['local']).must_equal fetcher
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
describe 'applied to this file' do
|
|
16
|
-
let(:res) { fetcher.resolve(__FILE__) }
|
|
17
|
-
|
|
18
|
-
it 'must be resolved' do
|
|
19
|
-
_(res).must_be_kind_of fetcher
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it 'must only contain this file' do
|
|
23
|
-
_(res.files).must_equal [__FILE__]
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it 'must not read if the file doesnt exist' do
|
|
27
|
-
_(res.read('file-does-not-exist')).must_be_nil
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it 'must not read files not covered' do
|
|
31
|
-
not_covered = File.expand_path('../tar_test.rb', __FILE__)
|
|
32
|
-
_(File.file?(not_covered)).must_equal true
|
|
33
|
-
_(res.read(not_covered)).must_be_nil
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
it 'must read the contents of the file' do
|
|
37
|
-
_(res.read(__FILE__)).must_equal File.read(__FILE__)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
describe 'applied to this folder' do
|
|
42
|
-
let(:path) { File.dirname(__FILE__) }
|
|
43
|
-
let(:res) { fetcher.resolve(path) }
|
|
44
|
-
|
|
45
|
-
it 'must be resolved' do
|
|
46
|
-
_(res).must_be_kind_of fetcher
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
it 'must contain all files' do
|
|
50
|
-
_(res.files).must_include __FILE__
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it 'must not read if the file doesnt exist' do
|
|
54
|
-
_(res.read('file-not-in-folder')).must_be_nil
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
it 'must not read files not covered' do
|
|
58
|
-
not_covered = File.expand_path('../../../helper.rb', __FILE__)
|
|
59
|
-
_(File.file?(not_covered)).must_equal true
|
|
60
|
-
_(res.read(not_covered)).must_be_nil
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
it 'must read the contents of the file' do
|
|
64
|
-
_(res.read(__FILE__)).must_equal File.read(__FILE__)
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
end
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
# author: Dominik Richter
|
|
3
|
-
# author: Christoph Hartmann
|
|
4
|
-
|
|
5
|
-
require 'helper'
|
|
6
|
-
|
|
7
|
-
describe Fetchers::Mock do
|
|
8
|
-
let(:fetcher) { Fetchers::Mock }
|
|
9
|
-
|
|
10
|
-
it 'registers with the fetchers registry' do
|
|
11
|
-
reg = Inspec::Fetcher.registry
|
|
12
|
-
_(reg['mock']).must_equal fetcher
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
it 'wont load nil' do
|
|
16
|
-
fetcher.resolve(nil).must_be :nil?
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
it 'wont load a string' do
|
|
20
|
-
fetcher.resolve(rand.to_s).must_be :nil?
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
describe 'applied to a map' do
|
|
24
|
-
it 'must be resolved' do
|
|
25
|
-
fetcher.resolve({}).must_be_kind_of fetcher
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it 'has no files on empty' do
|
|
29
|
-
fetcher.resolve({}).files.must_equal []
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it 'has files' do
|
|
33
|
-
f = rand.to_s
|
|
34
|
-
fetcher.resolve({f => nil}).files.must_equal [f]
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
it 'can read a file' do
|
|
38
|
-
f = rand.to_s
|
|
39
|
-
s = rand.to_s
|
|
40
|
-
fetcher.resolve({f => s}).read(f).must_equal s
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
# author: Dominik Richter
|
|
3
|
-
# author: Christoph Hartmann
|
|
4
|
-
|
|
5
|
-
require 'helper'
|
|
6
|
-
|
|
7
|
-
describe Fetchers::Tar do
|
|
8
|
-
let(:fetcher) { Fetchers::Tar }
|
|
9
|
-
|
|
10
|
-
it 'registers with the fetchers registry' do
|
|
11
|
-
reg = Inspec::Fetcher.registry
|
|
12
|
-
_(reg['tar']).must_equal fetcher
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
describe 'applied to a tar archive' do
|
|
16
|
-
let(:target) { MockLoader.profile_tgz('complete-profile') }
|
|
17
|
-
let(:res) { fetcher.resolve(target) }
|
|
18
|
-
|
|
19
|
-
it 'must be resolved' do
|
|
20
|
-
_(res).must_be_kind_of fetcher
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
it 'must contain all files' do
|
|
24
|
-
_(res.files.sort).must_equal %w{inspec.yml libraries libraries/testlib.rb
|
|
25
|
-
controls controls/filesystem_spec.rb}.sort
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it 'must not read if the file isnt included' do
|
|
29
|
-
_(res.read('file-not-in-archive')).must_be_nil
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it 'must read the contents of the file' do
|
|
33
|
-
_(res.read('inspec.yml')).must_match /^name: complete$/
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
# author: Dominik Richter
|
|
3
|
-
# author: Christoph Hartmann
|
|
4
|
-
|
|
5
|
-
require 'helper'
|
|
6
|
-
|
|
7
|
-
describe Fetchers::Url do
|
|
8
|
-
let(:fetcher) { Fetchers::Url }
|
|
9
|
-
|
|
10
|
-
it 'registers with the fetchers registry' do
|
|
11
|
-
reg = Inspec::Fetcher.registry
|
|
12
|
-
_(reg['url']).must_equal fetcher
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
describe 'testing different urls' do
|
|
16
|
-
let(:mock_file) { MockLoader.profile_path('complete-metadata') }
|
|
17
|
-
let(:fetcher) {
|
|
18
|
-
Class.new(Fetchers::Url) do
|
|
19
|
-
attr_reader :target, :archive
|
|
20
|
-
def initialize(target, opts)
|
|
21
|
-
@target = target
|
|
22
|
-
@archive = File.new(__FILE__)
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
it 'handles a http url' do
|
|
28
|
-
url = 'http://chef.io/some.tar.gz'
|
|
29
|
-
res = fetcher.resolve(url)
|
|
30
|
-
_(res).must_be_kind_of Fetchers::Local
|
|
31
|
-
_(res.parent).must_be_kind_of Fetchers::Url
|
|
32
|
-
_(res.parent.target).must_equal 'http://chef.io/some.tar.gz'
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
it 'handles a https url' do
|
|
36
|
-
url = 'https://chef.io/some.tar.gz'
|
|
37
|
-
res = fetcher.resolve(url)
|
|
38
|
-
_(res).must_be_kind_of Fetchers::Local
|
|
39
|
-
_(res.parent).must_be_kind_of Fetchers::Url
|
|
40
|
-
_(res.parent.target).must_equal 'https://chef.io/some.tar.gz'
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
it 'doesnt handle other schemas' do
|
|
44
|
-
fetcher.resolve('gopher://chef.io/some.tar.gz').must_be_nil
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
it 'only handles URLs' do
|
|
48
|
-
fetcher.resolve(__FILE__).must_be_nil
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
%w{https://github.com/chef/inspec
|
|
52
|
-
https://github.com/chef/inspec.git
|
|
53
|
-
https://www.github.com/chef/inspec.git
|
|
54
|
-
http://github.com/chef/inspec
|
|
55
|
-
http://github.com/chef/inspec.git
|
|
56
|
-
http://www.github.com/chef/inspec.git}.each do |github|
|
|
57
|
-
it "resolves a github url #{github}" do
|
|
58
|
-
res = fetcher.resolve(github)
|
|
59
|
-
_(res).wont_be_nil
|
|
60
|
-
_(res.parent.target).must_equal 'https://github.com/chef/inspec/archive/master.tar.gz'
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
it "resolves a github branch url" do
|
|
65
|
-
github = 'https://github.com/hardening-io/tests-os-hardening/tree/2.0'
|
|
66
|
-
res = fetcher.resolve(github)
|
|
67
|
-
_(res).wont_be_nil
|
|
68
|
-
_(res.parent.target).must_equal 'https://github.com/hardening-io/tests-os-hardening/archive/2.0.tar.gz'
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
it "resolves a github commit url" do
|
|
72
|
-
github = 'https://github.com/hardening-io/tests-os-hardening/tree/48bd4388ddffde68badd83aefa654e7af3231876'
|
|
73
|
-
res = fetcher.resolve(github)
|
|
74
|
-
_(res).wont_be_nil
|
|
75
|
-
_(res.parent.target).must_equal 'https://github.com/hardening-io/tests-os-hardening/archive/48bd4388ddffde68badd83aefa654e7af3231876.tar.gz'
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
describe 'applied to a valid url (mocked tar.gz)' do
|
|
80
|
-
let(:mock_file) { MockLoader.profile_tgz('complete-profile') }
|
|
81
|
-
let(:target) { 'http://myurl/file.tar.gz' }
|
|
82
|
-
let(:res) {
|
|
83
|
-
mock_open = Minitest::Mock.new
|
|
84
|
-
mock_open.expect :meta, {'content-type' => 'application/gzip'}
|
|
85
|
-
mock_open.expect :read, File.open(mock_file, 'rb').read
|
|
86
|
-
fetcher.expects(:open).returns(mock_open)
|
|
87
|
-
fetcher.resolve(target)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
it 'must be resolved to the final format' do
|
|
91
|
-
_(res).must_be_kind_of Fetchers::Tar
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
it 'must be resolved to the final format' do
|
|
95
|
-
_(res.parent).must_be_kind_of fetcher
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
it 'must contain all files' do
|
|
99
|
-
_(res.files.sort).must_equal %w{inspec.yml libraries libraries/testlib.rb
|
|
100
|
-
controls controls/filesystem_spec.rb}.sort
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
it 'must not read if the file isnt included' do
|
|
104
|
-
_(res.read('file-not-in-archive')).must_be_nil
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
it 'must read the contents of the file' do
|
|
108
|
-
_(res.read('inspec.yml')).must_match /^name: complete$/
|
|
109
|
-
end
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
describe 'applied to a valid url (mocked zip)' do
|
|
113
|
-
let(:mock_file) { MockLoader.profile_zip('complete-profile') }
|
|
114
|
-
let(:target) { 'http://myurl/file.tar.gz' }
|
|
115
|
-
let(:res) {
|
|
116
|
-
mock_open = Minitest::Mock.new
|
|
117
|
-
mock_open.expect :meta, {'content-type' => 'application/zip'}
|
|
118
|
-
mock_open.expect :read, File.open(mock_file, 'rb').read
|
|
119
|
-
fetcher.expects(:open).returns(mock_open)
|
|
120
|
-
fetcher.resolve(target)
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
it 'must be resolved to the final format' do
|
|
124
|
-
_(res).must_be_kind_of Fetchers::Zip
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
it 'must contain all files' do
|
|
128
|
-
_(res.files.sort).must_equal %w{inspec.yml libraries libraries/testlib.rb
|
|
129
|
-
controls controls/filesystem_spec.rb}.sort
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
it 'must not read if the file isnt included' do
|
|
133
|
-
_(res.read('file-not-in-archive')).must_be_nil
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
it 'must read the contents of the file' do
|
|
137
|
-
_(res.read('inspec.yml')).must_match /^name: complete$/
|
|
138
|
-
end
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
describe 'applied to a valid url with wrong content-type' do
|
|
142
|
-
let(:mock_file) { MockLoader.profile_zip('complete-profile') }
|
|
143
|
-
let(:target) { 'http://myurl/file.tar.gz' }
|
|
144
|
-
|
|
145
|
-
it 'must be resolved to the final format' do
|
|
146
|
-
mock_open = Minitest::Mock.new
|
|
147
|
-
mock_open.expect :meta, {'content-type' => 'wrong'}
|
|
148
|
-
fetcher.expects(:open).returns(mock_open)
|
|
149
|
-
proc { fetcher.resolve(target) }.must_throw RuntimeError
|
|
150
|
-
end
|
|
151
|
-
end
|
|
152
|
-
end
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
# author: Dominik Richter
|
|
3
|
-
# author: Christoph Hartmann
|
|
4
|
-
|
|
5
|
-
require 'helper'
|
|
6
|
-
|
|
7
|
-
describe Fetchers::Zip do
|
|
8
|
-
let(:fetcher) { Fetchers::Zip }
|
|
9
|
-
|
|
10
|
-
it 'registers with the fetchers registry' do
|
|
11
|
-
reg = Inspec::Fetcher.registry
|
|
12
|
-
_(reg['zip']).must_equal fetcher
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
describe 'applied to a zipped archive' do
|
|
16
|
-
let(:target) { MockLoader.profile_zip('complete-profile') }
|
|
17
|
-
let(:res) { fetcher.resolve(target) }
|
|
18
|
-
|
|
19
|
-
it 'must be resolved' do
|
|
20
|
-
_(res).must_be_kind_of fetcher
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
it 'must contain all files' do
|
|
24
|
-
_(res.files.sort).must_equal %w{inspec.yml libraries libraries/testlib.rb
|
|
25
|
-
controls controls/filesystem_spec.rb}.sort
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it 'must not read if the file isnt included' do
|
|
29
|
-
_(res.read('file-not-in-archive')).must_be_nil
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it 'must read the contents of the file' do
|
|
33
|
-
_(res.read('inspec.yml')).must_match /^name: complete$/
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
data/test/unit/fetchers_test.rb
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
# author: Dominik Richter
|
|
3
|
-
# author: Christoph Hartmann
|
|
4
|
-
|
|
5
|
-
require 'helper'
|
|
6
|
-
|
|
7
|
-
describe Inspec::Fetcher do
|
|
8
|
-
it 'loads the local fetcher for this file' do
|
|
9
|
-
res = Inspec::Fetcher.resolve(__FILE__)
|
|
10
|
-
res.must_be_kind_of Fetchers::Local
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
describe Inspec::Plugins::RelFetcher do
|
|
15
|
-
def fetcher
|
|
16
|
-
src_fetcher.expects(:files).returns(in_files).at_least_once
|
|
17
|
-
Inspec::Plugins::RelFetcher.new(src_fetcher)
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
let(:src_fetcher) { mock() }
|
|
21
|
-
|
|
22
|
-
IN_AND_OUT = {
|
|
23
|
-
[] => [],
|
|
24
|
-
%w{file} => %w{file},
|
|
25
|
-
# don't prefix just by filename
|
|
26
|
-
%w{file file_a} => %w{file file_a},
|
|
27
|
-
%w{path/file path/file_a} => %w{file file_a},
|
|
28
|
-
%w{path/to/file} => %w{file},
|
|
29
|
-
%w{/path/to/file} => %w{file},
|
|
30
|
-
%w{alice bob} => %w{alice bob},
|
|
31
|
-
# mixed paths
|
|
32
|
-
%w{x/a y/b} => %w{x/a y/b},
|
|
33
|
-
%w{/x/a /y/b} => %w{x/a y/b},
|
|
34
|
-
%w{z/x/a z/y/b} => %w{x/a y/b},
|
|
35
|
-
%w{/z/x/a /z/y/b} => %w{x/a y/b},
|
|
36
|
-
# mixed with relative path
|
|
37
|
-
%w{a path/to/b} => %w{a path/to/b},
|
|
38
|
-
%w{path/to/b a} => %w{path/to/b a},
|
|
39
|
-
%w{path/to/b path/a} => %w{to/b a},
|
|
40
|
-
%w{path/to/b path/a c} => %w{path/to/b path/a c},
|
|
41
|
-
# mixed with absolute paths
|
|
42
|
-
%w{/path/to/b /a} => %w{path/to/b a},
|
|
43
|
-
%w{/path/to/b /path/a} => %w{to/b a},
|
|
44
|
-
%w{/path/to/b /path/a /c} => %w{path/to/b path/a c},
|
|
45
|
-
# mixing absolute and relative paths
|
|
46
|
-
%w{path/a /path/b} => %w{path/a /path/b},
|
|
47
|
-
%w{/path/a path/b} => %w{/path/a path/b},
|
|
48
|
-
# extract folder structure buildup
|
|
49
|
-
%w{/a /a/b /a/b/c} => %w{c},
|
|
50
|
-
%w{/a /a/b /a/b/c/d/e} => %w{e},
|
|
51
|
-
# ignore pax_global_header, which are commonly seen in github tars and are not
|
|
52
|
-
# ignored by all tar streaming tools, its not extracted by GNU tar since 1.14
|
|
53
|
-
%w{/pax_global_header /a/b} => %w{b},
|
|
54
|
-
%w{pax_global_header a/b} => %w{b},
|
|
55
|
-
}.each do |ins, outs|
|
|
56
|
-
describe 'empty profile' do
|
|
57
|
-
let(:in_files) { ins }
|
|
58
|
-
|
|
59
|
-
it 'also has no files' do
|
|
60
|
-
fetcher.files.must_equal outs
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
end
|