Skip to content

Commit 992eb48

Browse files
committed
test(windows): add test suite for windows
1 parent b93e517 commit 992eb48

File tree

4 files changed

+87
-1
lines changed

4 files changed

+87
-1
lines changed

kitchen.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,4 +350,4 @@ suites:
350350
packages.sls: test/salt/pillar/windows.sls
351351
verifier:
352352
inspec_tests:
353-
- path: test/integration/default
353+
- path: test/integration/windows

test/integration/windows/README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# InSpec Profile: `windows`
2+
3+
This shows the implementation of the `windows` 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 windows
11+
Summary
12+
-------
13+
Location: windows
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 windows
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 windows --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: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# frozen_string_literal: true
2+
3+
pkgs_wanted = %w[adobereader Firefox jq notepadplusplus]
4+
pkgs_unwanted = %w[GoogleChrome hg]
5+
6+
### WANTED
7+
control 'Wanted packages' do
8+
title 'should be installed'
9+
10+
pkgs_wanted.each do |p|
11+
describe chocolatey_package(p) do
12+
it { should be_installed }
13+
end
14+
end
15+
end
16+
17+
### UNWANTED
18+
control 'Unwanted packages' do
19+
title 'should be uninstalled'
20+
21+
pkgs_unwanted.each do |p|
22+
describe chocolatey_package(p) do
23+
it { should_not be_installed }
24+
end
25+
end
26+
end
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
4+
name: windows
5+
title: packages formula
6+
maintainer: SaltStack Formulas
7+
license: Apache-2.0
8+
summary: Verify that the packages formula is setup and configured correctly (on Windows)
9+
supports:
10+
- platform: windows

0 commit comments

Comments
 (0)