From b5ef3311d3887ea3c3e26b8fb41d1787d60a3020 Mon Sep 17 00:00:00 2001 From: Daniel Parks Date: Sun, 1 Dec 2024 00:16:44 -0800 Subject: [PATCH 1/3] PDK update. --- .puppet-lint.rc | 8 ++++++++ Gemfile | 3 ++- Rakefile | 9 +++++++++ metadata.json | 4 ++-- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.puppet-lint.rc b/.puppet-lint.rc index cc96ece..9e15c6e 100644 --- a/.puppet-lint.rc +++ b/.puppet-lint.rc @@ -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 diff --git a/Gemfile b/Gemfile index 8e9f845..f84ea87 100644 --- a/Gemfile +++ b/Gemfile @@ -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] diff --git a/Rakefile b/Rakefile index 77590fe..31b5930 100644 --- a/Rakefile +++ b/Rakefile @@ -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"] + diff --git a/metadata.json b/metadata.json index df0b7e4..c9555c1 100644 --- a/metadata.json +++ b/metadata.json @@ -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" } From ecb8f05cebf75f36b9d268d7ab814378da7f4ed3 Mon Sep 17 00:00:00 2001 From: Daniel Parks Date: Sun, 1 Dec 2024 12:32:29 -0800 Subject: [PATCH 2/3] Acceptance tests: fix 404 error downloading tarball Go 1.10.4 is not available for Darwin/ARM, so this switches to a more recent version when installing a specific version. This does not change installing from a specific source tarball. --- spec/acceptance/golang_installation_spec.rb | 58 ++++++++++----------- spec/acceptance/golang_spec.rb | 4 +- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/spec/acceptance/golang_installation_spec.rb b/spec/acceptance/golang_installation_spec.rb index 5c5dc06..ea00f86 100644 --- a/spec/acceptance/golang_installation_spec.rb +++ b/spec/acceptance/golang_installation_spec.rb @@ -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 @@ -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 @@ -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', @@ -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' } @@ -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' } @@ -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 @@ -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 @@ -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', @@ -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' } @@ -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' } @@ -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 @@ -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', @@ -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 diff --git a/spec/acceptance/golang_spec.rb b/spec/acceptance/golang_spec.rb index 66d112a..51337a3 100644 --- a/spec/acceptance/golang_spec.rb +++ b/spec/acceptance/golang_spec.rb @@ -40,7 +40,7 @@ it do idempotent_apply(<<~'END') class { 'golang': - ensure => '1.10.4', + ensure => '1.22.9', } END end @@ -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 From f2fa69df437d8fdcb353d81301036f347a5b2833 Mon Sep 17 00:00:00 2001 From: Daniel Parks Date: Sun, 1 Dec 2024 12:33:05 -0800 Subject: [PATCH 3/3] Acceptance tests: clarify point of using a particular source tarball. --- spec/acceptance/golang_from_tarball_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/acceptance/golang_from_tarball_spec.rb b/spec/acceptance/golang_from_tarball_spec.rb index 946a317..01f8194 100644 --- a/spec/acceptance/golang_from_tarball_spec.rb +++ b/spec/acceptance/golang_from_tarball_spec.rb @@ -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': @@ -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': @@ -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': }