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

InSpec output for summary needs to count controls #852

Closed
arlimus opened this issue Aug 1, 2016 · 3 comments · Fixed by #1083
Closed

InSpec output for summary needs to count controls #852

arlimus opened this issue Aug 1, 2016 · 3 comments · Fixed by #1083
Labels
Type: Enhancement Improves an existing feature
Milestone

Comments

@arlimus
Copy link
Contributor

arlimus commented Aug 1, 2016

Currently InSpec counts "examples", i.e. so-called RSpec examples.
We want to drop that as a visible concept and as a term in our vocabulary book.

InSpec counts controls and tests. Controls may have a number of tests. Tests may exist without controls (albeit: internally we map them to anonymous controls anyway).

InSpec's output reflects RSpec examples (i.e. tests): Count of failed, passed, and skipped tests.

Suggestion

Number of controls (total), number of passed controls, failed controls, number of skipped controls.
(Optional maybe: number of tests, passed tests, failed tests, skipped tests. (May not be necessary!!))
Controls that exist but don't have any tests, is counted as a control in the list of total controls, but not as a passed or failed or skipped control.

@arlimus arlimus added the Type: Enhancement Improves an existing feature label Aug 1, 2016
@arlimus arlimus added this to the 0.29.0 milestone Aug 1, 2016
@vjeffrey
Copy link

vjeffrey commented Aug 1, 2016

ksubrama pushed a commit that referenced this issue Aug 5, 2016
Count controls in the summary output. Fix #852
@arlimus arlimus reopened this Sep 14, 2016
@arlimus
Copy link
Contributor Author

arlimus commented Sep 14, 2016

Needs to be addressed as of current master.

@arlimus
Copy link
Contributor Author

arlimus commented Sep 14, 2016

Currently we have:

  "summary": {
    "duration": 0.02895223,
    "example_count": 5,
    "failure_count": 0,
    "skip_count": 1
  }

Multiple decisions:

  1. Display tests vs controls (either, both, neither?)
  2. Naming
  3. Display detailed info on crit/major/minor failed/success/skip

Decision

  "statistics": {
    "duration": 0.02895223,
  }

Reason: there is so many different things to include and arguments for/against it. But ultimately, whatever we put in this API, we also have to maintain over time. That also means, that things might change and break you. The big problem in here: This whole field is really just a data mangling/processing operation which we shouldn't do in core inspec. Let's tackle recommendations on how to do this separately.

Counting controls and tests in CLI output:

  • Internally: Create counters for all the controls and their skipped+passed+failed+total counts and all the failed include major+minor+critical. Do NOT count non-controls (i.e. anonymous controls that are created from rspec/non-control tests).
  • Internally: Count tests for everything(! i.e. controls and non-controls; it doesn't matter, treat them equally). This is the traditional rspec counter/summary field which has passed+failed+skipped (yeah pending)
  • For CLI output:
Profile: InSpec Example Profile (profile)
Version: 1.0.0
Target:  local://

  ✔  ssh-1: Allow only SSH Protocol 2
     ✔  File /bin/sh should be owned by "root"
  ✔  tmp-1.0: Create /tmp directory
     ✔  File /tmp should be directory
  ○  gordon-1.0: Verify the version number of Gordon (1 skipped)
     ○  Can't find file "/tmp/gordon/config.yaml"
     ✔  File  content should match nil

  File /tmp
     ✔  should be directory

Profile summary: 2 successful, 0 failures, 1 skipped
Test summary: 4 successful, 0 failures, 1 skipped

Ideally we will never see it this way, as mixed control/non-control profiles are incredibly rare in the real world.

For only-control cases:

Profile: InSpec Example Profile (profile)
Version: 1.0.0
Target:  local://

  ✔  ssh-1: Allow only SSH Protocol 2
     ✔  File /bin/sh should be owned by "root"
  ✔  tmp-1.0: Create /tmp directory
     ✔  File /tmp should be directory
  ○  gordon-1.0: Verify the version number of Gordon (1 skipped)
     ○  Can't find file "/tmp/gordon/config.yaml"
     ✔  File  content should match nil

Profile summary: 2 successful, 0 failures, 1 skipped

For only-tests cases (no control was defined):

Profile: InSpec Example Profile (profile)
Version: 1.0.0
Target:  local://

  File /tmp
     ✔  should be directory

Test summary: 1 successful, 0 failures, 0 skipped

@arlimus arlimus modified the milestones: 0.35.0, 0.29.0 Sep 14, 2016
@chris-rock chris-rock modified the milestones: 0.35.0, 0.36.0 Sep 19, 2016
@chris-rock chris-rock modified the milestones: 0.36.0, 1.0.0 Sep 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Improves an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants