diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 91d1e83..bd02e25 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -21,4 +21,4 @@ jobs: - name: Install Chef uses: actionshub/chef-install@main - name: Install cookbooks - run: berks install + run: chef install Policyfile.rb diff --git a/Berksfile b/Berksfile deleted file mode 100644 index 39643cc..0000000 --- a/Berksfile +++ /dev/null @@ -1,8 +0,0 @@ -source 'https://supermarket.chef.io' - -metadata - -group :integration do - cookbook 'apt' - cookbook 'test', path: 'test/cookbooks/test' -end diff --git a/Policyfile.rb b/Policyfile.rb new file mode 100644 index 0000000..2b44ece --- /dev/null +++ b/Policyfile.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +name 'bind' + +run_list 'test::default' + +cookbook 'bind', path: '.' +cookbook 'test', path: './test/cookbooks/test' + +Dir.children('./test/cookbooks/test/recipes').grep(/\.rb\z/).sort.each do |recipe| + recipe_name = File.basename(recipe, '.rb') + + named_run_list recipe_name.to_sym, "test::#{recipe_name}" +end diff --git a/kitchen.global.yml b/kitchen.global.yml index 0bab8e1..d2b44e5 100644 --- a/kitchen.global.yml +++ b/kitchen.global.yml @@ -10,6 +10,7 @@ provisioner: multiple_converge: <%= ENV['MULTIPLE_CONVERGE'] || 2 %> deprecations_as_errors: true log_level: <%= ENV['CHEF_LOG_LEVEL'] || 'auto' %> + policyfile: Policyfile.rb verifier: name: inspec diff --git a/kitchen.yml b/kitchen.yml index 7b9c786..cdb77a0 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -11,6 +11,7 @@ provisioner: product_name: <%= ENV['CHEF_PRODUCT_NAME'] || 'chef' %> product_version: <%= ENV['CHEF_VERSION'] || 'latest' %> log_level: <%= ENV['CHEF_LOG_LEVEL'] || 'auto' %> + policyfile: Policyfile.rb platforms: - name: almalinux-8 @@ -33,44 +34,44 @@ verifier: suites: - name: default - run_list: - - recipe[test::default] + provisioner: + named_run_list: default - name: resources - run_list: - - recipe[test] + provisioner: + named_run_list: default verifier: inputs: domain: ns1.example.org host_string: "ns1.example.org has address 1.1.1.1" - name: chroot - run_list: - - recipe[test::chroot] + provisioner: + named_run_list: chroot verifier: inputs: chroot: true - name: views - run_list: - - recipe[test::views] + provisioner: + named_run_list: views verifier: inputs: views: true - name: logging - run_list: - - recipe[test::logging] + provisioner: + named_run_list: logging verifier: inputs: logging: true - name: linked-zones - run_list: - - recipe[test::linked_zones] + provisioner: + named_run_list: linked_zones verifier: inputs: domain: ns1.example.net host_string: "ns1.example.net has address 1.1.1.1" linked: true - name: zone-options - run_list: - - recipe[test::zone_options] + provisioner: + named_run_list: zone_options verifier: inputs: domain: ns1.example.org diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e4f63a3..ed7ef23 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'chefspec' -require 'chefspec/berkshelf' +require 'chefspec/policyfile' RSpec.configure(&:raise_errors_for_deprecations!)