Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Commit

Permalink
Merge pull request #6 from opscode/CC-44
Browse files Browse the repository at this point in the history
CC-44: Verify chef-dk gem during "chef verify"
  • Loading branch information
Serdar Sutay committed Mar 11, 2014
2 parents 6bc803d + f57b617 commit f235dd4
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
4 changes: 3 additions & 1 deletion chef-dk.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ Gem::Specification.new do |gem|

gem.required_ruby_version = '>= 2.0'

gem.files = `git ls-files`.split($/)
gem.files = %w(Rakefile LICENSE README.md CONTRIBUTING.md) + Dir.glob("{lib,spec}/**/*", File::FNM_DOTMATCH).reject do |f|
File.directory?(f)
end
gem.executables = %w( chef )
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]
Expand Down
8 changes: 7 additions & 1 deletion lib/chef-dk/command/verify.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ def components
:base_dir => "chef",
:test_cmd => "bundle exec rspec"

component "chef-dk",
:base_dir => "chef-dk",
:test_cmd => "bundle exec rspec"

attr_reader :omnibus_dir
attr_reader :verification_threads
Expand Down Expand Up @@ -111,10 +114,13 @@ def invoke_tests
components.each do |component, component_info|
# Run the component specs in parallel
verification_threads << Thread.new do
bin_path = File.expand_path(File.join(omnibus_dir, "..", "bin"))
result = system_command component_info[:test_cmd],
:cwd => component_path(component_info),
:env => {
"PATH" => "#{File.join(omnibus_dir, "bin")}:#{ENV['PATH']}"
# Add the embedded/bin to the PATH so that bundle executable can
# be found while running the tests.
"PATH" => "#{bin_path}:#{ENV['PATH']}"
},
:timeout => 3600

Expand Down
4 changes: 4 additions & 0 deletions spec/unit/command/verify_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ def stdout
run_command(0)
end

it "should have embedded/bin on the PATH" do
expect(stdout).to include(File.join(fixtures_path, "eg_omnibus_dir/valid/embedded/bin"))
end

it "should report the success of the command" do
expect(stdout).to include("Verification of component 'successful_comp' succeeded.")
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
echo $PATH

echo "you are good to go..."
Empty file.

0 comments on commit f235dd4

Please sign in to comment.