fauxhai 6.9.1 → 6.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/.DS_Store +0 -0
- data/lib/fauxhai/.DS_Store +0 -0
- data/lib/fauxhai/platforms/.DS_Store +0 -0
- data/lib/fauxhai/platforms/aix/.DS_Store +0 -0
- data/lib/fauxhai/platforms/amazon/.DS_Store +0 -0
- data/lib/fauxhai/platforms/amazon/2.json +1351 -1273
- data/lib/fauxhai/platforms/amazon/2014.09.json +164 -164
- data/lib/fauxhai/platforms/amazon/2015.03.json +108 -108
- data/lib/fauxhai/platforms/amazon/2015.09.json +102 -102
- data/lib/fauxhai/platforms/amazon/2016.03.json +99 -99
- data/lib/fauxhai/platforms/amazon/2016.09.json +88 -88
- data/lib/fauxhai/platforms/amazon/2017.03.json +80 -80
- data/lib/fauxhai/platforms/amazon/2017.09.json +70 -70
- data/lib/fauxhai/platforms/amazon/2018.03.json +528 -507
- data/lib/fauxhai/platforms/centos/.DS_Store +0 -0
- data/lib/fauxhai/platforms/centos/6.9.json +30 -30
- data/lib/fauxhai/platforms/centos/7.4.1708.json +43 -43
- data/lib/fauxhai/platforms/debian/.DS_Store +0 -0
- data/lib/fauxhai/platforms/debian/8.7.json +29 -29
- data/lib/fauxhai/platforms/debian/9.0.json +40 -40
- data/lib/fauxhai/platforms/debian/9.1.json +40 -41
- data/lib/fauxhai/platforms/debian/9.2.json +40 -40
- data/lib/fauxhai/platforms/debian/9.3.json +49 -49
- data/lib/fauxhai/platforms/debian/9.4.json +42 -42
- data/lib/fauxhai/platforms/debian/9.5.json +40 -40
- data/lib/fauxhai/platforms/fedora/.DS_Store +0 -0
- data/lib/fauxhai/platforms/fedora/24.json +37 -37
- data/lib/fauxhai/platforms/fedora/25.json +39 -39
- data/lib/fauxhai/platforms/fedora/26.json +38 -38
- data/lib/fauxhai/platforms/fedora/27.json +39 -39
- data/lib/fauxhai/platforms/fedora/28.json +555 -554
- data/lib/fauxhai/platforms/fedora/29.json +3824 -0
- data/lib/fauxhai/platforms/freebsd/.DS_Store +0 -0
- data/lib/fauxhai/platforms/ios_xr/6.0.0.14I.json +1 -1
- data/lib/fauxhai/platforms/mac_os_x/.DS_Store +0 -0
- data/lib/fauxhai/platforms/nexus/5.json +1 -1
- data/lib/fauxhai/platforms/omnios/151018.json +1 -1
- data/lib/fauxhai/platforms/openbsd/.DS_Store +0 -0
- data/lib/fauxhai/platforms/opensuse/.DS_Store +0 -0
- data/lib/fauxhai/platforms/opensuse/42.2.json +41 -41
- data/lib/fauxhai/platforms/opensuse/42.3.json +56 -98
- data/lib/fauxhai/platforms/oracle/.DS_Store +0 -0
- data/lib/fauxhai/platforms/redhat/.DS_Store +0 -0
- data/lib/fauxhai/platforms/redhat/6.8.json +37 -37
- data/lib/fauxhai/platforms/redhat/6.9.json +38 -38
- data/lib/fauxhai/platforms/redhat/7.2.json +39 -40
- data/lib/fauxhai/platforms/redhat/7.3.json +43 -43
- data/lib/fauxhai/platforms/redhat/7.4.json +42 -42
- data/lib/fauxhai/platforms/redhat/7.5.json +45 -45
- data/lib/fauxhai/platforms/solaris2/.DS_Store +0 -0
- data/lib/fauxhai/platforms/suse/.DS_Store +0 -0
- data/lib/fauxhai/platforms/suse/11.4.json +42 -42
- data/lib/fauxhai/platforms/suse/12.1.json +30 -30
- data/lib/fauxhai/platforms/suse/12.2.json +117 -77
- data/lib/fauxhai/platforms/suse/12.3.json +38 -38
- data/lib/fauxhai/platforms/ubuntu/.DS_Store +0 -0
- data/lib/fauxhai/platforms/ubuntu/14.04.json +126 -122
- data/lib/fauxhai/platforms/ubuntu/16.04.json +221 -217
- data/lib/fauxhai/platforms/ubuntu/18.04.json +248 -245
- data/lib/fauxhai/platforms/windows/.DS_Store +0 -0
- data/lib/fauxhai/version.rb +1 -1
- metadata +24 -7
- data/CHANGELOG.md +0 -605
- data/README.md +0 -196
- data/fauxhai.gemspec +0 -29
- data/tmp/.gitkeep +0 -0
data/README.md
DELETED
@@ -1,196 +0,0 @@
|
|
1
|
-
# Fauxhai
|
2
|
-
|
3
|
-
[![Build Status Master](https://travis-ci.org/chefspec/fauxhai.svg?branch=master)](https://travis-ci.org/chefspec/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
|
-
|
7
|
-
```ruby
|
8
|
-
require 'chefspec'
|
9
|
-
|
10
|
-
describe 'awesome_cookbook::default' do
|
11
|
-
before do
|
12
|
-
Fauxhai.mock(platform: 'ubuntu', version: '16.04')
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should install awesome' do
|
16
|
-
@runner = ChefSpec::ChefRunner.new.converge('tmpreaper::default')
|
17
|
-
@runner.should install_package 'awesome'
|
18
|
-
end
|
19
|
-
end
|
20
|
-
```
|
21
|
-
|
22
|
-
Alternatively, you can pull "real" Ohai data from an existing server:
|
23
|
-
|
24
|
-
```ruby
|
25
|
-
require 'chefspec'
|
26
|
-
|
27
|
-
describe 'awesome_cookbook::default' do
|
28
|
-
before do
|
29
|
-
Fauxhai.fetch(host: 'server01.example.com')
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'should install awesome' do
|
33
|
-
@runner = ChefSpec::ChefRunner.new.converge('tmpreaper::default')
|
34
|
-
@runner.should install_package 'awesome'
|
35
|
-
end
|
36
|
-
end
|
37
|
-
```
|
38
|
-
|
39
|
-
## Important Note
|
40
|
-
|
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
|
-
- users
|
44
|
-
- ssh keys
|
45
|
-
- usernames in paths
|
46
|
-
- sensitive system information
|
47
|
-
|
48
|
-
`fauxhai` should only be used by developers wishing to submit a new json file.
|
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/chefspec/fauxhai/blob/master/PLATFORMS.md) in this repository.
|
53
|
-
|
54
|
-
## Usage
|
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:
|
57
|
-
|
58
|
-
### Overriding
|
59
|
-
|
60
|
-
`Fauxhai.mock` will also accept a block with override attributes that are merged with all the default attributes. For example, the default Ubuntu 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:
|
61
|
-
|
62
|
-
```ruby
|
63
|
-
require 'chefspec'
|
64
|
-
|
65
|
-
describe 'awesome_cookbook::default' do
|
66
|
-
before do
|
67
|
-
Fauxhai.mock(platform: 'ubuntu', version: '12.04') do |node|
|
68
|
-
node['languages']['ruby']['version'] = 'ree'
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'should install awesome' do
|
73
|
-
@runner = ChefSpec::ChefRunner.new.converge('tmpreaper::default')
|
74
|
-
@runner.should install_package 'awesome'
|
75
|
-
end
|
76
|
-
end
|
77
|
-
```
|
78
|
-
|
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 overriding attributes like OS or platform, you should see the section on Contributing.
|
80
|
-
|
81
|
-
### Fetching
|
82
|
-
|
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`:
|
84
|
-
|
85
|
-
The `fetch` method supports all the same options as the Net-SSH command, such as `:user`, `:password`, `:key_file`, etc.
|
86
|
-
|
87
|
-
The `fetch` method will cache the JSON file in a temporary path on your local machine. Similar to gems like VCR, this allows Fauxhai to use the cached copy, making your test suite run faster. You can optionally force a cache miss by passing the `:force_cache_miss => true` option to the `fetch` initializer. **Because this is real data, there may be a security concern. Secure your laptop accordingly.**
|
88
|
-
|
89
|
-
```ruby
|
90
|
-
require 'chefspec'
|
91
|
-
|
92
|
-
describe 'awesome_cookbook::default' do
|
93
|
-
before do
|
94
|
-
Fauxhai.fetch(host: 'server01.example.com')
|
95
|
-
end
|
96
|
-
|
97
|
-
it 'should install awesome' do
|
98
|
-
@runner = ChefSpec::ChefRunner.new.converge('tmpreaper::default')
|
99
|
-
@runner.should install_package 'awesome'
|
100
|
-
end
|
101
|
-
end
|
102
|
-
```
|
103
|
-
|
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).
|
105
|
-
|
106
|
-
### Overriding + Fetching
|
107
|
-
|
108
|
-
As you might expect, you can combine overriding and fetching like so:
|
109
|
-
|
110
|
-
```ruby
|
111
|
-
require 'chefspec'
|
112
|
-
|
113
|
-
describe 'awesome_cookbook::default' do
|
114
|
-
before do
|
115
|
-
Fauxhai.fetch(host: 'server01.example.com') do |node|
|
116
|
-
node['languages']['ruby']['version'] = 'ree'
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
it 'should install awesome' do
|
121
|
-
@runner = ChefSpec::ChefRunner.new.converge('tmpreaper::default')
|
122
|
-
@runner.should install_package 'awesome'
|
123
|
-
end
|
124
|
-
end
|
125
|
-
```
|
126
|
-
|
127
|
-
### Fixturing
|
128
|
-
|
129
|
-
If you want to use Fauxhai as "fixture" data, you can store real JSON in your project and use the `:path` option:
|
130
|
-
|
131
|
-
```ruby
|
132
|
-
require 'chefspec'
|
133
|
-
|
134
|
-
describe 'awesome_cookbook::default' do
|
135
|
-
before do
|
136
|
-
Fauxhai.mock(path: 'fixtures/my_node.json')
|
137
|
-
end
|
138
|
-
end
|
139
|
-
```
|
140
|
-
|
141
|
-
### Overriding + Fixturing
|
142
|
-
|
143
|
-
You can also change specific attributes in your fixture:
|
144
|
-
|
145
|
-
```ruby
|
146
|
-
require 'chefspec'
|
147
|
-
|
148
|
-
describe 'awesome_cookbook::default' do
|
149
|
-
before do
|
150
|
-
Fauxhai.mock(path: 'fixtures/my_node.json') do |node|
|
151
|
-
node['languages']['ruby']['version'] = 'ree'
|
152
|
-
end
|
153
|
-
end
|
154
|
-
end
|
155
|
-
```
|
156
|
-
|
157
|
-
### Disabling Fetching from Github
|
158
|
-
|
159
|
-
On environments that does not have access to the internet, you can disable fetching Fauxhai data from GitHub as follow:
|
160
|
-
|
161
|
-
```ruby
|
162
|
-
require 'chefspec'
|
163
|
-
|
164
|
-
describe 'awesome_cookbook::default' do
|
165
|
-
before do
|
166
|
-
Fauxhai.mock(platform: 'ubuntu', version: '12.04', github_fetching: false)
|
167
|
-
end
|
168
|
-
end
|
169
|
-
```
|
170
|
-
|
171
|
-
## Testing Multiple Versions
|
172
|
-
|
173
|
-
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:
|
174
|
-
|
175
|
-
```ruby
|
176
|
-
require 'chefspec'
|
177
|
-
|
178
|
-
describe 'awesome_cookbook::default' do
|
179
|
-
['14.04', '16.04'].each do |version|
|
180
|
-
context "on Ubuntu #{version}" do
|
181
|
-
before do
|
182
|
-
Fauxhai.mock(platform: 'ubuntu', version: version)
|
183
|
-
end
|
184
|
-
|
185
|
-
it 'should install awesome' do
|
186
|
-
@runner = ChefSpec::ChefRunner.new.converge('tmpreaper::default')
|
187
|
-
@runner.should install_package 'awesome'
|
188
|
-
end
|
189
|
-
end
|
190
|
-
end
|
191
|
-
end
|
192
|
-
```
|
193
|
-
|
194
|
-
## Contributing
|
195
|
-
|
196
|
-
See [CONTRIBUTING.md](https://github.com/chefspec/fauxhai/blob/master/CONTRIBUTING.md).
|
data/fauxhai.gemspec
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
lib = File.expand_path('../lib', __FILE__)
|
2
|
-
$:.unshift(lib) unless $:.include?(lib)
|
3
|
-
require 'fauxhai/version'
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = 'fauxhai'
|
7
|
-
spec.version = Fauxhai::VERSION
|
8
|
-
spec.authors = ['Seth Vargo']
|
9
|
-
spec.email = ['sethvargo@gmail.com']
|
10
|
-
spec.description = 'Easily mock out ohai data'
|
11
|
-
spec.summary = 'Fauxhai provides an easy way to mock out your ohai data for testing with chefspec!'
|
12
|
-
spec.homepage = 'https://github.com/chefspec/fauxhai'
|
13
|
-
spec.license = 'MIT'
|
14
|
-
|
15
|
-
spec.required_ruby_version = '>= 2.2.2'
|
16
|
-
|
17
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(\..*|Gemfile|Rakefile|CONTRIBUTING.md|PLATFORMS.md|examples|spec)}) }
|
18
|
-
spec.executables = spec.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
19
|
-
spec.test_files = spec.files.grep(%r{^(test|spec)/})
|
20
|
-
spec.require_paths = ['lib']
|
21
|
-
|
22
|
-
spec.add_runtime_dependency 'net-ssh'
|
23
|
-
|
24
|
-
spec.add_development_dependency 'chef', '>= 12.0'
|
25
|
-
spec.add_development_dependency 'ohai', '>= 8.5'
|
26
|
-
spec.add_development_dependency 'rake'
|
27
|
-
spec.add_development_dependency 'rspec', '~> 3.7'
|
28
|
-
spec.add_development_dependency 'rspec-its', '~> 1.2'
|
29
|
-
end
|
data/tmp/.gitkeep
DELETED
File without changes
|