Control parameter for a subset of test cases


#1

I have multiple control cases bundled in the inspec profile.
There are different set of controls. The control naming is like app-01,02,03 etc for application server tests, web-01,02,03,etc for web servers.
I can’t specify wildcard in the control param. Only individual controls can be specified. How can I run test cases only for the app server? Is there a way to run only controls name starting with "app-"? Or do I have to put all the different controls in an other profile?
inspec exec my_inspec_profile --controls=app-01 app-02 app-03
Can I have something like > inspec exec my_inspec_profile --controls=app-


#2

InSpec does not currently support pattern matching when specifying the controls. I would recommend breaking out each set of controls into its own profile. If you ever need to run all the controls, you can simply tell InSpec to run multiple profiles, or you can create a “wrapper profile” that has no controls itself but instead depends on all your other profiles and contains the appropriate include_controls lines to execute the controls from each dependent profile.

~Adam


#3

Hi @istvan,

The --controls parameter does not handle wildcards. If your app related checks are contained in a separate .rb control file then simply just invoke inspec exec app.rb
If all your controls are in one .rb then you have to list all the necessary controls you want to execute

Also you could think about using wrapper profiles. @adamleff has created a good document regarding this topic