From 6c9c6dcbb62b0fcb7d0224d98564a93abc00f391 Mon Sep 17 00:00:00 2001 From: tphoney Date: Thu, 6 Jun 2019 17:59:41 +0100 Subject: [PATCH 1/2] (FM-8188) convert ntp to use litmus --- .fixtures.yml | 5 +- .sync.yml | 18 +++-- .travis.yml | 54 ++++++++++--- Gemfile | 1 + README.md | 2 + Rakefile | 1 + distelli-manifest.yml | 25 ++++++ provision.yaml | 19 +++++ spec/acceptance/ntp_parameters_spec.rb | 12 +-- spec/spec_helper_acceptance.rb | 108 +++++++++++++------------ spec/spec_helper_acceptance_local.rb | 13 +++ 11 files changed, 181 insertions(+), 77 deletions(-) create mode 100644 distelli-manifest.yml create mode 100644 provision.yaml create mode 100644 spec/spec_helper_acceptance_local.rb diff --git a/.fixtures.yml b/.fixtures.yml index b796288a..32b2033d 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,7 +1,10 @@ fixtures: repositories: - "stdlib": "https://github.com/puppetlabs/puppetlabs-stdlib.git" "augeas_core": "https://github.com/puppetlabs/puppetlabs-augeas_core.git" + facts: 'git://github.com/puppetlabs/puppetlabs-facts.git' + "stdlib": "https://github.com/puppetlabs/puppetlabs-stdlib.git" + provision: "git://github.com/puppetlabs/provision.git" + puppet_agent: 'git://github.com/puppetlabs/puppetlabs-puppet_agent.git' symlinks: "ntp": "#{source_dir}" "my_ntp": "#{source_dir}/spec/fixtures/my_ntp" diff --git a/.sync.yml b/.sync.yml index e7208613..4941268b 100644 --- a/.sync.yml +++ b/.sync.yml @@ -7,14 +7,7 @@ delete: true .travis.yml: - docker_sets: - - set: docker/centos-7 - - set: docker/ubuntu-14.04 - docker_defaults: - bundler_args: "" - secure: "" - branches: - - release + unmanaged: true appveyor.yml: delete: true @@ -29,6 +22,14 @@ Gemfile: - mswin - mingw - x64_mingw + ':development': + - gem: 'puppet_litmus' + platforms: + - ruby + - mswin + - mingw + - x64_mingw + condition: "ENV['PUPPET_GEM_VERSION'].nil? or ENV['PUPPET_GEM_VERSION'] !~ %r{ 5}" optional: ':development': - gem: 'github_changelog_generator' @@ -38,6 +39,7 @@ Gemfile: Rakefile: changelog_user: puppetlabs + use_litmus_tasks: true spec/spec_helper.rb: mock_with: ':rspec' diff --git a/.travis.yml b/.travis.yml index bf22cd04..54826a79 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,22 +23,56 @@ matrix: fast_finish: true include: - - bundler_args: + bundler_args: dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=docker/centos-7 BEAKER_TESTMODE=apply - rvm: 2.5.3 - script: bundle exec rake beaker + env: PLATFORMS=deb_puppet5 + rvm: 2.5.1 + before_script: + - bundle exec rake 'litmus:provision_list[waffle_deb]' + - bundle exec rake 'litmus:install_agent[puppet5]' + - bundle exec rake litmus:install_module + script: + - bundle exec rake litmus:acceptance:parallel services: docker - stage: acceptance sudo: required - - bundler_args: + bundler_args: dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=docker/ubuntu-14.04 BEAKER_TESTMODE=apply - rvm: 2.5.3 - script: bundle exec rake beaker + env: PLATFORMS=deb_puppet6 + rvm: 2.5.1 + before_script: + - bundle exec rake 'litmus:provision_list[waffle_deb]' + - bundle exec rake 'litmus:install_agent[puppet6]' + - bundle exec rake litmus:install_module + script: + - bundle exec rake litmus:acceptance:parallel + services: docker + sudo: required + - + bundler_args: + dist: trusty + env: PLATFORMS=el_puppet5 + rvm: 2.5.1 + before_script: + - bundle exec rake 'litmus:provision_list[waffle_el]' + - bundle exec rake 'litmus:install_agent[puppet5]' + - bundle exec rake litmus:install_module + script: + - bundle exec rake litmus:acceptance:parallel + services: docker + sudo: required + - + bundler_args: + dist: trusty + env: PLATFORMS=el_puppet6 + rvm: 2.5.1 + before_script: + - bundle exec rake 'litmus:provision_list[waffle_el]' + - bundle exec rake 'litmus:install_agent[puppet6]' + - bundle exec rake litmus:install_module + script: + - bundle exec rake litmus:acceptance:parallel services: docker - stage: acceptance sudo: required - env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint" diff --git a/Gemfile b/Gemfile index 60f245f4..0349605d 100644 --- a/Gemfile +++ b/Gemfile @@ -27,6 +27,7 @@ group :development do gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby] gem "puppet-module-win-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw] gem "puppet-module-win-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw] + gem "puppet_litmus", require: false, platforms: [:ruby, :mswin, :mingw, :x64_mingw] if ENV['PUPPET_GEM_VERSION'].nil? or ENV['PUPPET_GEM_VERSION'] !~ %r{ 5} gem "github_changelog_generator", require: false, git: 'https://github.com/skywinder/github-changelog-generator', ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2') end group :system_tests do diff --git a/README.md b/README.md index d8550f01..67481f3c 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,8 @@ For an extensive list of supported operating systems, see [metadata.json](https: ## Development +We are experimenting with a new tool for running acceptance tests. It's name is [puppet_litmus](https://github.com/puppetlabs/puppet_litmus) this replaces beaker as the test runner. To run the acceptance tests follow the instructions [here](https://github.com/puppetlabs/puppet_litmus/wiki/Tutorial:-use-Litmus-to-execute-acceptance-tests-with-a-sample-module-(MoTD)#install-the-necessary-gems-for-the-module). + Puppet modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. Please follow our guidelines when contributing changes. For more information, see our [module contribution guide.](https://puppet.com/docs/puppet/latest/contributing.html) diff --git a/Rakefile b/Rakefile index e596454c..19d583df 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,4 @@ +require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any? require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-syntax/tasks/puppet-syntax' require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any? diff --git a/distelli-manifest.yml b/distelli-manifest.yml new file mode 100644 index 00000000..582115a2 --- /dev/null +++ b/distelli-manifest.yml @@ -0,0 +1,25 @@ +team-modules/puppetlabs-ntp: + PreBuild: + - source /opt/rh/rh-ruby25/enable + - echo "--- LETS update BUNDLER ---" + - bundle install --path vendor/bundle --jobs 3 + Build: + - echo "--- PROVISIONING ---" + - source /opt/rh/rh-ruby25/enable + - bundle exec rake litmus:provision_list[release_checks] + - cat inventory.yaml + - echo "--- AGENT INSTALLATION ---" + - bundle exec rake litmus:install_agent + - echo "--- MODULE INSTALLATION ---" + - bundle exec rake litmus:install_module + - echo "--- TESTS RUNNING ---" + - bundle exec rake litmus:acceptance:parallel + AfterBuildSuccess: + - source /opt/rh/rh-ruby25/enable + - bundle exec rake litmus:tear_down + AfterBuildFailure: + - source /opt/rh/rh-ruby25/enable + - bundle exec rake litmus:tear_down + CommitData: + - RepoType: Git + - RepoPath: . diff --git a/provision.yaml b/provision.yaml new file mode 100644 index 00000000..db986b64 --- /dev/null +++ b/provision.yaml @@ -0,0 +1,19 @@ +--- +default: + provisioner: docker + images: ['waffleimage/centos7'] +travis_deb: + provisioner: docker + images: ['debian:8', 'debian:9', 'ubuntu:14.04', 'ubuntu:16.04', 'ubuntu:18.04'] +waffle_deb: + provisioner: docker + images: ['waffleimage/debian8', 'waffleimage/debian9', 'waffleimage/ubuntu14.04', 'waffleimage/ubuntu16.04', 'waffleimage/ubuntu18.04'] +travis_el: + provisioner: docker + images: ['centos:6', 'centos:7', 'oraclelinux:6', 'oraclelinux:7', 'scientificlinux/sl:6', 'scientificlinux/sl:7'] +waffle_el: + provisioner: docker + images: ['waffleimage/centos6', 'waffleimage/centos7', 'waffleimage/oraclelinux6', 'waffleimage/oraclelinux7', 'waffleimage/scientificlinux6', 'waffleimage/scientificlinux7'] +release_checks: + provisioner: vmpooler + images: ['redhat-5-x86_64', 'redhat-6-x86_64', 'redhat-7-x86_64', 'centos-5-x86_64', 'centos-6-x86_64', 'centos-7-x86_64', 'oracle-5-x86_64', 'oracle-6-x86_64', 'oracle-7-x86_64', 'scientific-6-x86_64', 'scientific-7-x86_64', 'debian-8-x86_64', 'debian-9-x86_64', 'sles-11-x86_64', 'sles-12-x86_64', 'sles-15-x86_64', 'ubuntu-1404-x86_64', 'ubuntu-1604-x86_64', 'ubuntu-1804-x86_64'] diff --git a/spec/acceptance/ntp_parameters_spec.rb b/spec/acceptance/ntp_parameters_spec.rb index 14467ed3..0225bbf1 100644 --- a/spec/acceptance/ntp_parameters_spec.rb +++ b/spec/acceptance/ntp_parameters_spec.rb @@ -45,10 +45,10 @@ describe 'config_template' do before :all do - modulepath = default['distmoduledir'] - shell("mkdir -p #{modulepath}/test/templates") + modulepath = run_shell('puppet config print modulepath').stdout.split(':')[0] + run_shell("mkdir -p #{modulepath}/test/templates") # Add spurious template logic to verify the use of the correct template rendering engine - shell("echo '<% [1].each do |i| %>erbserver<%= i %><%end %>' >> #{modulepath}/test/templates/ntp.conf.erb") + run_shell("echo '<% [1].each do |i| %>erbserver<%= i %><%end %>' >> #{modulepath}/test/templates/ntp.conf.erb") end it 'sets the ntp.conf erb template location' do @@ -66,10 +66,10 @@ describe 'config_epp' do before :all do - modulepath = default['distmoduledir'] - shell("mkdir -p #{modulepath}/test/templates") + modulepath = run_shell('puppet config print modulepath').stdout.split(':')[0] + run_shell("mkdir -p #{modulepath}/test/templates") # Add spurious template logic to verify the use of the correct template rendering engine - shell("echo '<% [1].each |$i| { -%>eppserver<%= $i %><% } -%>' >> #{modulepath}/test/templates/ntp.conf.epp") + run_shell("echo '<% [1].each |$i| { -%>eppserver<%= $i %><% } -%>' >> #{modulepath}/test/templates/ntp.conf.epp") end it 'sets the ntp.conf epp template location' do diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 24f58440..745d46e1 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,55 +1,59 @@ -require 'beaker-pe' -require 'beaker-puppet' -require 'beaker-rspec' -require 'beaker/puppet_install_helper' -require 'beaker/module_install_helper' - -UNSUPPORTED_PLATFORMS = ['windows', 'darwin'].freeze - -run_puppet_install_helper -configure_type_defaults_on(hosts) -install_ca_certs unless ENV['PUPPET_INSTALL_TYPE'] =~ %r{pe}i -install_module_on(hosts) -install_module_dependencies_on(hosts) - -unless ENV['RS_PROVISION'] == 'no' || ENV['BEAKER_provision'] == 'no' - - hosts.each do |host| - # Need to disable update of ntp servers from DHCP, as subsequent restart of ntp causes test failures - if fact_on(host, 'osfamily') == 'Debian' - on host, 'dpkg-divert --divert /etc/dhcp-ntp.bak --local --rename --add /etc/dhcp/dhclient-exit-hooks.d/ntp' - on host, 'dpkg-divert --divert /etc/dhcp3-ntp.bak --local --rename --add /etc/dhcp3/dhclient-exit-hooks.d/ntp' - elsif fact_on(host, 'osfamily') == 'RedHat' - on host, 'echo "PEERNTP=no" >> /etc/sysconfig/network' - end - end -end - -RSpec.configure do |c| - # Project root - proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) - - # Readable test descriptions - c.formatter = :documentation - - # Configure all nodes in nodeset - c.before :suite do - hosts.each do |host| - copy_module_to(host, source: proj_root, module_name: 'ntp') - end +# frozen_string_literal: true + +require 'serverspec' +require 'puppet_litmus' +require 'spec_helper_acceptance_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_acceptance_local.rb')) +include PuppetLitmus + +if ENV['TARGET_HOST'].nil? || ENV['TARGET_HOST'] == 'localhost' + puts 'Running tests against this machine !' + if Gem.win_platform? + set :backend, :cmd + else + set :backend, :exec end -end - -def idempotent_apply(hosts, manifest, opts = {}, &block) - block_on hosts, opts do |host| - file_path = host.tmpfile('apply_manifest.pp') - create_remote_file(host, file_path, manifest + "\n") - - puppet_apply_opts = { :verbose => nil, 'detailed-exitcodes' => nil } - on_options = { acceptable_exit_codes: [0, 2] } - on host, puppet('apply', file_path, puppet_apply_opts), on_options, &block - puppet_apply_opts2 = { :verbose => nil, 'detailed-exitcodes' => nil } - on_options2 = { acceptable_exit_codes: [0] } - on host, puppet('apply', file_path, puppet_apply_opts2), on_options2, &block +else + # load inventory + inventory_hash = inventory_hash_from_inventory_file + node_config = config_from_node(inventory_hash, ENV['TARGET_HOST']) + + if target_in_group(inventory_hash, ENV['TARGET_HOST'], 'docker_nodes') + host = ENV['TARGET_HOST'] + set :backend, :docker + set :docker_container, host + elsif target_in_group(inventory_hash, ENV['TARGET_HOST'], 'ssh_nodes') + set :backend, :ssh + options = Net::SSH::Config.for(host) + options[:user] = node_config.dig('ssh', 'user') unless node_config.dig('ssh', 'user').nil? + options[:port] = node_config.dig('ssh', 'port') unless node_config.dig('ssh', 'port').nil? + options[:keys] = node_config.dig('ssh', 'private-key') unless node_config.dig('ssh', 'private-key').nil? + options[:password] = node_config.dig('ssh', 'password') unless node_config.dig('ssh', 'password').nil? + options[:verify_host_key] = Net::SSH::Verifiers::Null.new unless node_config.dig('ssh', 'host-key-check').nil? + host = if ENV['TARGET_HOST'].include?(':') + ENV['TARGET_HOST'].split(':').first + else + ENV['TARGET_HOST'] + end + set :host, options[:host_name] || host + set :ssh_options, options + set :request_pty, true + elsif target_in_group(inventory_hash, ENV['TARGET_HOST'], 'winrm_nodes') + require 'winrm' + + set :backend, :winrm + set :os, family: 'windows' + user = node_config.dig('winrm', 'user') unless node_config.dig('winrm', 'user').nil? + pass = node_config.dig('winrm', 'password') unless node_config.dig('winrm', 'password').nil? + endpoint = "http://#{ENV['TARGET_HOST']}:5985/wsman" + + opts = { + user: user, + password: pass, + endpoint: endpoint, + operation_timeout: 300, + } + + winrm = WinRM::Connection.new opts + Specinfra.configuration.winrm = winrm end end diff --git a/spec/spec_helper_acceptance_local.rb b/spec/spec_helper_acceptance_local.rb new file mode 100644 index 00000000..00b29f30 --- /dev/null +++ b/spec/spec_helper_acceptance_local.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +UNSUPPORTED_PLATFORMS = ['windows', 'darwin'].freeze + +def disable_ntp_update_from_dhcp + # Need to disable update of ntp servers from DHCP, as subsequent restart of ntp causes test failures + if os[:family] == 'debian' + run_shell('dpkg-divert --divert /etc/dhcp-ntp.bak --local --rename --add /etc/dhcp/dhclient-exit-hooks.d/ntp') + run_shell('dpkg-divert --divert /etc/dhcp3-ntp.bak --local --rename --add /etc/dhcp3/dhclient-exit-hooks.d/ntp') + elsif os[:family] == 'redhat' + run_shell('echo "PEERNTP=no" >> /etc/sysconfig/network') + end +end From f1e8d9d15cb6fd5d194fc7e92519ab32953a7cc8 Mon Sep 17 00:00:00 2001 From: tphoney Date: Fri, 7 Jun 2019 08:54:07 +0100 Subject: [PATCH 2/2] use docker_exp, and clean code --- .travis.yml | 43 +++++++++++++++++++++----- provision.yaml | 19 +++++------- spec/acceptance/ntp_parameters_spec.rb | 3 +- spec/spec_helper_acceptance_local.rb | 10 ------ 4 files changed, 44 insertions(+), 31 deletions(-) diff --git a/.travis.yml b/.travis.yml index 54826a79..e19266c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,7 @@ matrix: bundler_args: dist: trusty env: PLATFORMS=deb_puppet5 - rvm: 2.5.1 + rvm: 2.5.3 before_script: - bundle exec rake 'litmus:provision_list[waffle_deb]' - bundle exec rake 'litmus:install_agent[puppet5]' @@ -39,7 +39,7 @@ matrix: bundler_args: dist: trusty env: PLATFORMS=deb_puppet6 - rvm: 2.5.1 + rvm: 2.5.3 before_script: - bundle exec rake 'litmus:provision_list[waffle_deb]' - bundle exec rake 'litmus:install_agent[puppet6]' @@ -51,10 +51,36 @@ matrix: - bundler_args: dist: trusty - env: PLATFORMS=el_puppet5 - rvm: 2.5.1 + env: PLATFORMS=el6_puppet5 + rvm: 2.5.3 + before_script: + - bundle exec rake 'litmus:provision_list[waffle_el6]' + - bundle exec rake 'litmus:install_agent[puppet5]' + - bundle exec rake litmus:install_module + script: + - bundle exec rake litmus:acceptance:parallel + services: docker + sudo: required + - + bundler_args: + dist: trusty + env: PLATFORMS=el6_puppet6 + rvm: 2.5.3 + before_script: + - bundle exec rake 'litmus:provision_list[waffle_el6]' + - bundle exec rake 'litmus:install_agent[puppet6]' + - bundle exec rake litmus:install_module + script: + - bundle exec rake litmus:acceptance:parallel + services: docker + sudo: required + - + bundler_args: + dist: trusty + env: PLATFORMS=el7_puppet5 + rvm: 2.5.3 before_script: - - bundle exec rake 'litmus:provision_list[waffle_el]' + - bundle exec rake 'litmus:provision_list[waffle_el7]' - bundle exec rake 'litmus:install_agent[puppet5]' - bundle exec rake litmus:install_module script: @@ -64,16 +90,17 @@ matrix: - bundler_args: dist: trusty - env: PLATFORMS=el_puppet6 - rvm: 2.5.1 + env: PLATFORMS=el7_puppet6 + rvm: 2.5.3 before_script: - - bundle exec rake 'litmus:provision_list[waffle_el]' + - bundle exec rake 'litmus:provision_list[waffle_el7]' - bundle exec rake 'litmus:install_agent[puppet6]' - bundle exec rake litmus:install_module script: - bundle exec rake litmus:acceptance:parallel services: docker sudo: required + - env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint" stage: static diff --git a/provision.yaml b/provision.yaml index db986b64..0d6cb612 100644 --- a/provision.yaml +++ b/provision.yaml @@ -1,19 +1,16 @@ --- default: - provisioner: docker + provisioner: docker_exp images: ['waffleimage/centos7'] -travis_deb: - provisioner: docker - images: ['debian:8', 'debian:9', 'ubuntu:14.04', 'ubuntu:16.04', 'ubuntu:18.04'] waffle_deb: - provisioner: docker + provisioner: docker_exp images: ['waffleimage/debian8', 'waffleimage/debian9', 'waffleimage/ubuntu14.04', 'waffleimage/ubuntu16.04', 'waffleimage/ubuntu18.04'] -travis_el: - provisioner: docker - images: ['centos:6', 'centos:7', 'oraclelinux:6', 'oraclelinux:7', 'scientificlinux/sl:6', 'scientificlinux/sl:7'] -waffle_el: - provisioner: docker - images: ['waffleimage/centos6', 'waffleimage/centos7', 'waffleimage/oraclelinux6', 'waffleimage/oraclelinux7', 'waffleimage/scientificlinux6', 'waffleimage/scientificlinux7'] +waffle_el6: + provisioner: docker_exp + images: ['waffleimage/centos6', 'waffleimage/scientificlinux6'] +waffle_el7: + provisioner: docker_exp + images: ['waffleimage/centos7', 'waffleimage/oraclelinux7', 'waffleimage/scientificlinux7'] release_checks: provisioner: vmpooler images: ['redhat-5-x86_64', 'redhat-6-x86_64', 'redhat-7-x86_64', 'centos-5-x86_64', 'centos-6-x86_64', 'centos-7-x86_64', 'oracle-5-x86_64', 'oracle-6-x86_64', 'oracle-7-x86_64', 'scientific-6-x86_64', 'scientific-7-x86_64', 'debian-8-x86_64', 'debian-9-x86_64', 'sles-11-x86_64', 'sles-12-x86_64', 'sles-15-x86_64', 'ubuntu-1404-x86_64', 'ubuntu-1604-x86_64', 'ubuntu-1804-x86_64'] diff --git a/spec/acceptance/ntp_parameters_spec.rb b/spec/acceptance/ntp_parameters_spec.rb index 0225bbf1..50d5947f 100644 --- a/spec/acceptance/ntp_parameters_spec.rb +++ b/spec/acceptance/ntp_parameters_spec.rb @@ -26,6 +26,7 @@ '/etc/ntp.conf' end +modulepath = run_shell('puppet config print modulepath').stdout.split(':')[0] describe 'ntp class', unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) do it 'applies successfully' do pp = "class { 'ntp': }" @@ -45,7 +46,6 @@ describe 'config_template' do before :all do - modulepath = run_shell('puppet config print modulepath').stdout.split(':')[0] run_shell("mkdir -p #{modulepath}/test/templates") # Add spurious template logic to verify the use of the correct template rendering engine run_shell("echo '<% [1].each do |i| %>erbserver<%= i %><%end %>' >> #{modulepath}/test/templates/ntp.conf.erb") @@ -66,7 +66,6 @@ describe 'config_epp' do before :all do - modulepath = run_shell('puppet config print modulepath').stdout.split(':')[0] run_shell("mkdir -p #{modulepath}/test/templates") # Add spurious template logic to verify the use of the correct template rendering engine run_shell("echo '<% [1].each |$i| { -%>eppserver<%= $i %><% } -%>' >> #{modulepath}/test/templates/ntp.conf.epp") diff --git a/spec/spec_helper_acceptance_local.rb b/spec/spec_helper_acceptance_local.rb index 00b29f30..b4a75551 100644 --- a/spec/spec_helper_acceptance_local.rb +++ b/spec/spec_helper_acceptance_local.rb @@ -1,13 +1,3 @@ # frozen_string_literal: true UNSUPPORTED_PLATFORMS = ['windows', 'darwin'].freeze - -def disable_ntp_update_from_dhcp - # Need to disable update of ntp servers from DHCP, as subsequent restart of ntp causes test failures - if os[:family] == 'debian' - run_shell('dpkg-divert --divert /etc/dhcp-ntp.bak --local --rename --add /etc/dhcp/dhclient-exit-hooks.d/ntp') - run_shell('dpkg-divert --divert /etc/dhcp3-ntp.bak --local --rename --add /etc/dhcp3/dhclient-exit-hooks.d/ntp') - elsif os[:family] == 'redhat' - run_shell('echo "PEERNTP=no" >> /etc/sysconfig/network') - end -end