Best Minitest_ruby code snippet using MyModule.t
test_runtime_package.rb
Source:test_runtime_package.rb
1require File.expand_path('../helper', __FILE__)2class TestRuntimePackage < Dbt::TestCase3 def test_simple_package4 db_scripts = create_dir('databases/generated')5 create_file('databases/generated/MyModule/base.sql', '')6 create_file('databases/generated/MyModule/types/typeA.sql', '')7 create_file('databases/generated/MyModule/views/viewA.sql', '')8 create_file('databases/generated/MyModule/functions/functionA.sql', '')9 create_file('databases/generated/MyModule/stored-procedures/spA.sql', '')10 create_file('databases/generated/MyModule/misc/spA.sql', '')11 create_file('databases/generated/MyModule/fixtures/foo.yml', '')12 create_file('databases/generated/MyModule/fixtures/bar.sql', '')13 create_file('databases/generated/MyModule/fixtures/fooShouldNotCopy.yml', '')14 create_file('databases/generated/MyModule/triggers/trgA.sql', '')15 create_file('databases/generated/MyModule/finalize/finA.sql', '')16 create_file('databases/generated/MyModule/down/downA.sql', '')17 database = Dbt.add_database(:default) do |db|18 db.rake_integration = false19 db.repository.modules = ['MyModule']20 db.repository.table_map = {'MyModule' => ['foo', 'bar', 'baz']}21 db.search_dirs = [db_scripts]22 end23 output_dir = create_dir('pkg/out')24 Dbt.runtime.package_database_data(database, output_dir)25 assert_file_exist("#{output_dir}/MyModule/base.sql")26 assert_file_exist("#{output_dir}/MyModule/types/typeA.sql")27 assert_file_exist("#{output_dir}/MyModule/views/viewA.sql")28 assert_file_exist("#{output_dir}/MyModule/functions/functionA.sql")29 assert_file_exist("#{output_dir}/MyModule/stored-procedures/spA.sql")30 assert_file_exist("#{output_dir}/MyModule/misc/spA.sql")31 assert_file_exist("#{output_dir}/MyModule/fixtures/foo.yml")32 assert_file_not_exist("#{output_dir}/MyModule/fixtures/fooShouldNotCopy.yml")33 assert_file_not_exist("#{output_dir}/MyModule/fixtures/bar.sql")34 assert_file_exist("#{output_dir}/MyModule/triggers/trgA.sql")35 assert_file_exist("#{output_dir}/MyModule/finalize/finA.sql")36 assert_file_exist("#{output_dir}/MyModule/down/downA.sql")37 end38 def test_multiple_modules39 db_scripts = create_dir('databases/generated')40 create_file('databases/generated/MyModule/base.sql', '')41 create_file('databases/generated/MyOtherModule/base.sql', '')42 database = Dbt.add_database(:default) do |db|43 db.rake_integration = false44 db.repository.modules = ['MyModule', 'MyOtherModule']45 db.repository.table_map = {'MyModule' => [], 'MyOtherModule' => []}46 db.search_dirs = [db_scripts]47 end48 output_dir = create_dir('pkg/out')49 Dbt.runtime.package_database_data(database, output_dir)50 assert_file_exist("#{output_dir}/MyModule/base.sql")51 assert_file_exist("#{output_dir}/MyOtherModule/base.sql")52 end53 def test_package_through_pre_import54 db_scripts = create_dir('databases/generated')55 packaged_definition = Dbt::RepositoryDefinition.new(:modules => ['MyModule'], :table_map => {'MyModule' => ['foo', 'bar', 'baz']})56 zipfile = create_zip('data/repository.yml' => packaged_definition.to_yaml,57 'data/MyModule/base.sql' => '',58 'data/MyModule/types/typeA.sql' => '',59 'data/MyModule/views/viewA.sql' => '',60 'data/MyModule/functions/functionA.sql' => '',61 'data/MyModule/stored-procedures/spA.sql' => '',62 'data/MyModule/misc/spA.sql' => '',63 'data/MyModule/fixtures/foo.yml' => '',64 'data/MyModule/fixtures/bar.sql' => '',65 'data/MyModule/fixtures/fooShouldNotCopy.yml' => '',66 'data/MyModule/triggers/trgA.sql' => '',67 'data/MyModule/finalize/finA.sql' => '',68 'data/MyModule/down/downA.sql' => '')69 definition = Dbt::RepositoryDefinition.new(:modules => [], :table_map => {})70 File.open("#{db_scripts}/repository.yml",'w') do |f|71 f.write definition.to_yaml72 end73 database = Dbt.add_database(:default) do |db|74 db.rake_integration = false75 db.pre_db_artifacts << zipfile76 db.search_dirs = [db_scripts]77 end78 Dbt.runtime.send(:perform_load_database_config, database)79 output_dir = create_dir('pkg/out')80 Dbt.runtime.package_database_data(database, output_dir)81 assert_file_exist("#{output_dir}/MyModule/base.sql")82 assert_file_exist("#{output_dir}/MyModule/types/typeA.sql")83 assert_file_exist("#{output_dir}/MyModule/views/viewA.sql")84 assert_file_exist("#{output_dir}/MyModule/functions/functionA.sql")85 assert_file_exist("#{output_dir}/MyModule/stored-procedures/spA.sql")86 assert_file_exist("#{output_dir}/MyModule/misc/spA.sql")87 assert_file_exist("#{output_dir}/MyModule/fixtures/foo.yml")88 assert_file_not_exist("#{output_dir}/MyModule/fixtures/fooShouldNotCopy.yml")89 assert_file_not_exist("#{output_dir}/MyModule/fixtures/bar.sql")90 assert_file_exist("#{output_dir}/MyModule/triggers/trgA.sql")91 assert_file_exist("#{output_dir}/MyModule/finalize/finA.sql")92 assert_file_exist("#{output_dir}/MyModule/down/downA.sql")93 end94 def test_package_through_post_import95 db_scripts = create_dir('databases/generated')96 packaged_definition = Dbt::RepositoryDefinition.new(:modules => ['MyModule'], :table_map => {'MyModule' => ['foo', 'bar', 'baz']})97 zipfile = create_zip('data/repository.yml' => packaged_definition.to_yaml,98 'data/MyModule/base.sql' => '',99 'data/MyModule/types/typeA.sql' => '',100 'data/MyModule/views/viewA.sql' => '',101 'data/MyModule/functions/functionA.sql' => '',102 'data/MyModule/stored-procedures/spA.sql' => '',103 'data/MyModule/misc/spA.sql' => '',104 'data/MyModule/fixtures/foo.yml' => '',105 'data/MyModule/fixtures/bar.sql' => '',106 'data/MyModule/fixtures/fooShouldNotCopy.yml' => '',107 'data/MyModule/triggers/trgA.sql' => '',108 'data/MyModule/finalize/finA.sql' => '',109 'data/MyModule/down/downA.sql' => '')110 definition = Dbt::RepositoryDefinition.new(:modules => [], :table_map => {})111 File.open("#{db_scripts}/repository.yml",'w') do |f|112 f.write definition.to_yaml113 end114 database = Dbt.add_database(:default) do |db|115 db.rake_integration = false116 db.post_db_artifacts << zipfile117 db.search_dirs = [db_scripts]118 end119 Dbt.runtime.send(:perform_load_database_config, database)120 output_dir = create_dir('pkg/out')121 Dbt.runtime.package_database_data(database, output_dir)122 assert_file_exist("#{output_dir}/MyModule/base.sql")123 assert_file_exist("#{output_dir}/MyModule/types/typeA.sql")124 assert_file_exist("#{output_dir}/MyModule/views/viewA.sql")125 assert_file_exist("#{output_dir}/MyModule/functions/functionA.sql")126 assert_file_exist("#{output_dir}/MyModule/stored-procedures/spA.sql")127 assert_file_exist("#{output_dir}/MyModule/misc/spA.sql")128 assert_file_exist("#{output_dir}/MyModule/fixtures/foo.yml")129 assert_file_not_exist("#{output_dir}/MyModule/fixtures/fooShouldNotCopy.yml")130 assert_file_not_exist("#{output_dir}/MyModule/fixtures/bar.sql")131 assert_file_exist("#{output_dir}/MyModule/triggers/trgA.sql")132 assert_file_exist("#{output_dir}/MyModule/finalize/finA.sql")133 assert_file_exist("#{output_dir}/MyModule/down/downA.sql")134 end135 def test_multiple_search_dirs136 create_file('databases/MyModule/base.sql', '')137 create_file('databases/generated/MyModule/base2.sql', '')138 database = Dbt.add_database(:default) do |db|139 db.rake_integration = false140 db.repository.modules = ['MyModule']141 db.repository.table_map = {'MyModule' => ['foo', 'bar', 'baz']}142 db.search_dirs = [create_dir('databases'), create_dir('databases/generated')]143 end144 output_dir = create_dir('pkg/out')145 Dbt.runtime.package_database_data(database, output_dir)146 assert_file_exist("#{output_dir}/MyModule/base.sql")147 assert_file_exist("#{output_dir}/MyModule/base2.sql")148 end149 def test_ordering_in_index150 create_file('databases/MyModule/base1.sql', '')151 create_file('databases/MyModule/base2.sql', '')152 create_file('databases/MyModule/base3.sql', '')153 database = Dbt.add_database(:default) do |db|154 db.rake_integration = false155 db.repository.modules = ['MyModule']156 db.repository.table_map = {'MyModule' => []}157 db.search_dirs = [create_dir('databases')]158 end159 Dbt::Config.index_file_name = 'myindex.txt'160 output_dir = create_dir('pkg/out')161 Dbt.runtime.package_database_data(database, output_dir)162 assert_file_exist("#{output_dir}/MyModule/base1.sql")163 assert_file_exist("#{output_dir}/MyModule/base2.sql")164 assert_file_exist("#{output_dir}/MyModule/base3.sql")165 assert_file_exist("#{output_dir}/MyModule/myindex.txt")166 index = IO.readlines("#{output_dir}/MyModule/myindex.txt")167 assert_equal index.size, 3168 assert_equal index[0].strip, 'base1.sql'169 assert_equal index[1].strip, 'base2.sql'170 assert_equal index[2].strip, 'base3.sql'171 end172 def test_ordering_in_index_with_partial_index_supplied173 Dbt::Config.index_file_name = 'myindex.txt'174 create_file('databases/MyModule/myindex.txt', "base3.sql\nbase2.sql\n")175 create_file('databases/MyModule/base1.sql', '')176 create_file('databases/MyModule/base2.sql', '')177 create_file('databases/MyModule/base3.sql', '')178 create_file('databases/MyModule/base4.sql', '')179 database = Dbt.add_database(:default) do |db|180 db.rake_integration = false181 db.repository.modules = ['MyModule']182 db.repository.table_map = {'MyModule' => []}183 db.search_dirs = [create_dir('databases')]184 end185 output_dir = create_dir('pkg/out')186 Dbt.runtime.package_database_data(database, output_dir)187 assert_file_exist("#{output_dir}/MyModule/base1.sql")188 assert_file_exist("#{output_dir}/MyModule/base2.sql")189 assert_file_exist("#{output_dir}/MyModule/base3.sql")190 assert_file_exist("#{output_dir}/MyModule/base4.sql")191 assert_file_exist("#{output_dir}/MyModule/myindex.txt")192 index = IO.readlines("#{output_dir}/MyModule/myindex.txt")193 assert_equal index.size, 4194 assert_equal index[0].strip, 'base3.sql'195 assert_equal index[1].strip, 'base2.sql'196 assert_equal index[2].strip, 'base1.sql'197 assert_equal index[3].strip, 'base4.sql'198 end199 def test_ordering_in_index_with_full_index_supplied200 Dbt::Config.index_file_name = 'myindex.txt'201 create_file('databases/MyModule/myindex.txt', "base3.sql\nbase1.sql\nbase2.sql\n")202 create_file('databases/MyModule/base1.sql', '')203 create_file('databases/MyModule/base2.sql', '')204 create_file('databases/MyModule/base3.sql', '')205 database = Dbt.add_database(:default) do |db|206 db.rake_integration = false207 db.repository.modules = ['MyModule']208 db.repository.table_map = {'MyModule' => []}209 db.search_dirs = [create_dir('databases')]210 end211 output_dir = create_dir('pkg/out')212 Dbt.runtime.package_database_data(database, output_dir)213 assert_file_exist("#{output_dir}/MyModule/base1.sql")214 assert_file_exist("#{output_dir}/MyModule/base2.sql")215 assert_file_exist("#{output_dir}/MyModule/base3.sql")216 assert_file_exist("#{output_dir}/MyModule/myindex.txt")217 index = IO.readlines("#{output_dir}/MyModule/myindex.txt")218 assert_equal index.size, 3219 assert_equal index[0].strip, 'base3.sql'220 assert_equal index[1].strip, 'base1.sql'221 assert_equal index[2].strip, 'base2.sql'222 end223 def test_data_sets_copied224 db_scripts = create_dir('databases/generated')225 create_file('databases/generated/MyModule/zang/bing/foo.yml', '')226 database = Dbt.add_database(:default) do |db|227 db.rake_integration = false228 db.repository.modules = ['MyModule']229 db.repository.table_map = {'MyModule' => ['foo', 'bar', 'baz']}230 db.search_dirs = [db_scripts]231 db.datasets = ['bing']232 end233 Dbt::Config.default_datasets_dir_name = 'zang'234 output_dir = create_dir('pkg/out')235 Dbt.runtime.package_database_data(database, output_dir)236 assert_file_exist("#{output_dir}/MyModule/zang/bing/foo.yml")237 end238 def test_imports_copied239 db_scripts = create_dir('databases/generated')240 create_file('databases/generated/MyModule/import1/foo.yml', '')241 database = Dbt.add_database(:default) do |db|242 db.rake_integration = false243 db.repository.modules = ['MyModule']244 db.repository.table_map = {'MyModule' => ['foo', 'bar', 'baz']}245 db.search_dirs = [db_scripts]246 db.add_import(:default, {})247 end248 Dbt::Config.default_import_dir = 'import1'249 output_dir = create_dir('pkg/out')250 Dbt.runtime.package_database_data(database, output_dir)251 assert_file_exist("#{output_dir}/MyModule/import1/foo.yml")252 end253end...
selinux_module_spec.rb
Source:selinux_module_spec.rb
1require 'spec_helper'2describe 'selinux::module' do3 let(:title) { 'mymodule' }4 on_supported_os.each do |os, facts|5 context "on #{os}" do6 let(:facts) do7 facts8 end9 let(:workdir) do10 '/var/lib/puppet/puppet-selinux/modules'11 end12 let(:module_basepath) do13 '/var/lib/puppet/puppet-selinux/modules/mymodule'14 end15 context 'ordering' do16 let(:params) do17 {18 source_te: 'puppet:///modules/mymodule/selinux/mymodule.te'19 }20 end21 it { is_expected.to contain_selinux__module('mymodule').that_requires('Anchor[selinux::module pre]') }22 it { is_expected.to contain_selinux__module('mymodule').that_comes_before('Anchor[selinux::module post]') }23 end24 context 'present case with refpolicy builder and with te file only' do25 let(:params) do26 {27 source_te: 'puppet:///modules/mymodule/selinux/mymodule.te',28 builder: 'refpolicy'29 }30 end31 it { is_expected.to contain_file(workdir) }32 it { is_expected.to contain_file("#{workdir}/mymodule.te").that_notifies('Exec[clean-module-mymodule]') }33 it { is_expected.to contain_file("#{workdir}/mymodule.fc").with(source: nil, content: '') }34 it { is_expected.to contain_file("#{workdir}/mymodule.if").with(source: nil, content: '') }35 it { is_expected.to contain_exec('clean-module-mymodule').with(command: "rm -f '#{module_basepath}.pp' '#{module_basepath}.loaded'", cwd: workdir) }36 it { is_expected.to contain_exec('build-module-mymodule').with(command: "make -f /usr/share/selinux/devel/Makefile mymodule.pp || (rm -f #{module_basepath}.pp #{module_basepath}.loaded && exit 1)", creates: "#{module_basepath}.pp") }37 it { is_expected.to contain_exec('install-module-mymodule').with(command: "semodule -i #{module_basepath}.pp && touch #{module_basepath}.loaded", cwd: workdir, creates: "#{module_basepath}.loaded") }38 it { is_expected.to contain_selmodule('mymodule').with_ensure('present', selmodulepath: workdir) }39 end40 context 'present case with refpolicy builder and with te and fc file' do41 let(:params) do42 {43 source_te: 'puppet:///modules/mymodule/selinux/mymodule.te',44 source_fc: 'puppet:///modules/mymodule/selinux/mymodule.fc',45 builder: 'refpolicy'46 }47 end48 it { is_expected.to contain_file(workdir) }49 it { is_expected.to contain_file("#{workdir}/mymodule.te").that_notifies('Exec[clean-module-mymodule]') }50 it { is_expected.to contain_file("#{workdir}/mymodule.fc").that_notifies('Exec[clean-module-mymodule]') }51 it { is_expected.to contain_file("#{workdir}/mymodule.if").with(source: nil, content: '') }52 it { is_expected.to contain_exec('clean-module-mymodule').with(command: "rm -f '#{module_basepath}.pp' '#{module_basepath}.loaded'", cwd: workdir) }53 it { is_expected.to contain_exec('build-module-mymodule').with(command: "make -f /usr/share/selinux/devel/Makefile mymodule.pp || (rm -f #{module_basepath}.pp #{module_basepath}.loaded && exit 1)", creates: "#{module_basepath}.pp") }54 it { is_expected.to contain_exec('install-module-mymodule').with(command: "semodule -i #{module_basepath}.pp && touch #{module_basepath}.loaded", cwd: workdir, creates: "#{module_basepath}.loaded") }55 it { is_expected.to contain_selmodule('mymodule').with_ensure('present', selmodulepath: workdir) }56 end57 context 'present case with refpolicy builder and with te, fc and if file' do58 let(:params) do59 {60 source_te: 'puppet:///modules/mymodule/selinux/mymodule.te',61 source_if: 'puppet:///modules/mymodule/selinux/mymodule.if',62 source_fc: 'puppet:///modules/mymodule/selinux/mymodule.fc',63 builder: 'refpolicy'64 }65 end66 it { is_expected.to contain_file(workdir) }67 it { is_expected.to contain_file("#{workdir}/mymodule.te").that_notifies('Exec[clean-module-mymodule]') }68 it { is_expected.to contain_file("#{workdir}/mymodule.if").that_notifies('Exec[clean-module-mymodule]') }69 it { is_expected.to contain_file("#{workdir}/mymodule.fc").that_notifies('Exec[clean-module-mymodule]') }70 it { is_expected.to contain_exec('clean-module-mymodule').with(command: "rm -f '#{module_basepath}.pp' '#{module_basepath}.loaded'", cwd: workdir) }71 it { is_expected.to contain_exec('build-module-mymodule').with(command: "make -f /usr/share/selinux/devel/Makefile mymodule.pp || (rm -f #{module_basepath}.pp #{module_basepath}.loaded && exit 1)", creates: "#{module_basepath}.pp") }72 it { is_expected.to contain_exec('install-module-mymodule').with(command: "semodule -i #{module_basepath}.pp && touch #{module_basepath}.loaded", cwd: workdir, creates: "#{module_basepath}.loaded") }73 it { is_expected.to contain_selmodule('mymodule').with_ensure('present', selmodulepath: workdir) }74 end75 context 'present case with refpolicy builder and with inline te, fc and if file' do76 let(:params) do77 {78 content_te: 'policy_module(puppet_test, 1.0.0)',79 content_if: 'interface(puppet_test)',80 content_fc: '/bin/sh system_u:object_r:bin_t',81 builder: 'refpolicy'82 }83 end84 it { is_expected.to contain_file(workdir) }85 it { is_expected.to contain_file("#{workdir}/mymodule.te").with(source: nil, content: 'policy_module(puppet_test, 1.0.0)').that_notifies('Exec[clean-module-mymodule]') }86 it { is_expected.to contain_file("#{workdir}/mymodule.if").with(source: nil, content: 'interface(puppet_test)').that_notifies('Exec[clean-module-mymodule]') }87 it { is_expected.to contain_file("#{workdir}/mymodule.fc").with(source: nil, content: '/bin/sh system_u:object_r:bin_t').that_notifies('Exec[clean-module-mymodule]') }88 it { is_expected.to contain_exec('clean-module-mymodule').with(command: "rm -f '#{module_basepath}.pp' '#{module_basepath}.loaded'", cwd: workdir) }89 it { is_expected.to contain_exec('build-module-mymodule').with(command: "make -f /usr/share/selinux/devel/Makefile mymodule.pp || (rm -f #{module_basepath}.pp #{module_basepath}.loaded && exit 1)", creates: "#{module_basepath}.pp") }90 it { is_expected.to contain_exec('install-module-mymodule').with(command: "semodule -i #{module_basepath}.pp && touch #{module_basepath}.loaded", cwd: workdir, creates: "#{module_basepath}.loaded") }91 it { is_expected.to contain_selmodule('mymodule').with_ensure('present', selmodulepath: workdir) }92 end93 context 'present case with simple builder with te' do94 let(:params) do95 {96 source_te: 'puppet:///modules/mymodule/selinux/mymodule.te',97 builder: 'simple'98 }99 end100 it { is_expected.to contain_file(workdir) }101 it { is_expected.to contain_class('selinux::build').that_comes_before('Selinux::Module[mymodule]') }102 it { is_expected.to contain_file("#{workdir}/mymodule.te").that_notifies('Exec[clean-module-mymodule]') }103 it { is_expected.to contain_file("#{workdir}/mymodule.fc").with(source: nil, content: '') }104 it { is_expected.to contain_file("#{workdir}/mymodule.if").with(source: nil, content: '') }105 it { is_expected.to contain_exec('clean-module-mymodule').with(command: "rm -f '#{module_basepath}.pp' '#{module_basepath}.loaded'", cwd: workdir) }106 it { is_expected.to contain_exec('build-module-mymodule').with(command: "/var/lib/puppet/puppet-selinux/bin/selinux_build_module_simple.sh mymodule #{workdir} || (rm -f #{module_basepath}.pp #{module_basepath}.loaded && exit 1)", creates: "#{module_basepath}.pp") }107 it { is_expected.to contain_exec('install-module-mymodule').with(command: "semodule -i #{module_basepath}.pp && touch #{module_basepath}.loaded", cwd: workdir, creates: "#{module_basepath}.loaded") }108 it { is_expected.to contain_selmodule('mymodule').with_ensure('present', selmodulepath: workdir) }109 end110 context 'present case with simple builder with inline te' do111 let(:params) do112 {113 content_te: 'policy_module(puppet_test, 1.0.0)',114 builder: 'simple'115 }116 end117 it { is_expected.to contain_file(workdir) }118 it { is_expected.to contain_file("#{workdir}/mymodule.te").with(content: 'policy_module(puppet_test, 1.0.0)').that_notifies('Exec[clean-module-mymodule]') }119 it { is_expected.to contain_file("#{workdir}/mymodule.fc").with(source: nil, content: '') }120 it { is_expected.to contain_file("#{workdir}/mymodule.if").with(source: nil, content: '') }121 it { is_expected.to contain_exec('clean-module-mymodule').with(command: "rm -f '#{module_basepath}.pp' '#{module_basepath}.loaded'", cwd: workdir) }122 it { is_expected.to contain_exec('build-module-mymodule').with(command: "/var/lib/puppet/puppet-selinux/bin/selinux_build_module_simple.sh mymodule #{workdir} || (rm -f #{module_basepath}.pp #{module_basepath}.loaded && exit 1)", creates: "#{module_basepath}.pp") }123 it { is_expected.to contain_exec('install-module-mymodule').with(command: "semodule -i #{module_basepath}.pp && touch #{module_basepath}.loaded", cwd: workdir, creates: "#{module_basepath}.loaded") }124 it { is_expected.to contain_selmodule('mymodule').with_ensure('present', selmodulepath: workdir) }125 end126 context 'unsupported source with simple builder' do127 let(:params) do128 {129 source_if: 'puppet:///modules/mymodule/selinux/mymodule.te',130 builder: 'simple'131 }132 end133 it do134 is_expected.to compile.and_raise_error(%r{simple builder does not support})135 end136 end137 context 'present case with pre-compiled policy package' do138 let(:params) do139 {140 source_pp: 'puppet:///modules/mymodule/selinux/mymodule.pp'141 }142 end143 it { is_expected.to contain_file(workdir) }144 it { is_expected.to contain_file("#{workdir}/mymodule.pp").that_notifies('Exec[clean-module-mymodule]') }145 it { is_expected.to contain_exec('clean-module-mymodule').with(command: "rm -f '#{module_basepath}.loaded'", cwd: workdir) }146 it { is_expected.to contain_exec('install-module-mymodule').with(command: "semodule -i #{module_basepath}.pp && touch #{module_basepath}.loaded", cwd: workdir, creates: "#{module_basepath}.loaded") }147 it { is_expected.to contain_selmodule('mymodule').with_ensure('present', selmodulepath: workdir) }148 end149 context 'conflicting parameters' do150 let(:params) do151 {152 source_pp: 'puppet:///modules/mymodule/selinux/mymodule.pp',153 source_te: 'puppet:///modules/mymodule/selinux/mymodule.te',154 builder: 'simple'155 }156 end157 it do158 is_expected.to compile.and_raise_error(%r{mutually exclusive})159 end160 end161 context 'absent case' do162 let(:params) do163 {164 ensure: 'absent'165 }166 end167 it { is_expected.to contain_selmodule('mymodule').with_ensure('absent') }168 end169 end170 end171end...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!