Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add way to define alternate test-path #70

Closed
rndmh3ro opened this issue Mar 17, 2016 · 9 comments
Closed

Add way to define alternate test-path #70

rndmh3ro opened this issue Mar 17, 2016 · 9 comments

Comments

@rndmh3ro
Copy link

Right now, the path kitchen-inspec searches for tests is hard-coded.(https://github.com/chef/kitchen-inspec/blob/master/lib/kitchen/verifier/inspec.rb#L72)
It takes the base path (e.g. test/integration/) and then appends the suite-name (default).

Now we have the problem that we want to share tests between different suites (dev-sec/ansible-ssh-hardening#61):
The tests are in test/integration/default/inspec/, but kitchen-inspec searches in test/integration/ansible-latest/inspec/.

Therefore I propose to let the user define the test search path, either as a relative variable to the base path (in this case default/ or as an absolute path (test/integration/default).

@chris-rock
Copy link
Collaborator

@rndmh3ro This is not restricted to kitchen-inspec and is expected behaviour in test-kitchen. Test directories are determined by test/integration/%suite-name%.

As highlighted in my response in dev-sec/ansible-ssh-hardening#61, I propose we use real InSpec profiles for the test suites and remote profiles in combination with kitchen-inspec.

suites:
  - name: default
    run_list:
      - recipe[ssh-hardening::default]
    verifier:
      inspec_tests:
        - https://github.com/hardening-io/tests-ssh-hardening/tree/2.0

@AnotherNerdHere
Copy link

Based on the info in https://github.com/chef/inspec/tree/master/examples/profile, being able to specify path names either local paths or local git repo (bitbucket/stash) would be helpful. We don't use github for our vcs.

@jcii
Copy link

jcii commented Aug 3, 2016

My employer has enterprise github. I would like to have Inspec tests stored in separate audit cookbooks and pull them from github.mycompany.com ... kitchen-inspec only works if https://github.com/ is the beginning of the URL (from what I can discern...)

@chris-rock
Copy link
Collaborator

You can easily pass a path:

suites:
  - name: default
    run_list:
      - recipe[ssh-hardening::default]
    verifier:
      inspec_tests:
        - /path/to/profile

@jcii right now, InSpec only understands github url, but we could find a way to make that happen. The only piece that needs some adaption is: https://github.com/chef/inspec/blob/master/lib/fetchers/url.rb Therefore it is not a limitation of kitchen-inspec, but inspec.

@aidda
Copy link

aidda commented Aug 2, 2017

@chris-rock I`m wondering to know is that possible to use bitbucket insted of github?

@chris-rock
Copy link
Collaborator

@aidda Yes we have bitbucket support, although it is not well documented yet. Please help us to make it better! You can see possible urls here: https://github.com/chef/inspec/blob/master/lib/fetchers/url.rb#L46-L63

@aidda
Copy link

aidda commented Aug 3, 2017

@chris-rock I was checking this link yesterday ;) and add bitbucket url in kitchen-inspec. it was working perefctly. I`ll update the documents! thanks

@chris-rock
Copy link
Collaborator

Awesome. Thank you @aidda

@adamleff
Copy link
Contributor

It appears this issue is resolved, and the generic url fetcher can be used to pull a .tar.gz file from an enterprise github if needed (just navigate to the "releases" section of the repo to find the exact URL you need).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants