minitest-chef-handler 0.6.9 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/.gitignore +1 -1
  2. data/.travis.yml +4 -0
  3. data/Appraisals +7 -0
  4. data/Berksfile +4 -0
  5. data/Gemfile +3 -0
  6. data/History.txt +6 -0
  7. data/README.md +23 -17
  8. data/Rakefile +7 -3
  9. data/Vagrantfile +17 -4
  10. data/examples/spec_examples/files/default/tests/minitest/{example_test.rb → default_test.rb} +15 -21
  11. data/examples/spec_examples/metadata.rb +1 -0
  12. data/gemfiles/chef_10.gemfile +8 -0
  13. data/gemfiles/chef_11.gemfile +8 -0
  14. data/lib/minitest-chef-handler/assertions.rb +41 -0
  15. data/lib/minitest-chef-handler/ci_runner.rb +1 -0
  16. data/lib/minitest-chef-handler/resources.rb +10 -4
  17. data/minitest-chef-handler.gemspec +8 -3
  18. data/spec/minitest-chef-handler/assertions_spec.rb +158 -4
  19. data/spec/minitest-chef-handler/resources_spec.rb +25 -4
  20. data/spec/spec_helper.rb +7 -3
  21. metadata +95 -23
  22. data/examples/chef-handler-cookbook/cookbooks/chef_handler/README.md +0 -115
  23. data/examples/chef-handler-cookbook/cookbooks/chef_handler/attributes/default.rb +0 -21
  24. data/examples/chef-handler-cookbook/cookbooks/chef_handler/files/default/handlers/README +0 -1
  25. data/examples/chef-handler-cookbook/cookbooks/chef_handler/metadata.json +0 -29
  26. data/examples/chef-handler-cookbook/cookbooks/chef_handler/metadata.rb +0 -6
  27. data/examples/chef-handler-cookbook/cookbooks/chef_handler/providers/default.rb +0 -83
  28. data/examples/chef-handler-cookbook/cookbooks/chef_handler/recipes/default.rb +0 -31
  29. data/examples/chef-handler-cookbook/cookbooks/chef_handler/recipes/json_file.rb +0 -28
  30. data/examples/chef-handler-cookbook/cookbooks/chef_handler/recipes/minitest.rb +0 -24
  31. data/examples/chef-handler-cookbook/cookbooks/chef_handler/resources/default.rb +0 -34
  32. data/examples/simple-solo/cookbooks/foo/recipes/default.rb +0 -1
  33. data/examples/simple-solo/cookbooks/foo/test/test_foo.rb +0 -9
  34. data/examples/simple-solo/dna.json +0 -3
  35. data/examples/simple-solo/solo.rb +0 -10
  36. data/examples/simple-solo/spec/foo_spec.rb +0 -9
  37. data/examples/simple-solo/test/test_foo.rb +0 -9
  38. data/gemfile_chef_10 +0 -3
  39. data/gemfile_chef_11 +0 -4
  40. data/script/bootstrap +0 -11
  41. data/script/test +0 -28
@@ -1,31 +0,0 @@
1
- #
2
- # Author:: Seth Chisamore (<schisamo@opscode.com>)
3
- # Cookbook Name:: chef_handlers
4
- # Recipe:: default
5
- #
6
- # Copyright 2011, Opscode, Inc.
7
- #
8
- # Licensed under the Apache License, Version 2.0 (the "License");
9
- # you may not use this file except in compliance with the License.
10
- # You may obtain a copy of the License at
11
- #
12
- # http://www.apache.org/licenses/LICENSE-2.0
13
- #
14
- # Unless required by applicable law or agreed to in writing, software
15
- # distributed under the License is distributed on an "AS IS" BASIS,
16
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- # See the License for the specific language governing permissions and
18
- # limitations under the License.
19
- #
20
-
21
- Chef::Log.info("Chef Handlers will be at: #{node['chef_handler']['handler_path']}")
22
-
23
- remote_directory node['chef_handler']['handler_path'] do
24
- source 'handlers'
25
- owner 'root'
26
- group 'root'
27
- mode "0755"
28
- recursive true
29
- action :nothing
30
- end.run_action(:create)
31
-
@@ -1,28 +0,0 @@
1
- #
2
- # Author:: Seth Chisamore (<schisamo@opscode.com>)
3
- # Cookbook Name:: chef_handlers
4
- # Recipe:: json_file
5
- #
6
- # Copyright 2011, Opscode, Inc.
7
- #
8
- # Licensed under the Apache License, Version 2.0 (the "License");
9
- # you may not use this file except in compliance with the License.
10
- # You may obtain a copy of the License at
11
- #
12
- # http://www.apache.org/licenses/LICENSE-2.0
13
- #
14
- # Unless required by applicable law or agreed to in writing, software
15
- # distributed under the License is distributed on an "AS IS" BASIS,
16
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- # See the License for the specific language governing permissions and
18
- # limitations under the License.
19
- #
20
-
21
- # force resource actions in compile phase so exception handler
22
- # fires for compile phase exceptions
23
-
24
- chef_handler "Chef::Handler::JsonFile" do
25
- source "chef/handler/json_file"
26
- arguments :path => '/var/chef/reports'
27
- action :nothing
28
- end.run_action(:enable)
@@ -1,24 +0,0 @@
1
- gem_package "minitest" do
2
- action :nothing
3
- end.run_action(:upgrade)
4
-
5
- gem_package "minitest-chef-handler" do
6
- action :nothing
7
- end.run_action(:upgrade)
8
-
9
- require 'rubygems'
10
- Gem.clear_paths
11
- require 'minitest-chef-handler'
12
-
13
- path = File.join(Chef::Config[:cookbook_path],
14
- "**",
15
- "test",
16
- "test_*.rb")
17
-
18
- Chef::Log.info "path is #{path}, entries: #{Dir.glob(path).entries}"
19
-
20
- chef_handler "MiniTest::Chef::Handler" do
21
- source "minitest-chef-handler"
22
- arguments :path => path
23
- action :nothing
24
- end.run_action(:enable)
@@ -1,34 +0,0 @@
1
- #
2
- # Author:: Seth Chisamore <schisamo@opscode.com>
3
- # Cookbook Name:: chef_handler
4
- # Resource:: default
5
- #
6
- # Copyright:: 2011, Opscode, Inc <legal@opscode.com>
7
- #
8
- # Licensed under the Apache License, Version 2.0 (the "License");
9
- # you may not use this file except in compliance with the License.
10
- # You may obtain a copy of the License at
11
- #
12
- # http://www.apache.org/licenses/LICENSE-2.0
13
- #
14
- # Unless required by applicable law or agreed to in writing, software
15
- # distributed under the License is distributed on an "AS IS" BASIS,
16
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- # See the License for the specific language governing permissions and
18
- # limitations under the License.
19
- #
20
-
21
- actions :enable, :disable
22
-
23
- attribute :class_name, :kind_of => String, :name_attribute => true
24
- attribute :source, :default => nil, :kind_of => String
25
- attribute :arguments, :default => []
26
- attribute :supports, :kind_of => Hash, :default => {:report => true, :exception => true}
27
-
28
- # we have to set default for the supports attribute
29
- # in initializer since it is a 'reserved' attribute name
30
- def initialize(*args)
31
- super
32
- @action = :enable
33
- @supports = {:report => true, :exception => true}
34
- end
@@ -1 +0,0 @@
1
- file '/tmp/temporal_file'
@@ -1,9 +0,0 @@
1
- class FooTest < MiniTest::Chef::TestCase
2
- def test_exist_file
3
- assert File.exist?('/tmp/temporal_file')
4
- end
5
-
6
- def test_succeed
7
- assert run_status.success?
8
- end
9
- end
@@ -1,3 +0,0 @@
1
- {
2
- "run_list": [ "recipe[foo]" ]
3
- }
@@ -1,10 +0,0 @@
1
- require 'minitest-chef-handler'
2
-
3
- path = File.expand_path('{test/test_*,spec/*_spec}.rb', File.dirname(__FILE__))
4
- cache = File.expand_path('cache', File.dirname(__FILE__))
5
-
6
- report_handlers << MiniTest::Chef::Handler.new(:path => path)
7
- cookbook_path File.expand_path('cookbooks', File.dirname(__FILE__))
8
- log_location 'chef.log'
9
- cache_options({ :path => cache, :skip_expires => true })
10
- file_cache_path cache
@@ -1,9 +0,0 @@
1
- describe_recipe 'foo' do
2
- it 'creates the temporal file' do
3
- File.exist?('/tmp/temporal_file').must_equal true
4
- end
5
-
6
- it "succeed" do
7
- run_status.success?.must_equal true
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- class FooTest < MiniTest::Chef::TestCase
2
- def test_exist_file
3
- assert File.exist?('/tmp/temporal_file')
4
- end
5
-
6
- def test_succeed
7
- assert run_status.success?
8
- end
9
- end
data/gemfile_chef_10 DELETED
@@ -1,3 +0,0 @@
1
- source 'http://rubygems.org'
2
- gemspec
3
- gem 'chef', '~> 10.8'
data/gemfile_chef_11 DELETED
@@ -1,4 +0,0 @@
1
- source 'http://rubygems.org'
2
- gemspec
3
- gem 'chef', '~> 11'
4
-
data/script/bootstrap DELETED
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- puts "-> Configuring Bundler with Chef 10 dependency."
4
- ENV['BUNDLE_GEMFILE'] = File.expand_path('../../gemfile_chef_10', __FILE__)
5
-
6
- system "bundle", "install"
7
-
8
- puts "-> Configuring Bundler with Chef 11 dependency."
9
- ENV['BUNDLE_GEMFILE'] = File.expand_path('../../gemfile_chef_11', __FILE__)
10
-
11
- system "bundle", "install"
data/script/test DELETED
@@ -1,28 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- ROOT = File.expand_path('../..', __FILE__)
4
-
5
- def test_all
6
- Bundler.setup(:default)
7
-
8
- system "bundle exec rake spec"
9
-
10
- Dir.chdir('examples/simple-solo') do
11
- system "bundle exec ruby -I#{File.expand_path('lib', ROOT)} -S chef-solo -c solo.rb -j dna.json"
12
- end
13
- end
14
-
15
- puts '-> Testing with Chef 10'
16
-
17
- ENV['BUNDLE_GEMFILE'] = File.expand_path('gemfile_chef_10', ROOT)
18
-
19
- require "rubygems"
20
- require "bundler/setup"
21
-
22
- test_all
23
-
24
- puts '-> Testing with Chef 11'
25
-
26
- ENV['BUNDLE_GEMFILE'] = File.expand_path('gemfile_chef_11', ROOT)
27
-
28
- test_all