mirror of
https://github.com/inspec/inspec
synced 2024-12-01 00:49:24 +00:00
5c1467dfe9
Signed-off-by: IanMadd <maddaus@protonmail.com>
64 lines
1.2 KiB
Text
64 lines
1.2 KiB
Text
---
|
|
title: About the csv Resource
|
|
platform: os
|
|
---
|
|
|
|
# csv
|
|
|
|
Use the `csv` Chef InSpec audit resource to test configuration data in a CSV file.
|
|
|
|
<br>
|
|
|
|
## Availability
|
|
|
|
### Installation
|
|
|
|
This resource is distributed along with Chef InSpec itself. You can use it automatically.
|
|
|
|
### Version
|
|
|
|
This resource first became available in v1.0.0 of InSpec.
|
|
|
|
## Syntax
|
|
|
|
A `csv` resource block declares the configuration data to be tested:
|
|
|
|
describe csv('file') do
|
|
its('name') { should cmp 'foo' }
|
|
end
|
|
|
|
where
|
|
|
|
* `'file'` is the path to a CSV file
|
|
* `name` is a configuration setting in a CSV file
|
|
* `should eq 'foo'` tests a value of `name` as read from a CSV file versus the value declared in the test
|
|
|
|
<br>
|
|
|
|
## Examples
|
|
|
|
The following examples show how to use this Chef InSpec audit resource.
|
|
|
|
### Test a CSV file
|
|
|
|
describe csv('some_file.csv') do
|
|
its('setting') { should eq 1 }
|
|
end
|
|
|
|
<br>
|
|
|
|
## Property Examples
|
|
|
|
### name
|
|
|
|
The `name` property tests the value of `name` as read from a CSV file compared to the value declared in the test.
|
|
|
|
its('name') { should cmp 'foo' }
|
|
|
|
<br>
|
|
|
|
## Matchers
|
|
|
|
For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
|
|
|