Skip to content

Commit 34625cc

Browse files
committed
test(inspec): use inspec to run tests
1 parent cfdfc38 commit 34625cc

File tree

6 files changed

+90
-16
lines changed

6 files changed

+90
-16
lines changed

test/integration/default/README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# InSpec Profile: `default`
2+
3+
This shows the implementation of the `default` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md).
4+
5+
## Verify a profile
6+
7+
InSpec ships with built-in features to verify a profile structure.
8+
9+
```bash
10+
$ inspec check default
11+
Summary
12+
-------
13+
Location: default
14+
Profile: profile
15+
Controls: 4
16+
Timestamp: 2019-06-24T23:09:01+00:00
17+
Valid: true
18+
19+
Errors
20+
------
21+
22+
Warnings
23+
--------
24+
```
25+
26+
## Execute a profile
27+
28+
To run all **supported** controls on a local machine use `inspec exec /path/to/profile`.
29+
30+
```bash
31+
$ inspec exec default
32+
..
33+
34+
Finished in 0.0025 seconds (files took 0.12449 seconds to load)
35+
8 examples, 0 failures
36+
```
37+
38+
## Execute a specific control from a profile
39+
40+
To run one control from the profile use `inspec exec /path/to/profile --controls name`.
41+
42+
```bash
43+
$ inspec exec default --controls package
44+
.
45+
46+
Finished in 0.0025 seconds (files took 0.12449 seconds to load)
47+
1 examples, 0 failures
48+
```
49+
50+
See an [example control here](https://github.com/inspec/inspec/blob/master/examples/profile/controls/example.rb).
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
control 'InfluxDB configuration' do
2+
title 'should match desired lines'
3+
4+
describe file('/etc/influxdb/influxdb.conf') do
5+
# Default config
6+
its('content') { should include '[admin]' }
7+
its('content') { should include 'bind-address = ":8083"' }
8+
end
9+
end
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
control 'InfluxDB package' do
2+
title 'should be installed'
3+
4+
describe package('influxdb') do
5+
it { should be_installed }
6+
end
7+
end
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
control 'InfluxDB service' do
2+
title 'should be running and enabled'
3+
4+
describe service('influxdb') do
5+
it { should be_enabled }
6+
it { should be_running }
7+
end
8+
9+
end

test/integration/default/inspec.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: default
3+
title: influxdb formula
4+
maintainer: SaltStack Formulas
5+
license: Apache-2.0
6+
summary: Verify that the influxdb formula is setup and configured correctly
7+
supports:
8+
- platform-name: debian
9+
- platform-name: ubuntu
10+
- platform-name: centos
11+
- platform-name: fedora
12+
- platform-name: opensuse
13+
- platform-name: suse
14+
- platform-name: freebsd
15+
- platform-name: amazon

test/integration/default/serverspec/influxdb_spec.rb

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)