1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#!/usr/bin/env ruby
require 'bundler'
require 'bundler/setup'
require 'chef_zero/server'
require 'rspec/core'
tmpdir = nil
begin
if ENV['FILE_STORE']
require 'tmpdir'
require 'chef_zero/data_store/raw_file_store'
tmpdir = Dir.mktmpdir
data_store = ChefZero::DataStore::RawFileStore.new(tmpdir, true)
data_store = ChefZero::DataStore::DefaultFacade.new(data_store, false, false)
server = ChefZero::Server.new(:port => 8889, :single_org => false, :data_store => data_store)
server.start_background
else
server = ChefZero::Server.new(:port => 8889, :single_org => false)#, :log_level => :debug)
server.start_background
end
require 'rspec/core'
require 'pedant'
require 'pedant/organization'
# Pedant::Config.rerun = true
Pedant.config.suite = 'api'
Pedant.config.internal_server = Pedant::Config.search_server = 'http://localhost:8889'
# see dummy_endpoint.rb.
Pedant.config.search_commit_url = "/dummy"
Pedant::Config.search_url_fmt = "/dummy?fq=+X_CHEF_type_CHEF_X:%{type}&q=%{query}&wt=json"
Pedant.config[:config_file] = 'spec/support/oc_pedant.rb'
Pedant.config[:server_api_version] = 0
# "the goal is that only authorization, authentication and validation tests are turned off" - @jkeiser
Pedant.setup([
'--skip-knife',
'--skip-keys',
'--skip-controls',
'--skip-acl',
'--skip-validation',
'--skip-authentication',
'--skip-authorization',
'--skip-omnibus',
'--skip-usags',
'--exclude-internal-orgs',
'--skip-headers',
# Chef 12 features not yet 100% supported by Chef Zero
'--skip-cookbook-artifacts',
'--skip-containers',
'--skip-api-v1'
])
result = RSpec::Core::Runner.run(Pedant.config.rspec_args)
server.stop if server.running?
ensure
FileUtils.remove_entry_secure(tmpdir) if tmpdir
end
exit(result)
|