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 #1415 from chef/nathen/they_are_integration_tests
Browse files Browse the repository at this point in the history
They are integration tests, not smoke tests
  • Loading branch information
tas50 authored Nov 30, 2017
2 parents 4d1275a + 3d09730 commit 127ecf2
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 25 deletions.
7 changes: 6 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# ChefDK 2.4 Release Notes

## Rename `smoke` tests to `integration` tests.

The cookbook, recipe, and app generators now name the test directory
`integration` instead of `smoke`.

## Improved Performance Downloading Cookbooks from a Chef Server

Policyfile users who use a Chef Server as a cookbook source will
Expand Down Expand Up @@ -84,7 +89,7 @@ Lockfile written to /home/jaym/workspace/chef-dk/users.lock.json
Policy revision id: 20fac68f987152f62a2761e1cfc7f1dc29b598303bfb2d84a115557e2a4a8f27
```

This will produce a `users.lock.json` that has the `base` policyfile lock merged in.
This will produce a `users.lock.json` that has the `base` policyfile lock merged in.

More information can be found in
[RFC097](https://github.com/chef/chef-rfc/blob/master/rfc097-policyfile-includes.md) and
Expand Down
2 changes: 1 addition & 1 deletion lib/chef-dk/command/generator_commands/cookbook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def emit_post_create_message
msg("\nThere are several commands you can run to get started locally developing and testing your cookbook.")
msg("Type `delivery local --help` to see a full list.")
msg("\nWhy not start by writing a test? Tests for the default recipe are stored at:\n")
msg("test/smoke/default/default_test.rb")
msg("test/integration/default/default_test.rb")
msg("\nIf you'd prefer to dive right in, the default recipe can be found at:")
msg("\nrecipes/default.rb\n")
end
Expand Down
4 changes: 2 additions & 2 deletions lib/chef-dk/skeletons/code_generator/recipes/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
end

# Inspec
directory "#{app_dir}/test/smoke/default" do
directory "#{app_dir}/test/integration/default" do
recursive true
end

template "#{app_dir}/test/smoke/default/default_test.rb" do
template "#{app_dir}/test/integration/default/default_test.rb" do
source 'inspec_default_test.rb.erb'
helpers(ChefDK::Generator::TemplateHelper)
action :create_if_missing
Expand Down
4 changes: 2 additions & 2 deletions lib/chef-dk/skeletons/code_generator/recipes/cookbook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@
end

# Inspec
directory "#{cookbook_dir}/test/smoke/default" do
directory "#{cookbook_dir}/test/integration/default" do
recursive true
end

template "#{cookbook_dir}/test/smoke/default/default_test.rb" do
template "#{cookbook_dir}/test/integration/default/default_test.rb" do
source 'inspec_default_test.rb.erb'
helpers(ChefDK::Generator::TemplateHelper)
action :create_if_missing
Expand Down
8 changes: 4 additions & 4 deletions lib/chef-dk/skeletons/code_generator/recipes/recipe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
spec_helper_path = File.join(cookbook_dir, 'spec', 'spec_helper.rb')
spec_dir = File.join(cookbook_dir, 'spec', 'unit', 'recipes')
spec_path = File.join(spec_dir, "#{context.new_file_basename}_spec.rb")
inspec_dir = File.join(cookbook_dir, 'test', 'smoke', 'default')
inspec_dir = File.join(cookbook_dir, 'test', 'integration', 'default')
inspec_path = File.join(inspec_dir, "#{context.new_file_basename}_test.rb")

if File.directory?(File.join(cookbook_dir, 'test', 'recipes'))
Chef::Log.deprecation <<-EOH
It appears that you have Inspec tests located at "test/recipes". This location can
cause issues with Foodcritic and has been deprecated in favor of "test/smoke/default".
Please move your existing Inspec tests to the newly created "test/smoke/default"
cause issues with Foodcritic and has been deprecated in favor of "test/integration/default".
Please move your existing Inspec tests to the newly created "test/integration/default"
directory, and update the 'inspec_tests' value in your .kitchen.yml file(s) to
point to "test/smoke/default".
point to "test/integration/default".
EOH
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ suites:
- recipe[<%= cookbook_name %>::default]
verifier:
inspec_tests:
- test/smoke/default
- test/integration/default
attributes:
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ suites:
- name: default
verifier:
inspec_tests:
- test/smoke/default
- test/integration/default
attributes:
10 changes: 5 additions & 5 deletions spec/unit/command/generator_commands/app_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
.gitignore
.kitchen.yml
test
test/smoke
test/smoke/default
test/smoke/default/default_test.rb
test/integration
test/integration/default
test/integration/default/default_test.rb
README.md
cookbooks/new_app/Berksfile
cookbooks/new_app/chefignore
Expand Down Expand Up @@ -129,8 +129,8 @@ def generator_context
end
end

describe "test/smoke/default/default_test.rb" do
let(:file) { File.join(tempdir, "new_app", "test", "smoke", "default", "default_test.rb") }
describe "test/integration/default/default_test.rb" do
let(:file) { File.join(tempdir, "new_app", "test", "integration", "default", "default_test.rb") }

include_examples "a generated file", :cookbook_name do
let(:line) { "describe port" }
Expand Down
14 changes: 7 additions & 7 deletions spec/unit/command/generator_commands/cookbook_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
.gitignore
.kitchen.yml
test
test/smoke
test/smoke/default/default_test.rb
test/integration
test/integration/default/default_test.rb
Berksfile
chefignore
LICENSE
Expand Down Expand Up @@ -66,7 +66,7 @@
Why not start by writing a test? Tests for the default recipe are stored at:
test/smoke/default/default_test.rb
test/integration/default/default_test.rb
If you'd prefer to dive right in, the default recipe can be found at:
Expand Down Expand Up @@ -474,8 +474,8 @@ def with_argv(argv)

end

describe "test/smoke/default/default_test.rb" do
let(:file) { File.join(tempdir, "new_cookbook", "test", "smoke", "default", "default_test.rb") }
describe "test/integration/default/default_test.rb" do
let(:file) { File.join(tempdir, "new_cookbook", "test", "integration", "default", "default_test.rb") }

include_examples "a generated file", :cookbook_name do
let(:line) { "describe port" }
Expand Down Expand Up @@ -584,7 +584,7 @@ def with_argv(argv)
- name: default
verifier:
inspec_tests:
- test/smoke/default
- test/integration/default
attributes:
KITCHEN_YML
end
Expand Down Expand Up @@ -663,7 +663,7 @@ def with_argv(argv)
- recipe[new_cookbook::default]
verifier:
inspec_tests:
- test/smoke/default
- test/integration/default
attributes:
KITCHEN_YML
end
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/command/generator_commands/recipe_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
[ "recipes/new_recipe.rb",
"spec/spec_helper.rb",
"spec/unit/recipes/new_recipe_spec.rb",
"test/smoke/default/new_recipe_test.rb",
"test/integration/default/new_recipe_test.rb",
] end
let(:new_file_name) { "new_recipe" }

Expand Down

0 comments on commit 127ecf2

Please sign in to comment.