Skip to content

PDK update. #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
--fail-on-warnings
--relative
--no-80chars-check
--no-140chars-check
--no-class_inherits_from_params_class-check
--no-autoloader_layout-check
--no-documentation-check
--no-single_quote_string_with_variables-check
--ignore-paths=.vendor/**/*.pp,.bundle/**/*.pp,pkg/**/*.pp,spec/**/*.pp,tests/**/*.pp,types/**/*.pp,vendor/**/*.pp
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ group :development do
end
group :development, :release_prep do
gem "puppet-strings", '~> 4.0', require: false
gem "puppetlabs_spec_helper", '~> 7.0', require: false
gem "puppetlabs_spec_helper", '~> 8.0', require: false
gem "puppet-blacksmith", '~> 7.0', require: false
end
group :system_tests do
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw]
Expand Down
9 changes: 9 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,12 @@ require 'puppet-syntax/tasks/puppet-syntax'
require 'puppet-strings/tasks' if Gem.loaded_specs.key? 'puppet-strings'

PuppetLint.configuration.send('disable_relative')
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.send('disable_140chars')
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
PuppetLint.configuration.send('disable_autoloader_layout')
PuppetLint.configuration.send('disable_documentation')
PuppetLint.configuration.send('disable_single_quote_string_with_variables')
PuppetLint.configuration.fail_on_warnings = true
PuppetLint.configuration.ignore_paths = [".vendor/**/*.pp", ".bundle/**/*.pp", "pkg/**/*.pp", "spec/**/*.pp", "tests/**/*.pp", "types/**/*.pp", "vendor/**/*.pp"]

4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"go",
"golang"
],
"pdk-version": "3.2.0",
"pdk-version": "3.3.0",
"template-url": "https://github.com/danielparks/pdk-templates#main",
"template-ref": "heads/main-0-g49046f1"
"template-ref": "heads/main-0-g918ea5f"
}
6 changes: 3 additions & 3 deletions spec/acceptance/golang_from_tarball_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

describe 'defined type golang::from_tarball' do
context 'repeated root installs:' do
context 'default ensure with 1.10.4 source' do
context 'default ensure with gopher-owned source' do
it 'installs Go' do
idempotent_apply(<<~"PUPPET")
golang::from_tarball { '/opt/go':
Expand Down Expand Up @@ -42,7 +42,7 @@
end
end

context 'ensure => present' do
context 'ensure => present with gopher-owned source' do
it 'causes no changes' do
apply_manifest(<<~"PUPPET", catch_changes: true)
golang::from_tarball { '/opt/go':
Expand Down Expand Up @@ -133,7 +133,7 @@
end

context 'as a non-root user' do
context 'default ensure with 1.10.4 source' do
context 'default ensure with gopher-owned source' do
it 'installs Go' do
idempotent_apply(<<~"PUPPET")
group { 'user': }
Expand Down
58 changes: 29 additions & 29 deletions spec/acceptance/golang_installation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

describe 'defined type golang::installation' do
context 'repeated root installs:' do
context "ensure => '1.10.4'" do
context "ensure => '1.22.9'" do
it 'installs Go' do
idempotent_apply(<<~'PUPPET')
golang::installation { '/opt/go':
ensure => '1.10.4',
ensure => '1.22.9',
}
PUPPET
end

describe command('/opt/go/bin/go version') do
its(:stdout) { is_expected.to start_with('go version go1.10.4 ') }
its(:stdout) { is_expected.to start_with('go version go1.22.9 ') }
its(:stderr) { is_expected.to eq '' }
its(:exit_status) { is_expected.to eq 0 }
end
Expand All @@ -30,7 +30,7 @@
end

describe command('/opt/go/bin/go version') do
its(:stdout) { is_expected.to start_with('go version go1.10.4 ') }
its(:stdout) { is_expected.to start_with('go version go1.22.9 ') }
its(:stderr) { is_expected.to eq '' }
its(:exit_status) { is_expected.to eq 0 }
end
Expand Down Expand Up @@ -93,8 +93,8 @@
context 'multiple root installs with linked_binaries' do
it do
idempotent_apply(<<~'PUPPET')
golang::installation { '/opt/go1.10.4':
ensure => '1.10.4',
golang::installation { '/opt/go1.22.9':
ensure => '1.22.9',
}
golang::installation { '/opt/go1.19.1':
ensure => '1.19.1',
Expand All @@ -105,7 +105,7 @@
PUPPET
end

['1.10.4', '1.19.1'].each do |version|
['1.22.9', '1.19.1'].each do |version|
describe file("/opt/go#{version}") do
it { is_expected.to be_directory }
its(:owner) { is_expected.to eq 'root' }
Expand Down Expand Up @@ -140,19 +140,19 @@
context 'multiple root installs with mixed ensure and linked_binaries' do
it do
idempotent_apply(<<~'PUPPET')
golang::installation { '/opt/go1.10.4':
ensure => '1.10.4',
golang::installation { '/opt/go1.22.9':
ensure => '1.22.9',
}
golang::installation { '/opt/go1.19.1':
ensure => absent,
}
golang::linked_binaries { '/opt/go1.10.4':
golang::linked_binaries { '/opt/go1.22.9':
into_bin => '/usr/local/bin',
}
PUPPET
end

describe file('/opt/go1.10.4/bin/go') do
describe file('/opt/go1.22.9/bin/go') do
it { is_expected.to be_file }
it { is_expected.to be_executable }
its(:owner) { is_expected.to eq 'root' }
Expand All @@ -164,11 +164,11 @@

describe file('/usr/local/bin/go') do
it { is_expected.to be_symlink }
it { is_expected.to be_linked_to '/opt/go1.10.4/bin/go' }
it { is_expected.to be_linked_to '/opt/go1.22.9/bin/go' }
end

describe command('/usr/local/bin/go version') do
its(:stdout) { is_expected.to start_with('go version go1.10.4 ') }
its(:stdout) { is_expected.to start_with('go version go1.22.9 ') }
its(:stderr) { is_expected.to eq '' }
its(:exit_status) { is_expected.to eq 0 }
end
Expand All @@ -177,20 +177,20 @@
context 'multiple root uninstalls with linked_binaries' do
it do
idempotent_apply(<<~'PUPPET')
golang::installation { '/opt/go1.10.4':
golang::installation { '/opt/go1.22.9':
ensure => absent,
}
golang::installation { '/opt/go1.19.1':
ensure => absent,
}
golang::linked_binaries { '/opt/go1.10.4':
golang::linked_binaries { '/opt/go1.22.9':
ensure => absent,
into_bin => '/usr/local/bin',
}
PUPPET
end

describe file('/opt/go1.10.4') do
describe file('/opt/go1.22.9') do
it { is_expected.not_to exist }
end

Expand All @@ -206,8 +206,8 @@
context 'multiple user installs with linked_binaries' do
it do
idempotent_apply(<<~"PUPPET")
golang::installation { '#{home}/user/go1.10.4':
ensure => '1.10.4',
golang::installation { '#{home}/user/go1.22.9':
ensure => '1.22.9',
owner => 'user',
group => 'user',
mode => '0700',
Expand Down Expand Up @@ -240,7 +240,7 @@
PUPPET
end

['1.10.4', '1.19.1'].each do |version|
['1.22.9', '1.19.1'].each do |version|
describe file("#{home}/user/go#{version}") do
it { is_expected.to be_directory }
its(:owner) { is_expected.to eq 'user' }
Expand Down Expand Up @@ -279,28 +279,28 @@
context 'multiple user installs with mixed ensure and linked_binaries' do
it do
idempotent_apply(<<~"PUPPET")
golang::installation { '#{home}/user/go1.10.4':
ensure => '1.10.4',
golang::installation { '#{home}/user/go1.22.9':
ensure => '1.22.9',
owner => 'user',
group => 'user',
}
golang::installation { '#{home}/user/go1.19.1':
ensure => absent,
}
golang::linked_binaries { '#{home}/user/go1.10.4':
golang::linked_binaries { '#{home}/user/go1.22.9':
into_bin => '#{home}/user/bin',
}
PUPPET
end

describe file("#{home}/user/go1.10.4") do
describe file("#{home}/user/go1.22.9") do
it { is_expected.to be_directory }
its(:owner) { is_expected.to eq 'user' }
its(:group) { is_expected.to eq 'user' }
it { is_expected.to be_mode 755 } # WTF converted to octal
end

describe file("#{home}/user/go1.10.4/bin/go") do
describe file("#{home}/user/go1.22.9/bin/go") do
it { is_expected.to be_file }
its(:owner) { is_expected.to eq 'user' }
its(:group) { is_expected.to eq 'user' }
Expand All @@ -313,11 +313,11 @@

describe file("#{home}/user/bin/go") do
it { is_expected.to be_symlink }
it { is_expected.to be_linked_to "#{home}/user/go1.10.4/bin/go" }
it { is_expected.to be_linked_to "#{home}/user/go1.22.9/bin/go" }
end

describe command("#{home}/user/bin/go version") do
its(:stdout) { is_expected.to start_with('go version go1.10.4 ') }
its(:stdout) { is_expected.to start_with('go version go1.22.9 ') }
its(:stderr) { is_expected.to eq '' }
its(:exit_status) { is_expected.to eq 0 }
end
Expand All @@ -326,7 +326,7 @@
context 'multiple user uninstalls with linked_binaries' do
it do
idempotent_apply(<<~"PUPPET")
golang::installation { '#{home}/user/go1.10.4':
golang::installation { '#{home}/user/go1.22.9':
ensure => absent,
owner => 'user',
group => 'user',
Expand All @@ -336,14 +336,14 @@
owner => 'user',
group => 'user',
}
golang::linked_binaries { '#{home}/user/go1.10.4':
golang::linked_binaries { '#{home}/user/go1.22.9':
ensure => absent,
into_bin => '#{home}/user/bin',
}
PUPPET
end

describe file("#{home}/user/go1.10.4") do
describe file("#{home}/user/go1.22.9") do
it { is_expected.not_to exist }
end

Expand Down
4 changes: 2 additions & 2 deletions spec/acceptance/golang_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
it do
idempotent_apply(<<~'END')
class { 'golang':
ensure => '1.10.4',
ensure => '1.22.9',
}
END
end
Expand Down Expand Up @@ -69,7 +69,7 @@ class { 'golang':
end

describe command('/usr/local/bin/go version') do
its(:stdout) { is_expected.to start_with('go version go1.10.4 ') }
its(:stdout) { is_expected.to start_with('go version go1.22.9 ') }
its(:stderr) { is_expected.to eq '' }
its(:exit_status) { is_expected.to eq 0 }
end
Expand Down
Loading