Skip to content

Commit

Permalink
Cleanup unused helper code
Browse files Browse the repository at this point in the history
  • Loading branch information
h-haaks committed Dec 21, 2022
1 parent d0169c2 commit 0230b27
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 74 deletions.
2 changes: 0 additions & 2 deletions spec/acceptance/define_patternfile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ def apply_pattern(pattern_number, extra_logstash_class_args = nil)
end

it 'does not restart logstash if logstash::restart_on_change is false' do
os = fact('lsbdistdescription')
skip('Something funky happening with Upstart and Puppet 3?') if (os =~ %r{(centos release 6\.|ubuntu 12\.04)}i) && PUPPET_VERSION[0] == '3'
log = apply_pattern(1, 'restart_on_change => false').stdout
expect(log).not_to include(restart_message)
end
Expand Down
8 changes: 4 additions & 4 deletions spec/defines/define_plugin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
end

let(:pre_condition) do
'
include elastic_stack::repo
include logstash
'
<<~PUPPET
include elastic_stack::repo
include logstash
PUPPET
end

let(:title) { 'logstash-input-mysql' }
Expand Down
68 changes: 0 additions & 68 deletions spec/support/acceptance/helpers.rb
Original file line number Diff line number Diff line change
@@ -1,58 +1,15 @@
# frozen_string_literal: true

require 'beaker-rspec'
require 'net/http'
require 'securerandom'
require 'yaml'

# Collect global options from the environment.
LS_VERSION = ENV['LOGSTASH_VERSION'] || '7.17.7'
PUPPET_VERSION = ENV['PUPPET_VERSION'] || '4.10.7'

PE_VERSION = ENV['BEAKER_PE_VER'] || ENV['PE_VERSION'] || '3.8.3'
PE_DIR = ENV['BEAKER_PE_DIR']

IS_PRERELEASE = if LS_VERSION =~ %r{(alpha|beta|rc)}
true
else
false
end

def agent_version_for_puppet_version(puppet_version)
# REF: https://docs.puppet.com/puppet/latest/reference/about_agent.html
version_map = {
# Puppet => Agent
'4.9.4' => '1.9.3',
'4.8.2' => '1.8.3',
'4.8.1' => '1.8.2',
'4.8.0' => '1.8.0',
'4.7.1' => '1.7.2',
'4.7.0' => '1.7.1',
'4.6.2' => '1.6.2',
'4.6.1' => '1.6.1',
'4.6.0' => '1.6.0',
'4.5.3' => '1.5.3',
'4.4.2' => '1.4.2',
'4.4.1' => '1.4.1',
'4.4.0' => '1.4.0',
'4.3.2' => '1.3.6',
'4.3.1' => '1.3.2',
'4.3.0' => '1.3.0',
'4.2.3' => '1.2.7',
'4.2.2' => '1.2.6',
'4.2.1' => '1.2.2',
'4.2.0' => '1.2.1',
'4.1.0' => '1.1.1',
'4.0.0' => '1.0.1'
}
version_map[puppet_version]
end

def apply_manifest_fixture(manifest_name)
manifest = File.read("./spec/fixtures/manifests/#{manifest_name}.pp")
apply_manifest(manifest, catch_failures: true)
end

def expect_no_change_from_manifest(manifest)
expect(apply_manifest(manifest).exit_code).to eq(0)
end
Expand Down Expand Up @@ -212,28 +169,3 @@ def pipelines_from_yaml
def service_restart_message
"Service[logstash]: Triggered 'refresh'"
end

def pe_package_url
distro, distro_version = ENV['BEAKER_set'].split('-')
case distro
when 'debian'
os = 'debian'
arch = 'amd64'
when 'centos'
os = 'el'
arch = 'x86_64'
when 'ubuntu'
os = 'ubuntu'
arch = 'amd64'
end
url_root = "https://s3.amazonaws.com/pe-builds/released/#{PE_VERSION}"
"#{url_root}/puppet-enterprise-#{PE_VERSION}-#{os}-#{distro_version}-#{arch}.tar.gz"
end

def pe_package_filename
File.basename(pe_package_url)
end

def puppet_enterprise?
ENV['BEAKER_IS_PE'] == 'true' || ENV['IS_PE'] == 'true'
end

0 comments on commit 0230b27

Please sign in to comment.