fauxhai 4.0.0 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/PLATFORMS.md +211 -0
- data/README.md +19 -7
- data/Rakefile +16 -0
- data/lib/fauxhai/mocker.rb +1 -1
- data/lib/fauxhai/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64a12aa7bdeb2226e4d8a403a02e3db017321044
|
4
|
+
data.tar.gz: d99baceee5419cf1fa6660892724881f74124d5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 239c3052350447947256266a455f1bd5b9d99c57988a0833a6fe44f4bdcf28c66850a5f7c6f1a1a7a10a9fd99edb58d4eed37fb5c45accbff4b60f3e7ce42f69
|
7
|
+
data.tar.gz: 21e283c46705c9f19822f48f1f898c446c8cd025f7969072cdf281d60872ac82f11843524cfca40260815e23ff3279f3589a79f9f7a9c71b163ff6f181ffca69
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Fauxhai Changelog
|
2
2
|
|
3
|
+
## v4.0.1 (2017-03-09)
|
4
|
+
|
5
|
+
- Added a new platforms.md file in this repo that lists all current platforms and versions available. This is generated with a new Rake task
|
6
|
+
- Updated the error text received when no platform/version is specified to be more clear what fields are missing
|
7
|
+
|
3
8
|
## v4.0.0 (2017-03-06)
|
4
9
|
|
5
10
|
### New Platform Data
|
data/PLATFORMS.md
ADDED
@@ -0,0 +1,211 @@
|
|
1
|
+
## Fauxhai Platforms
|
2
|
+
|
3
|
+
This file lists each platform known to Fauxhai and the available versions for each of those platforms. See the ChefSpec documentation for mocking out platforms and platform versions within ChefSpec.
|
4
|
+
|
5
|
+
### aix
|
6
|
+
|
7
|
+
- 6.1
|
8
|
+
- 7.1
|
9
|
+
|
10
|
+
### amazon
|
11
|
+
|
12
|
+
- 2012.09
|
13
|
+
- 2013.09
|
14
|
+
- 2014.03
|
15
|
+
- 2014.09
|
16
|
+
- 2015.03
|
17
|
+
- 2015.09
|
18
|
+
- 2016.03
|
19
|
+
- 2016.09
|
20
|
+
|
21
|
+
### arch
|
22
|
+
|
23
|
+
- 4.5.4-1-ARCH
|
24
|
+
- 4.9.11-1-ARCH
|
25
|
+
|
26
|
+
### centos
|
27
|
+
|
28
|
+
- 5.0
|
29
|
+
- 5.1
|
30
|
+
- 5.10
|
31
|
+
- 5.11
|
32
|
+
- 5.2
|
33
|
+
- 5.3
|
34
|
+
- 5.4
|
35
|
+
- 5.5
|
36
|
+
- 5.6
|
37
|
+
- 5.7
|
38
|
+
- 5.8
|
39
|
+
- 5.9
|
40
|
+
- 6.0
|
41
|
+
- 6.1
|
42
|
+
- 6.2
|
43
|
+
- 6.3
|
44
|
+
- 6.4
|
45
|
+
- 6.5
|
46
|
+
- 6.6
|
47
|
+
- 6.7
|
48
|
+
- 6.8
|
49
|
+
- 7.0.1406
|
50
|
+
- 7.0
|
51
|
+
- 7.1.1503
|
52
|
+
- 7.2.1511
|
53
|
+
- 7.3.1611
|
54
|
+
|
55
|
+
### chefspec
|
56
|
+
|
57
|
+
- 0.6.1
|
58
|
+
|
59
|
+
### debian
|
60
|
+
|
61
|
+
- 7.0
|
62
|
+
- 7.1
|
63
|
+
- 7.10
|
64
|
+
- 7.11
|
65
|
+
- 7.2
|
66
|
+
- 7.4
|
67
|
+
- 7.5
|
68
|
+
- 7.6
|
69
|
+
- 7.7
|
70
|
+
- 7.8
|
71
|
+
- 7.9
|
72
|
+
- 8.0
|
73
|
+
- 8.1
|
74
|
+
- 8.2
|
75
|
+
- 8.4
|
76
|
+
- 8.5
|
77
|
+
- 8.6
|
78
|
+
- 8.7
|
79
|
+
|
80
|
+
### dragonfly4
|
81
|
+
|
82
|
+
- 4.2-RELEASE
|
83
|
+
|
84
|
+
### fedora
|
85
|
+
|
86
|
+
- 21
|
87
|
+
- 22
|
88
|
+
- 23
|
89
|
+
- 24
|
90
|
+
- 25
|
91
|
+
|
92
|
+
### freebsd
|
93
|
+
|
94
|
+
- 10.1
|
95
|
+
- 10.2
|
96
|
+
- 10.3
|
97
|
+
- 11.0
|
98
|
+
- 9.3
|
99
|
+
|
100
|
+
### gentoo
|
101
|
+
|
102
|
+
- 2.2
|
103
|
+
|
104
|
+
### ios_xr
|
105
|
+
|
106
|
+
- 6.0.0.14I
|
107
|
+
|
108
|
+
### mac_os_x
|
109
|
+
|
110
|
+
- 10.10
|
111
|
+
- 10.11.1
|
112
|
+
- 10.12
|
113
|
+
- 10.9.2
|
114
|
+
|
115
|
+
### nexus
|
116
|
+
|
117
|
+
- 5
|
118
|
+
|
119
|
+
### omnios
|
120
|
+
|
121
|
+
- 151014
|
122
|
+
- 151018
|
123
|
+
|
124
|
+
### openbsd
|
125
|
+
|
126
|
+
- 5.4
|
127
|
+
|
128
|
+
### opensuse
|
129
|
+
|
130
|
+
- 12.3
|
131
|
+
- 13.1
|
132
|
+
- 13.2
|
133
|
+
- 42.1
|
134
|
+
- 42.2
|
135
|
+
|
136
|
+
### oracle
|
137
|
+
|
138
|
+
- 5.10
|
139
|
+
- 5.8
|
140
|
+
- 6.5
|
141
|
+
- 6.6
|
142
|
+
- 6.8
|
143
|
+
- 7.0
|
144
|
+
- 7.1
|
145
|
+
- 7.2
|
146
|
+
|
147
|
+
### raspbian
|
148
|
+
|
149
|
+
- 8.0
|
150
|
+
|
151
|
+
### redhat
|
152
|
+
|
153
|
+
- 5.10
|
154
|
+
- 5.6
|
155
|
+
- 5.7
|
156
|
+
- 5.8
|
157
|
+
- 5.9
|
158
|
+
- 6.0
|
159
|
+
- 6.1
|
160
|
+
- 6.2
|
161
|
+
- 6.3
|
162
|
+
- 6.4
|
163
|
+
- 6.5
|
164
|
+
- 6.6
|
165
|
+
- 6.7
|
166
|
+
- 6.8
|
167
|
+
- 7.0
|
168
|
+
- 7.1
|
169
|
+
- 7.2
|
170
|
+
- 7.3
|
171
|
+
|
172
|
+
### slackware
|
173
|
+
|
174
|
+
- 14.1
|
175
|
+
|
176
|
+
### smartos
|
177
|
+
|
178
|
+
- 5.11
|
179
|
+
- joyent_20130111T180733Z
|
180
|
+
|
181
|
+
### solaris2
|
182
|
+
|
183
|
+
- 5.10
|
184
|
+
- 5.11
|
185
|
+
|
186
|
+
### suse
|
187
|
+
|
188
|
+
- 11.3
|
189
|
+
- 11.4
|
190
|
+
- 12.0
|
191
|
+
- 12.1
|
192
|
+
- 12.2
|
193
|
+
|
194
|
+
### ubuntu
|
195
|
+
|
196
|
+
- 12.04
|
197
|
+
- 14.04
|
198
|
+
- 15.04
|
199
|
+
- 15.10
|
200
|
+
- 16.04
|
201
|
+
|
202
|
+
### windows
|
203
|
+
|
204
|
+
- 10
|
205
|
+
- 2003R2
|
206
|
+
- 2008R2
|
207
|
+
- 2012
|
208
|
+
- 2012R2
|
209
|
+
- 7
|
210
|
+
- 8.1
|
211
|
+
- 8
|
data/README.md
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# Fauxhai
|
2
|
-
[![Build Status Master](https://travis-ci.org/customink/fauxhai.svg?branch=master)](https://travis-ci.org/customink/fauxhai)
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/fauxhai.svg)](https://badge.fury.io/rb/fauxhai)
|
4
2
|
|
5
|
-
|
3
|
+
[![Build Status Master](https://travis-ci.org/customink/fauxhai.svg?branch=master)](https://travis-ci.org/customink/fauxhai) [![Gem Version](https://badge.fury.io/rb/fauxhai.svg)](https://badge.fury.io/rb/fauxhai)
|
4
|
+
|
5
|
+
Fauxhai is a gem for mocking out [ohai](https://github.com/chef/ohai) data in your chef testing. Fauxhai is community supported, so we need **your help** to populate our dataset. Here's an example for testing my "awesome_cookbook" on Ubuntu 16.04:
|
6
6
|
|
7
7
|
```ruby
|
8
8
|
require 'chefspec'
|
9
9
|
|
10
10
|
describe 'awesome_cookbook::default' do
|
11
11
|
before do
|
12
|
-
Fauxhai.mock(platform: 'ubuntu', version: '
|
12
|
+
Fauxhai.mock(platform: 'ubuntu', version: '16.04')
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'should install awesome' do
|
@@ -36,10 +36,10 @@ describe 'awesome_cookbook::default' do
|
|
36
36
|
end
|
37
37
|
```
|
38
38
|
|
39
|
-
Fauxhai supports [ChefSpec](https://github.com/sethvargo/chefspec) and [rspec-chef](https://github.com/calavera/rspec-chef). In order to prevent polluting the README, only ChefSpec examples will be provided. However, there is an extensive README for each testing framework in the [examples](https://github.com/customink/fauxhai/tree/master/examples) directory.
|
40
|
-
|
41
39
|
## Important Note
|
40
|
+
|
42
41
|
Fauxhai ships with a command line tool - `fauxhai`. This is **not** the same as Fauxhai.mock. Running `fauxhai` on a machine effectively runs `ohai`, but then sanitizes the data, removing/replacing things like:
|
42
|
+
|
43
43
|
- users
|
44
44
|
- ssh keys
|
45
45
|
- usernames in paths
|
@@ -47,10 +47,16 @@ Fauxhai ships with a command line tool - `fauxhai`. This is **not** the same as
|
|
47
47
|
|
48
48
|
`fauxhai` should only be used by developers wishing to submit a new json file.
|
49
49
|
|
50
|
+
## Platform and Versions
|
51
|
+
|
52
|
+
For a complete list of platforms and versions available for mocking via Fauxhai see [PLATFORMS.MD](https://github.com/sethvargo/chefspec/blob/master/README.md) in this repository.
|
53
|
+
|
50
54
|
## Usage
|
51
|
-
|
55
|
+
|
56
|
+
Fauxhai provides a bunch of default attributes so that you don't need to mock out your entire infrastructure to write a simple test. That being said, not all configurations will suit your needs. Because of that, Fauxhai provides two ways to configure your mocks:
|
52
57
|
|
53
58
|
### Overriding
|
59
|
+
|
54
60
|
`Fauxhai.mock` will also accept a block with override attributes that are merged with all the default attributes. For example, the default Ubutnu 12.04 mock uses `Ruby 1.9.3`. Maybe your system is using `ree`, and you want to verify that the cookbooks work with that data as well:
|
55
61
|
|
56
62
|
```ruby
|
@@ -73,6 +79,7 @@ end
|
|
73
79
|
The `node` block variable allows you to set any Ohai attribute on the mock that you want. This provides an easy way to manage your environments. If you find that you are overridding attributes like OS or platform, you should see the section on Contributing.
|
74
80
|
|
75
81
|
### Fetching
|
82
|
+
|
76
83
|
Alternatively, if you do not want to mock the data, Fauxhai provides a `fetch` mechanism for collecting "real" ohai data from a remote server or local file. Maybe you want to test against the fully-replicated environment for a front-facing server in your pool. Just pass in the `url` option instead of a `platform`:
|
77
84
|
|
78
85
|
The `fetch` method supports all the same options as the Net-SSH command, such as `:user`, `:password`, `:key_file`, etc.
|
@@ -97,6 +104,7 @@ end
|
|
97
104
|
This will ssh into the machine (you must have authorization to run `sudo ohai` on that machine), download a copy of the ohai output, and optionally cache that data inside the test directory (speeding up future tests).
|
98
105
|
|
99
106
|
### Overriding + Fetching
|
107
|
+
|
100
108
|
As you might expect, you can combine overriding and fetching like so:
|
101
109
|
|
102
110
|
```ruby
|
@@ -117,6 +125,7 @@ end
|
|
117
125
|
```
|
118
126
|
|
119
127
|
### Fixturing
|
128
|
+
|
120
129
|
If you want to use fauxhai as "fixture" data, you can store real JSON in your project and use the `:path` option:
|
121
130
|
|
122
131
|
```ruby
|
@@ -130,6 +139,7 @@ end
|
|
130
139
|
```
|
131
140
|
|
132
141
|
### Overriding + Fixturing
|
142
|
+
|
133
143
|
You can also change specific attributes in your fixture:
|
134
144
|
|
135
145
|
```ruby
|
@@ -145,6 +155,7 @@ end
|
|
145
155
|
```
|
146
156
|
|
147
157
|
## Testing Multiple Versions
|
158
|
+
|
148
159
|
It's a common use case to test multiple version of the same operating system. Here's a simple example to get your started. This is more rspec-related that fauxhai related, but here ya go:
|
149
160
|
|
150
161
|
```ruby
|
@@ -167,4 +178,5 @@ end
|
|
167
178
|
```
|
168
179
|
|
169
180
|
## Contributing
|
181
|
+
|
170
182
|
See [CONTRIBUTING.md](https://github.com/customink/fauxhai/blob/master/CONTRIBUTING.md).
|
data/Rakefile
CHANGED
@@ -20,3 +20,19 @@ namespace :validate do
|
|
20
20
|
puts 'JSON files validated'
|
21
21
|
end
|
22
22
|
end
|
23
|
+
|
24
|
+
namespace :documentation do
|
25
|
+
desc 'Update the PLATFORMS.md file with a list of all platforms'
|
26
|
+
task :update_platforms do
|
27
|
+
File.delete('PLATFORMS.md') if File.exist?('PLATFORMS.md')
|
28
|
+
f = File.new('PLATFORMS.md', 'w')
|
29
|
+
f.write "## Fauxhai Platforms\n\nThis file lists each platform known to Fauxhai and the available versions for each of those platforms. See the ChefSpec documentation for mocking out platforms and platform versions within ChefSpec.\n"
|
30
|
+
Dir.glob('./lib/fauxhai/platforms/**') do |platform_path|
|
31
|
+
f.write "\n### #{platform_path.split('/')[-1]}\n\n"
|
32
|
+
Dir.glob(File.join(platform_path, '**.json')).each do |version_path|
|
33
|
+
f.write " - #{version_path.split('/')[-1].chomp('.json')}\n"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
f.close
|
37
|
+
end
|
38
|
+
end
|
data/lib/fauxhai/mocker.rb
CHANGED
@@ -80,7 +80,7 @@ module Fauxhai
|
|
80
80
|
|
81
81
|
def platform
|
82
82
|
@options[:platform] ||= begin
|
83
|
-
STDERR.puts "WARNING: you must specify a platform and
|
83
|
+
STDERR.puts "WARNING: you must specify a 'platform' and 'version' to your ChefSpec Runner and/or Fauxhai constructor, in the future omitting these will become a hard error"
|
84
84
|
'chefspec'
|
85
85
|
end
|
86
86
|
end
|
data/lib/fauxhai/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fauxhai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seth Vargo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- CONTRIBUTING.md
|
81
81
|
- Gemfile
|
82
82
|
- LICENSE
|
83
|
+
- PLATFORMS.md
|
83
84
|
- README.md
|
84
85
|
- Rakefile
|
85
86
|
- bin/fauxhai
|