Commit graph

1921 commits

Author SHA1 Message Date
Ryan Davis
ae0dead7be This is all dead. Removed.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 14:41:37 -08:00
Ryan Davis
43f520b4a8 Merged Inspec::Plugins::Resource to Inspec::Resource.
This also removes Inspec::ResourceBehaviors and Inspec::ResourceDSL.

All class methods look like class methods.
All instance methods look like instance methods.

There is still too much clever going on with __register creating
another anonymous subclass, but I think I can work that out/down too.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 14:41:37 -08:00
Ryan Davis
44a006a05a Rename Inspec::Resource.supports to support_registry.
To fix an already existing name collision between Inspec::Resource and
Inspec::Plugins::Resource.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:19:32 -08:00
Ryan Davis
99f86c8a0b These tests don't pass on a network cafe and just hang forever.
Changing to localhost resolves immediately but assumes you're NOT
running a git server on http locally.

This seems more valid to me than assuming you know how DNS is going to
resolve everywhere.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:18:56 -08:00
Ryan Davis
51b65f6c2e Overhaul Platform#supported?
+ State normal path first.
+ Use Enumerable to state your logic up front, don't build it into
  loops with breaks/returns.
+ Remove nonsensical duplication of key formats. (should push up or remove)
+ Had to add an extra test case that wasn't covered here but was in
  metadata_test.rb (why?!?)

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:18:56 -08:00
Ryan Davis
2490a88b9c Minor test improvements
We need to track down `x.must_equal true`.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:18:56 -08:00
Ryan Davis
99ded5a132 Improve test expressiveness by using more direct assertions.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:18:56 -08:00
Ryan Davis
06ceba3f3d Add test for LEC to expose second-level libraries require.
Not the best test in the world, but it is better than nothing.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:18:56 -08:00
Ryan Davis
ddb0db12ef Completely refactored profile_resource_exceptions_test.rb
Half... half.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:18:56 -08:00
Ryan Davis
a3060c4ca8
Merge pull request #4860 from inspec/cw/win-func-input-tests
Remove skips from windows testing in 'inputs' and 'archive' functional tests
2020-01-31 17:51:36 -08:00
Ryan Davis
c70f73dc96
Merge pull request #4864 from inspec/zenspider/resource/inspect
Added --inspect option to inspect shell command.
2020-01-31 16:42:00 -08:00
Ryan Davis
cc1393bb9a
Merge pull request #4822 from PiQuer/master
make command.exist? POSIX conform
2020-01-31 16:41:27 -08:00
Ryan Davis
f2155a64ed
Merge pull request #4843 from michaellihs/master
Add support for yocto linux in service resource
2020-01-29 16:19:27 -08:00
Ryan Davis
19ce5df589
Merge pull request #4827 from inspec/mj/namespaces
Move parsers under Utils
2020-01-29 16:18:43 -08:00
Ryan Davis
10406545ca
Merge pull request #4862 from inspec/zenspider/resources
Fix up the platform on etc_hosts, virtualization, ini, and xml resources to fix OS disparity.
2020-01-29 16:07:47 -08:00
Ryan Davis
2ae2bcf6fb
Merge pull request #4818 from JackChance/master
replaced instances of `have_protocols` with `have_protocol` in docume…
2020-01-29 15:46:25 -08:00
Ryan Davis
9c051da22b Fix platform on apache_conf to include all unix.
Now discovers the first available conf file from a list of known
paths. Might have to expand based on various distros.

Had to tweak the tests because the mock loader mocks EVERYTHING every
time. :/

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-01-28 14:53:37 -08:00
Ryan Davis
8bd2528ef8 Added --inspect option to inspect shell command.
* Removed Resource#inspect (calling to_s) to make debugging a happy experience.
* Added ResourceBehavior.toggle_inspect to add/remove a basic inspect.
* Added `--inspect` flag to `shell` command. Call toggle_inspect unless --inspect used.
* Cleaned up matchers.rb and removed most explicit calls to inspect.
* Added ResourceInspector to rspec's INSPECTOR_CLASSES.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-01-28 14:52:04 -08:00
Clinton Wolfe
3d5226fb68 Q-quote the args to the train plugin
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-28 13:48:10 -05:00
Clinton Wolfe
28f8d6cc5f Removing skip in archive test just seems to work, too
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-28 12:24:29 -05:00
Clinton Wolfe
6290ee0190 Just remove skips, it seems to work
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-28 11:57:25 -05:00
Clinton Wolfe
46ade02401
Use an archive if possible when fetching fails and --airgap is… (#4806)
Use an archive if possible when fetching fails and --airgap is provided
2020-01-28 10:02:57 -05:00
Ryan Davis
df31f744f4 Fix up platform on filesystem resource.
From linux to unix. This should work fine even on AIX, according to
the man pages.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-01-27 15:34:33 -08:00
Noel Georgi
7ac25401bb
Add: content option for x509_certificate
Signed-off-by: Noel Georgi <git@frezbo.com>
2020-01-22 13:49:35 +05:30
Raimar Sandner
fa2f2c2caa make command.exist? POSIX conform
With the current implementation, on a Linux system without bash
command.exist? always returns false. 'sh -c' is guaranteed to exist on a
POSIX-conform system [1] whereas 'bash -c' only works if bash is
actually installed.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html

Obvious fix.
2020-01-19 00:05:33 +01:00
Michael Lihs
edd93eea81 Add support for yocto linux in service resource
Signed-off-by: Michael Lihs <michael.lihs@thoughtworks.com>
2020-01-18 01:26:16 +01:00
Miah Johnson
0d57612103 Update references to use new namespace
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2020-01-07 15:12:42 -08:00
Clinton Wolfe
ef9ef919fc Linting
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-03 14:15:05 -05:00
Clinton Wolfe
3e3398ff29 Switch to using tmpdir option during testing to avoid rm calls
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-03 14:15:05 -05:00
Clinton Wolfe
ba4fa9832c parallelize fetcher tests, conditionalize automate fetcher
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-03 14:15:05 -05:00
Clinton Wolfe
913c066be9 Test fixture and functional test for compliance fetcher
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-03 14:15:05 -05:00
Clinton Wolfe
82ae3b5fa1 Test fixtures and functional test for local fetcher
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-03 14:15:05 -05:00
Clinton Wolfe
ed209643f3 Test fixture for url fetcher
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-03 14:15:05 -05:00
Clinton Wolfe
928cf6f05e Functional test and fixtures for git fetcher fallback
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-03 14:15:04 -05:00
Ryan Davis
f09595c33d
Merge pull request #4821 from inspec/zenspider/mocha2
Found and fixed more mocha/setup deprecations.
2020-01-02 16:07:35 -08:00
Ryan Davis
c57a0e1f13 Found and fixed more mocha/setup deprecations.
This level of duplication is not good.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-12-31 15:46:47 -08:00
Ryan Davis
73cccd8681 Cache the backend in profile_context_test.rb
And this speeds it up from 0.5s to 0.07s.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-12-31 15:27:12 -08:00
Ryan Davis
313f3462ca Cache MockLoader.connection.
Speeds up test/unit/profile/profile_context_test from 7-8s to 0.5s.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-12-31 15:27:12 -08:00
Ryan Davis
6426feeeb4 Removed the last of the metaprogramming from ControlEvalContext.
* Merged CEC.create args into CEC#initialize
* Converted the only call site of CEC.create to just call new.
* Added profile_context and resources_dsl accessors to CEC.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-12-31 15:27:12 -08:00
Clinton Wolfe
2409e8fb99 Set test skip bomb date to end of 2020Q1
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-12-31 12:19:27 -05:00
Cameron Straka
8b037fa9c2 replaced instances of have_protocols with have_protocol in documentation and examples
Signed-off-by: Cameron Straka <strakacameron@hotmail.com>
2019-12-31 10:51:55 -05:00
Ryan Davis
8e281e007e oops
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-12-24 04:11:17 -08:00
Ryan Davis
83f7504d7c
Merge pull request #4789 from Perceptyx/add-freebsd-package
Add suport for freebsd package resource
2019-12-17 14:05:40 -08:00
Felipe Zipitria
bff3fa960d
Add suport for freebsd package resource
Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>
2019-12-17 08:39:43 -03:00
Ryan Davis
e49efa2619 This should fix the mocha deprecations.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-12-16 15:01:38 -08:00
Ryan Davis
04581d2270
Merge pull request #4771 from inspec/zenspider/rspec-3.9
Bump rspec to 3.9 and fix broken tests.
2019-12-09 12:09:32 -08:00
Ryan Davis
f67171fa6b Bump rspec to 3.9 and fix broken tests.
Tests are STILL brittle, but this at least lets us drop old rspec.

Fixes #4575

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-12-06 16:52:35 -08:00
Clinton Wolfe
bba6d70b3b Raise FetcherFailure for url headers missing
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-12-04 13:32:58 -05:00
Clinton Wolfe
b34d489f5c Add .invalid TLD to test hostanmes
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-12-04 13:32:58 -05:00
Clinton Wolfe
6b0877591f Refactor functional test to DRY up
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-12-04 13:32:19 -05:00