mirror of
https://github.com/inspec/inspec
synced 2024-11-27 07:00:39 +00:00
implement integration tests for ini, csv, json and yaml resources
This commit is contained in:
parent
0531976a40
commit
a8e50cd2cf
10 changed files with 72 additions and 0 deletions
7
test/integration/cookbooks/os_prepare/files/example.csv
Normal file
7
test/integration/cookbooks/os_prepare/files/example.csv
Normal file
|
@ -0,0 +1,7 @@
|
|||
name,version,license,title,description
|
||||
addressable,2.3.6,Apache 2.0,URI Implementation,"Addressable is a replacement for the URI implementation that is part of
|
||||
Ruby's standard library. It more closely conforms to the relevant RFCs and
|
||||
adds support for IRIs and URI templates."
|
||||
ast,2.0.0,MIT,A library for working with Abstract Syntax Trees.,A library for working with Abstract Syntax Trees.
|
||||
astrolabe,1.3.0,MIT,An object-oriented AST extension for Parser,An object-oriented AST extension for Parser
|
||||
berkshelf,3.2.3,Apache 2.0,"Manages a Cookbook's, or an Application's, Cookbook dependencies","Manages a Cookbook's, or an Application's, Cookbook dependencies"
|
|
6
test/integration/cookbooks/os_prepare/files/example.ini
Normal file
6
test/integration/cookbooks/os_prepare/files/example.ini
Normal file
|
@ -0,0 +1,6 @@
|
|||
# a comment...
|
||||
[client]
|
||||
port = 3306
|
||||
|
||||
[mysqld]
|
||||
user = mysql
|
12
test/integration/cookbooks/os_prepare/files/example.json
Normal file
12
test/integration/cookbooks/os_prepare/files/example.json
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"name": "demo",
|
||||
"run_list": [
|
||||
"apache2",
|
||||
"omnibus"
|
||||
],
|
||||
"cookbook_locks": {
|
||||
"omnibus": {
|
||||
"version": "2.2.0"
|
||||
}
|
||||
}
|
||||
}
|
7
test/integration/cookbooks/os_prepare/files/example.yml
Normal file
7
test/integration/cookbooks/os_prepare/files/example.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
driver:
|
||||
name: vagrant
|
||||
customize:
|
||||
memory: 1024
|
||||
platforms:
|
||||
- name: centos-5.11
|
||||
- name: centos-6.7
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
include_recipe('os_prepare::apt')
|
||||
include_recipe('os_prepare::file')
|
||||
include_recipe('os_prepare::json_yaml_csv_ini')
|
||||
include_recipe('os_prepare::package')
|
||||
include_recipe('os_prepare::registry_key')
|
||||
include_recipe('os_prepare::service')
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
# encoding: utf-8
|
||||
# author: Christoph Hartmann
|
||||
# author: Dominik Richter
|
||||
#
|
||||
# adds a yaml file
|
||||
|
||||
gid = 'root'
|
||||
gid = 'wheel' if node['platform_family'] == 'freebsd'
|
||||
|
||||
['yml', 'json', 'csv', 'ini'].each { |filetype|
|
||||
|
||||
cookbook_file "/tmp/example.#{filetype}" do
|
||||
source "example.#{filetype}"
|
||||
owner 'root'
|
||||
group gid
|
||||
mode '0755'
|
||||
action :create
|
||||
end
|
||||
}
|
5
test/integration/test/integration/default/csv_spec.rb
Normal file
5
test/integration/test/integration/default/csv_spec.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
# encoding: utf-8
|
||||
|
||||
describe csv('/tmp/example.csv') do
|
||||
its('name') { should eq(['addressable', 'ast', 'astrolabe', 'berkshelf']) }
|
||||
end
|
5
test/integration/test/integration/default/ini_spec.rb
Normal file
5
test/integration/test/integration/default/ini_spec.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
# encoding: utf-8
|
||||
|
||||
describe ini('/tmp/example.ini') do
|
||||
its(['client','port']) { should eq('3306') }
|
||||
end
|
5
test/integration/test/integration/default/json_spec.rb
Normal file
5
test/integration/test/integration/default/json_spec.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
# encoding: utf-8
|
||||
|
||||
describe json('/tmp/example.json') do
|
||||
its(['cookbook_locks','omnibus','version']) { should eq('2.2.0') }
|
||||
end
|
5
test/integration/test/integration/default/yaml_spec.rb
Normal file
5
test/integration/test/integration/default/yaml_spec.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
# encoding: utf-8
|
||||
|
||||
describe yaml('/tmp/example.yml') do
|
||||
its(['driver','name']) { should eq('vagrant') }
|
||||
end
|
Loading…
Reference in a new issue