summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2019-05-03 12:35:02 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2019-05-03 12:37:14 -0700
commit1a94e1bc43aed773ef7584ea6c88af80cc884520 (patch)
treefb321770c271528e1aa750324d1f987cf72763bf /spec
parent1c0a097bd1f9f55d4db199b0681afd68f52c218e (diff)
downloadchef-1a94e1bc43aed773ef7584ea6c88af80cc884520.tar.gz
Chef-15: cookbook compiler should parse only .rb fileslcg/parse-only-rb-files
Fixes #6281 which is a frequently reported issue where md files and swap files and other junk causes the cookbook compiler to barf. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec')
-rw-r--r--spec/data/run_context/cookbooks/dependency1/attributes/unparsed_file1
-rw-r--r--spec/data/run_context/cookbooks/dependency1/definitions/unparsed_file1
-rw-r--r--spec/data/run_context/cookbooks/dependency1/libraries/unparsed_file1
-rw-r--r--spec/data/run_context/cookbooks/dependency1/providers/unparsed_file1
-rw-r--r--spec/data/run_context/cookbooks/dependency1/recipes/unparsed_file1
-rw-r--r--spec/data/run_context/cookbooks/dependency1/resources/unparsed_file1
-rw-r--r--spec/unit/run_context/cookbook_compiler_spec.rb10
7 files changed, 15 insertions, 1 deletions
diff --git a/spec/data/run_context/cookbooks/dependency1/attributes/unparsed_file b/spec/data/run_context/cookbooks/dependency1/attributes/unparsed_file
new file mode 100644
index 0000000000..60fee07cc6
--- /dev/null
+++ b/spec/data/run_context/cookbooks/dependency1/attributes/unparsed_file
@@ -0,0 +1 @@
+raise "this should not be parsed by the loader"
diff --git a/spec/data/run_context/cookbooks/dependency1/definitions/unparsed_file b/spec/data/run_context/cookbooks/dependency1/definitions/unparsed_file
new file mode 100644
index 0000000000..60fee07cc6
--- /dev/null
+++ b/spec/data/run_context/cookbooks/dependency1/definitions/unparsed_file
@@ -0,0 +1 @@
+raise "this should not be parsed by the loader"
diff --git a/spec/data/run_context/cookbooks/dependency1/libraries/unparsed_file b/spec/data/run_context/cookbooks/dependency1/libraries/unparsed_file
new file mode 100644
index 0000000000..60fee07cc6
--- /dev/null
+++ b/spec/data/run_context/cookbooks/dependency1/libraries/unparsed_file
@@ -0,0 +1 @@
+raise "this should not be parsed by the loader"
diff --git a/spec/data/run_context/cookbooks/dependency1/providers/unparsed_file b/spec/data/run_context/cookbooks/dependency1/providers/unparsed_file
new file mode 100644
index 0000000000..60fee07cc6
--- /dev/null
+++ b/spec/data/run_context/cookbooks/dependency1/providers/unparsed_file
@@ -0,0 +1 @@
+raise "this should not be parsed by the loader"
diff --git a/spec/data/run_context/cookbooks/dependency1/recipes/unparsed_file b/spec/data/run_context/cookbooks/dependency1/recipes/unparsed_file
new file mode 100644
index 0000000000..60fee07cc6
--- /dev/null
+++ b/spec/data/run_context/cookbooks/dependency1/recipes/unparsed_file
@@ -0,0 +1 @@
+raise "this should not be parsed by the loader"
diff --git a/spec/data/run_context/cookbooks/dependency1/resources/unparsed_file b/spec/data/run_context/cookbooks/dependency1/resources/unparsed_file
new file mode 100644
index 0000000000..60fee07cc6
--- /dev/null
+++ b/spec/data/run_context/cookbooks/dependency1/resources/unparsed_file
@@ -0,0 +1 @@
+raise "this should not be parsed by the loader"
diff --git a/spec/unit/run_context/cookbook_compiler_spec.rb b/spec/unit/run_context/cookbook_compiler_spec.rb
index c3a4c1b98f..3c585cf444 100644
--- a/spec/unit/run_context/cookbook_compiler_spec.rb
+++ b/spec/unit/run_context/cookbook_compiler_spec.rb
@@ -1,6 +1,6 @@
#
# Author:: Daniel DeLeo (<dan@chef.io>)
-# Copyright:: Copyright 2012-2018, Chef Software Inc.
+# Copyright:: Copyright 2012-2019, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -51,6 +51,14 @@ describe Chef::RunContext::CookbookCompiler do
Chef::RunContext::CookbookCompiler.new(run_context, run_list_expansion, events)
end
+ describe "loading a cookbook fully" do
+ it "does not error" do
+ run_context.instance_variable_set(:@cookbook_compiler, compiler)
+ node.run_list("dependency1::default")
+ compiler.compile
+ end
+ end
+
describe "loading attribute files" do
# Attribute files in the fixture data will append their