InSpec is a framework to create infrastructure tests for integration or compliance testing and is marketed as compliance as code. InSpec uses a similar syntax to ServerSpec. Currently, it is not feature parity with ServerSpec.
Tests are orchestrated using the inspec command. There is no further automation to integrate or further orchestrate tests directly on vagrant or docker using ruby workflow with rake or spec. For more advanced orchestration needs, you can use TestKitchen.
Getting Started with InSpec
With ruby installed, you can install everything needed for InSpec with:
gem install inspec
inspec init profile $PROFILENAME
This will create the following structure, where $PROFILENAME matches the name of your choosing:
│ └── example.rb
Test Script Example
In the control directory, you can add your test like the following below:
Running the Tests
InSpec can use SSH to log into your systems and run tests. With vagrant you can run the tests by specifying the port, path to ssh private key, and the user name and host. You can get these values from values by typing vagrant ssh-config, and then replace the variables below with the required values.
inspec exec $PROFILENAME/ \
-t ssh://$TARGET_USER@$TARGET_HOST \
-p $TARGET_PORT \