Stephan Renatus
5c0cdb31c9
*_service: add unit tests
...
NB I've just added default duplicates to one instance (i.e., there's
only one `systemd_service`), since there's no os-specific magic in them.
Also these tests only verify that the default choice is equivalent to
`service` on the tested distribution.
2016-01-20 15:54:36 +01:00
Stephan Renatus
0e410df69d
add *_service overrides, allowing for different control binaries
2016-01-20 15:33:18 +01:00
Dominik Richter
611487e956
clearly identify legacy profile tests and fix identification
2016-01-19 15:48:06 +01:00
Dominik Richter
8c464965c1
extract example group creation
...
and restore profile tests that had been completely mocked until now
2016-01-19 15:48:06 +01:00
Dominik Richter
dd2d93fd6f
completely separate rspec runner parts
2016-01-19 15:48:06 +01:00
Dominik Richter
4064e63df5
add tests for loading metadata yaml internals
2016-01-15 20:51:34 +01:00
Dominik Richter
acbc345321
make metadata.rb legacy mode consistent for supports
...
Before introducing InSpec profiles in https://github.com/chef/inspec/pull/252 we had `metadata.rb` keep all information. This included an undisclosed field called `supports`. However, this field was never actually used in practice. So for legacy profiles, this means that `supports` was ignored. In order to keep old profiles running in exactly the way they were before, ignore this field when reading from metadata.rb
2016-01-15 18:58:18 +01:00
Jeremy W. Chalfant
a2ea1da6e3
move all lsof to formmated output (-F)
2016-01-14 23:03:24 -05:00
Jeremy W. Chalfant
b363e1d147
formatted lsof mockup
2016-01-14 23:03:24 -05:00
Mark Harrison
f5780b69a4
Correctly detect UDP ports on linux
...
netstat on UDP lines doesn't display a port state (e.g. LISTEN), so make this
field optional when parsing the netstat line.
2016-01-14 22:53:38 -05:00
Stephan Renatus
5c17f8b643
regexp github url targets, add tests for Inspec::Targests::UrlHelper
...
replacing occuring http:// with https:// is probably ok, github
redirects to https anyways
2016-01-14 12:05:58 -05:00
Jacob McCann
f25ab3a373
Fix systemd service enabled check
2016-01-11 15:32:33 -06:00
Christoph Hartmann
a1ddbe4cf2
explicitly ignore supports for inspec check
2016-01-10 23:59:57 -05:00
Stephan Renatus
a26dbe146d
fix reading profiles bug
...
For reading the profiles metadata, we're using the train mock backend
through Inspec::Runner. The new `supports` feature never agrees with the
mock backend.
Now, it we figure out if this is a mock class and then just say that it
supports whatever we're asking for.
Tl;dr: there's probably a more beautiful solution to this.
Added a test case, but it fails -- while the command line interface
works fine.
2016-01-07 15:16:49 -08:00
Christoph Hartmann
a72ba94f10
handle mount results with multiple entries
2016-01-03 00:03:24 +01:00
Christoph Hartmann
a5acb03e49
add mount
resource
2016-01-03 00:03:24 +01:00
Christoph Hartmann
c7b7eccb5d
update unit test for new parser
2016-01-03 00:03:24 +01:00
Christoph Hartmann
167aa6bdfb
add test for unsupported os
2016-01-02 21:27:40 +01:00
Dominik Richter
d6f48d3534
catch empty support clause
2015-12-31 17:57:59 +01:00
Dominik Richter
af8e4e93ca
add supports keyword to profiles
2015-12-31 17:54:13 +01:00
Dominik Richter
526932584d
fix metadata validation
2015-12-28 13:35:38 +01:00
Dominik Richter
7473dea1f2
ignore auto-generated controls during verify check
2015-12-23 11:11:49 +01:00
Dominik Richter
b2e0fac625
change check errors on summary+title to warnings
2015-12-23 09:18:59 +01:00
troyready
29f954f7f3
add release to el pkg version & catch missing linebreaks
...
Package release info (e.g. '19.el7') is often required to determine if
a system has been properly patched.
Lines like the following from rpm are messing up the version returned
by the package resource:
"...\nVersion : 1.8.6p3 Vendor: Red Hat, Inc.\n..."
Correcting this with a new conditional check.
2015-12-11 13:05:22 -08:00
Stephan Renatus
652d51e9dc
[resource/port] add port(addr, port)
variant
2015-12-08 20:33:36 +01:00
Stephan Renatus
8532dd7034
[resource/port] change attribute names to plural, indicating arrays
...
see discussion in #256
2015-12-08 20:33:36 +01:00
Adam Leff
c146a76679
File permission checks should return false unless file exists
...
Currently, #readable?, #writeable?, and #executable? will incorrectly
return true if the file does not exist.
In addition, I took the opportunity to refactor the File resource to
make it easier to write unit tests and supplied a full unit test
suite for this resource.
2015-12-08 19:57:34 +01:00
Stephan Renatus
7a1cd660c3
[resources/processes] add users, states attribute; update docs
...
processes('bash').user does not actually make much sense for a resource
that is a list -- different entries can belong to different users.
Analogous for processes('bash').state.
The attributes 'users' and 'states' expose the unique values
corresponding to that property of entries in the process list.
Fixes #295 .
2015-12-08 13:06:27 +01:00
Stephan Renatus
79f48afa6c
[resources/apache_conf]: add tests, fix bug
...
before, the resource would throw an exception when include_files
returned nil (i.e., [].flatten!)
added basic unit tests capturing the include_files behaviour
2015-12-07 10:50:48 +01:00
Christoph Hartmann
7c393a1891
Merge pull request #291 from chef/sr/fix-find_files
...
revert to old find_files interface
2015-12-04 14:41:36 +01:00
Stephan Renatus
324ba14a6b
fix optional type argument handling
2015-12-04 14:27:32 +01:00
Stephan Renatus
390e0fcca7
restore old find_files interface
...
- fixes #276
- basic test for find_files
2015-12-04 14:15:45 +01:00
Adam Leff
e0c356dae7
Adding support for Wind River Linux
...
WRL is used as the OS on Cisco Nexus devices and acts like a Red
Hat variant. These changes add support for WRL.
2015-12-03 17:41:11 -05:00
Christoph Hartmann
9231833cad
add unit tests for user resource that cover ldap groups
2015-11-24 18:35:10 +01:00
Christoph Hartmann
0531976a40
implement unit tests for ini resource
2015-11-24 16:46:17 +01:00
Seth Chisamore
beade346bf
Add Windows support to the os_env
resource
...
This change allows checks like:
```
describe os_env('PATH') do
its('split') { should include('C:\wix') }
end
```
2015-11-19 15:41:00 +01:00
Dominik Richter
d9ded1d38d
test for multiple computed calls to flat describe
2015-11-19 14:28:37 +01:00
Dominik Richter
3afd0d556d
fix typos
...
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-11-19 14:17:18 +01:00
Christoph Hartmann
27de925c2b
update mock command for registry key
2015-11-17 22:28:11 +01:00
Christoph Hartmann
38e982709e
update unit test
2015-11-17 22:28:11 +01:00
Dominik Richter
17ce88b63d
api: don't force root on os_env
2015-11-13 12:10:22 +01:00
Dominik Richter
8d682973b0
extend csv tests, remove dot-resolver
2015-10-27 15:58:02 +01:00
Dominik Richter
e0874b47b1
extend yaml tests, remove dot-resolver
2015-10-27 15:58:02 +01:00
Dominik Richter
a55e240a0f
extend json tests, remove dot-resolver
2015-10-27 15:58:02 +01:00
Dominik Richter
7779cdb469
add simple tests for profile
2015-10-27 02:29:11 +01:00
Dominik Richter
414bf6b1fa
bugfix: handle empty processes result
2015-10-26 16:49:26 +01:00
Dominik Richter
6dc0a3b638
rename inetd_config -> inetd_conf
...
be consistent with the filename
2015-10-26 16:21:51 +01:00
Dominik Richter
95242bf9c2
add content parser tests
2015-10-26 15:50:57 +01:00
Dominik Richter
b58a4b3f43
rename vulcanosec -> inspec
2015-10-26 12:34:15 +01:00
Christoph Hartmann
126ce88bce
fix unit tests
2015-10-26 12:16:38 +01:00
Dominik Richter
20dae26925
split methods for processing rules and checks after loading
2015-10-19 09:49:40 +02:00
Dominik Richter
d66f874e1c
feature: support expect keyword in rules
2015-10-18 19:14:22 +02:00
Dominik Richter
f2e955eb37
test: add tests for rule.describe
2015-10-18 19:11:56 +02:00
Dominik Richter
b38adfc6b2
test: add profile context tests
2015-10-18 19:11:56 +02:00
Dominik Richter
ec0931ef9c
test: group resource tests
2015-10-17 22:53:21 +02:00
Dominik Richter
be614e9056
migrate backend to Train project
2015-10-14 23:13:49 +02:00
Christoph Hartmann
7635a20756
flatten describe tests
2015-10-12 13:35:16 +02:00
Christoph Hartmann
7096b3cd9a
remove let in tests
2015-10-12 13:35:15 +02:00
Christoph Hartmann
dd2fb7938f
ease windows feature test
2015-10-12 13:35:15 +02:00
Christoph Hartmann
d666ce84a2
fix describe in unit tests
2015-10-12 13:35:15 +02:00
Christoph Hartmann
128eb4a7f6
add tests for iptables
2015-10-12 10:34:24 +02:00
Christoph Hartmann
9774ec7984
add test coverage for apt
2015-10-10 23:28:03 +02:00
Christoph Hartmann
2176039120
add linux tests for host
2015-10-09 19:27:29 +02:00
Christoph Hartmann
5a70133330
add mock files for host windows tests
2015-10-09 19:27:07 +02:00
Christoph Hartmann
80b38412e6
add tests for windows
2015-10-09 19:21:55 +02:00
Christoph Hartmann
3126a46b1e
add bridge unit tests for windows
2015-10-09 15:26:59 +02:00
Christoph Hartmann
74729f5779
add more unit test cases
2015-10-09 15:10:43 +02:00
Christoph Hartmann
b2ed180885
add bridge test for linux
2015-10-09 15:07:58 +02:00
Christoph Hartmann
9d92abf524
add windows support to network adapter
2015-10-08 13:01:50 +02:00
Christoph Hartmann
153c670952
introduce better network interface abstraction, add test cases
2015-10-08 13:01:50 +02:00
Christoph Hartmann
d2997400df
add author information
2015-10-07 18:45:08 +02:00
Christoph Hartmann
9c893c5653
add mock result for GetWin32 Group
2015-10-07 18:45:08 +02:00
Christoph Hartmann
737df5348a
add test coverage for group resource
2015-10-07 18:45:08 +02:00
Christoph Hartmann
537728b41b
test case where group or os is not available
2015-10-07 18:45:08 +02:00
Christoph Hartmann
c17be0438a
add unit tests for group resource
2015-10-07 18:45:07 +02:00
Christoph Hartmann
e57505739e
improvement: return gids in etc_group as integer
2015-10-07 18:45:07 +02:00
Christoph Hartmann
028e7f977e
filter comments in /etc/group
2015-10-07 18:45:07 +02:00
Christoph Hartmann
df9411e529
rename test from etcgroup
2015-10-07 18:45:07 +02:00
Christoph Hartmann
9295a60913
add test case for script resource
2015-10-07 13:13:37 +02:00
Christoph Hartmann
8fff2ee989
add author header
2015-10-06 18:55:44 +02:00
Christoph Hartmann
f38ce7d5f4
bugfix: fix error, where the winrm default path is not set properly by default
2015-10-05 15:35:02 +02:00
Christoph Hartmann
6b2064ad89
return password expiry information for linux
2015-10-05 11:50:49 +02:00
Christoph Hartmann
cab93a178a
add tests for user resource
2015-10-05 11:50:49 +02:00
Dominik Richter
369e61d0cd
feature: add path to target specification
...
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-10-03 23:39:09 +02:00
Christoph Hartmann
e139070923
increase test coverage for oneget
2015-10-03 13:27:20 +02:00
Dominik Richter
8b97bdbaa7
expose simpleconfig groups
...
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-30 12:18:09 +02:00
Dominik Richter
4d70aed6ee
add tests for simple config
...
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-30 12:14:38 +02:00
Dominik Richter
4e15e425a4
move darwin to bsd type
...
see: https://en.wikipedia.org/wiki/Darwin_%28operating_system%29#/media/File:Unix_timeline.en.svg
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-28 12:14:40 +02:00
Dominik Richter
4f0c0d7f21
add unit tests to os common detection
...
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-28 11:52:50 +02:00
Christoph Hartmann
a53b2d66c5
add comments
2015-09-25 12:58:34 +02:00
Christoph Hartmann
46fcb334da
bugfix: use debian 8 for systemd unit test
2015-09-25 12:58:26 +02:00
Christoph Hartmann
007d292890
rewrite systemv service implementation, read enabled services from rc
2015-09-25 12:58:03 +02:00
Christoph Hartmann
2901dde219
add systemv service unit tests
2015-09-25 12:54:19 +02:00
Christoph Hartmann
11ffdeddad
improvement: return nil, if no description for service is available
2015-09-25 12:54:08 +02:00
Christoph Hartmann
86cd56c5c3
add unit test for service resource on ubuntu 15.04
2015-09-25 12:53:55 +02:00
Christoph Hartmann
5be574693f
add unit tests for freebsd service resource
2015-09-25 12:53:40 +02:00
Christoph Hartmann
d5d517af0a
improve service handling for mac and add unit tests
2015-09-25 12:51:12 +02:00
Christoph Hartmann
36ad0dd5a0
add arch linux support for service resource
2015-09-25 12:48:57 +02:00
Christoph Hartmann
45081735ad
add debian 8 mock test for service resource
2015-09-25 12:48:48 +02:00
Christoph Hartmann
cb3d170ce6
add centos 7 unit mock for service resource
2015-09-25 12:48:21 +02:00
Christoph Hartmann
1936383120
add service unit tests for ubuntu 14.04
2015-09-25 11:52:33 +02:00
Christoph Hartmann
3e16791f52
bugfix: catch case in service resource, where the OS is not supported
2015-09-25 11:52:33 +02:00
Christoph Hartmann
cf8a75f233
improvement: make service tests os dependent
2015-09-25 11:52:33 +02:00
Christoph Hartmann
3807a7412c
add package unit test for windows
2015-09-23 23:30:31 +02:00
Christoph Hartmann
5151f42d7d
add package unit test for unsupported os
2015-09-23 23:30:31 +02:00
Christoph Hartmann
61143907c2
add versions to package unit tests
2015-09-23 23:30:31 +02:00
Christoph Hartmann
52e4459d61
rename pacman mock file
2015-09-23 23:30:31 +02:00
Christoph Hartmann
943eef4ef3
make package unit tests os dependent
2015-09-23 23:30:31 +02:00
Christoph Hartmann
672f196a76
update port tests
2015-09-23 23:15:40 +02:00
Christoph Hartmann
cd6dbd03a1
add sockstat mock result
2015-09-23 23:15:37 +02:00
Christoph Hartmann
d889f0b0b1
port resource support for FreeBSD
2015-09-23 23:08:54 +02:00
Christoph Hartmann
b47ec509fd
port resource support for Windows
2015-09-23 23:08:19 +02:00
Christoph Hartmann
4eeb84945c
port resource support for MacOS
2015-09-23 23:07:07 +02:00
Christoph Hartmann
c187230336
implement port resource for linux
2015-09-23 18:12:51 +02:00
Christoph Hartmann
bdb9a59264
simplify unit tests
2015-09-22 18:33:05 +02:00
Christoph Hartmann
39b697ccb7
implement os mock in unit tests
2015-09-22 18:31:21 +02:00
Christoph Hartmann
7155ca8f45
fix description with colon
2015-09-22 02:27:04 +02:00
Christoph Hartmann
4ea5a0bf97
fix description with colon
2015-09-22 02:27:04 +02:00
Christoph Hartmann
693d9cd0cf
add example.csv for unit test
2015-09-22 02:27:04 +02:00
Christoph Hartmann
5f7910a0cf
fix title
2015-09-22 02:27:04 +02:00
Christoph Hartmann
cf3dddf1a3
add csv support
2015-09-22 02:27:04 +02:00
Christoph Hartmann
b9d4fc6d8c
add yaml resource
2015-09-22 02:27:04 +02:00
Christoph Hartmann
0e43d4ca6a
add json resource
2015-09-22 02:27:04 +02:00
Dominik Richter
523263b4b6
simplify and extend tests
...
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 02:27:04 +02:00
Christoph Hartmann
8fc108bcd7
add tests
2015-09-22 02:27:04 +02:00
Christoph Hartmann
baee8daae8
add unit tests for windows feature
2015-09-22 02:27:03 +02:00
Dominik Richter
052143bdb8
adjust serverspec yum deprecation test
...
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 02:27:03 +02:00
Dominik Richter
bb18ce52e2
update function+test calls from exists? -> exist?
2015-09-22 02:27:03 +02:00
Dominik Richter
38a77efb4a
fix failing tests
...
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 02:27:01 +02:00
Christoph Hartmann
9a6063c267
add resource test for windows
2015-09-22 02:26:59 +02:00
Christoph Hartmann
33f9dd8e87
add oneget resource
2015-09-22 02:17:21 +02:00
Dominik Richter
ddbaebae46
add mysql unit tests
...
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 02:15:42 +02:00
Christoph Hartmann
238f1b2016
add pip resource to verify gem packages
2015-09-22 02:15:41 +02:00
Christoph Hartmann
bdb859b730
add npm resource to verify gem packages
2015-09-22 02:15:41 +02:00
Christoph Hartmann
0171b2e2f2
add gem resource to verify gem packages
2015-09-22 02:15:41 +02:00
Christoph Hartmann
02afd48576
add mock resources for package resource
2015-09-22 02:15:41 +02:00
Christoph Hartmann
9783751741
implement package resource
2015-09-22 02:15:41 +02:00
Dominik Richter
905f2a0a6f
remove duplicate key in test
...
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 01:42:26 +02:00
Dominik Richter
305bb39668
add missing local backend
...
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 01:23:08 +02:00
Christoph Hartmann
a7efec310b
implement yum resource
2015-09-22 01:10:56 +02:00
Christoph Hartmann
9554a4ac32
add audit_daemon resource test cases
2015-09-21 14:12:11 +02:00
Christoph Hartmann
90935e75e1
add unit test for audit_policy resource
2015-09-21 14:09:16 +02:00
Christoph Hartmann
888f8588fb
add unit test for registry_key resource
2015-09-21 14:08:27 +02:00
Christoph Hartmann
57ab2a816b
fix rubocop issues for bond unit test
2015-09-21 14:08:20 +02:00
Christoph Hartmann
ca2e0ed6cb
add unit tests for etc_group resource
2015-09-21 14:07:32 +02:00
Christoph Hartmann
fb3b4b1369
add unit test for inetd_conf
2015-09-21 14:05:42 +02:00
Christoph Hartmann
158e4ac1ab
add unit test for limits.conf
2015-09-21 14:03:24 +02:00
Christoph Hartmann
797d24c14a
add login_def resource unit test
2015-09-21 14:01:51 +02:00
Christoph Hartmann
faf7f44a42
add os_env unit test
2015-09-21 13:58:22 +02:00
Christoph Hartmann
0adf3314af
add ntp unit test
2015-09-21 13:57:42 +02:00
Christoph Hartmann
413267c322
add passwd unit test
2015-09-21 13:55:51 +02:00
Christoph Hartmann
1b643ae1da
implement security policy resource tests
2015-09-21 13:51:43 +02:00
Christoph Hartmann
08ad9704a7
move mock files to new sub-directory
2015-09-21 13:43:09 +02:00
Christoph Hartmann
03a7dd7176
implement unit test for processes resource
2015-09-21 13:43:09 +02:00
Christoph Hartmann
ae514959d2
add ssh unit tests
2015-09-21 13:38:54 +02:00
Christoph Hartmann
6a00ce8ebe
add utf-8 header to tests
2015-09-03 18:04:13 +02:00
Christoph Hartmann
abae94ba4e
improve test style
2015-09-03 18:03:51 +02:00
Christoph Hartmann
cf77e56118
add unit test for bond resource
2015-09-03 17:34:11 +02:00
Dominik Richter
f54fa6537a
use string for backend conf
...
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-03 14:56:08 +02:00
Dominik Richter
5ae3b13b38
use let instead of before
...
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-03 10:25:27 +02:00
Dominik Richter
199cb84ab3
not implemented only throws on missing methods
...
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-02 17:30:49 +02:00
Dominik Richter
1c2ab098f5
specify methods all backends must implement
...
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-02 11:53:25 +02:00
Dominik Richter
05b4167971
start backend and file tests
...
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-02 04:55:22 +02:00
Dominik Richter
32964c1e4e
tests for backend
...
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-02 04:19:23 +02:00