Skip to content

Commit

Permalink
pdksync_heads/main-0-g1829b3f
Browse files Browse the repository at this point in the history
  • Loading branch information
Lightning- committed Jul 3, 2024
1 parent fed6063 commit 8d4fca8
Show file tree
Hide file tree
Showing 14 changed files with 90 additions and 70 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@
.envrc
/inventory.yaml
/spec/fixtures/litmus_inventory.yaml
.resource_types
.modules
.task_cache.json
.plan_cache.json
.rerun.json
bolt-debug.log
6 changes: 6 additions & 0 deletions .pdkignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
.envrc
/inventory.yaml
/spec/fixtures/litmus_inventory.yaml
.resource_types
.modules
.task_cache.json
.plan_cache.json
.rerun.json
bolt-debug.log
/.fixtures.yml
/Gemfile
/.gitattributes
Expand Down
7 changes: 7 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ require:
- rubocop-performance
- rubocop-rspec
AllCops:
NewCops: enable
DisplayCopNames: true
TargetRubyVersion: '2.6'
Include:
Expand Down Expand Up @@ -527,6 +528,8 @@ Lint/DuplicateBranch:
Enabled: false
Lint/DuplicateMagicComment:
Enabled: false
Lint/DuplicateMatchPattern:
Enabled: false
Lint/DuplicateRegexpCharacterClassElement:
Enabled: false
Lint/EmptyBlock:
Expand Down Expand Up @@ -643,6 +646,8 @@ Style/ComparableClamp:
Enabled: false
Style/ConcatArrayLiterals:
Enabled: false
Style/DataInheritance:
Enabled: false
Style/DirEmpty:
Enabled: false
Style/DocumentDynamicEvalDefinition:
Expand Down Expand Up @@ -711,6 +716,8 @@ Style/RedundantHeredocDelimiterQuotes:
Enabled: false
Style/RedundantInitialize:
Enabled: false
Style/RedundantLineContinuation:
Enabled: false
Style/RedundantSelfAssignmentBranch:
Enabled: false
Style/RedundantStringEscape:
Expand Down
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"recommendations": [
"puppet.puppet-vscode",
"rebornix.Ruby"
"Shopify.ruby-lsp"
]
}
28 changes: 14 additions & 14 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,30 @@ group :development do
gem "json", '= 2.6.1', require: false if Gem::Requirement.create(['>= 3.1.0', '< 3.1.3']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.6.3', require: false if Gem::Requirement.create(['>= 3.2.0', '< 4.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "racc", '~> 1.4.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "deep_merge", '~> 1.2.2', require: false
gem "voxpupuli-puppet-lint-plugins", '~> 5.0', require: false
gem "facterdb", '~> 1.18', require: false
gem "metadata-json-lint", '~> 3.0', require: false
gem "puppetlabs_spec_helper", '~> 6.0', require: false
gem "rspec-puppet-facts", '~> 2.0', require: false
gem "codecov", '~> 0.2', require: false
gem "facterdb", '~> 1.26', require: false
gem "metadata-json-lint", '~> 4.0', require: false
gem "rspec-puppet-facts", '~> 3.0', require: false
gem "dependency_checker", '~> 1.0.0', require: false
gem "parallel_tests", '= 3.12.1', require: false
gem "pry", '~> 0.10', require: false
gem "simplecov-console", '~> 0.5', require: false
gem "simplecov-console", '~> 0.9', require: false
gem "puppet-debugger", '~> 1.0', require: false
gem "rubocop", '= 1.48.1', require: false
gem "rubocop", '~> 1.50.0', require: false
gem "rubocop-performance", '= 1.16.0', require: false
gem "rubocop-rspec", '= 2.19.0', require: false
gem "puppet-strings", '~> 4.0', require: false
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "rexml", '>= 3.0.0', '< 3.2.7', require: false
end
group :system_tests do
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw]
gem "serverspec", '~> 2.41', require: false
end
group :release_prep do
group :development, :release_prep do
gem "puppet-strings", '~> 4.0', require: false
gem "puppetlabs_spec_helper", '~> 6.0', require: false
gem "puppetlabs_spec_helper", '~> 7.0', require: false
end
group :system_tests do
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw]
gem "CFPropertyList", '< 3.0.7', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "serverspec", '~> 2.41', require: false
end

puppet_version = ENV['PUPPET_GEM_VERSION']
Expand Down
4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"arbitrator",
"garbd"
],
"pdk-version": "3.0.1",
"pdk-version": "3.2.0",
"template-url": "https://github.com/markt-de/pdk-templates.git#main",
"template-ref": "heads/main-0-g909fd77"
"template-ref": "heads/main-0-g1829b3f"
}
4 changes: 2 additions & 2 deletions spec/classes/galera_arbitrator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
facts.merge({})
facts
end

let(:default_params) do
Expand Down Expand Up @@ -55,7 +55,7 @@
it { is_expected.to contain_service('arbitrator-service').with_enable(true) }

describe 'with parameter: arbitrator_service_enabled=false' do
let(:params) { default_params.merge!(arbitrator_service_enabled: false) }
let(:params) { default_params.deep_merge!(arbitrator_service_enabled: false) }

it { is_expected.to contain_service('arbitrator-service').with_enable(false) }
end
Expand Down
8 changes: 4 additions & 4 deletions spec/classes/galera_debian_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'galera::debian' do
let :pre_condition do
let(:pre_condition) do
"class { 'galera':
cluster_name => 'testcluster',
galera_master => 'control1',
Expand Down Expand Up @@ -30,7 +30,7 @@

context 'when this node is the master' do
before(:each) do
facts.merge!(networking: { 'fqdn' => 'control1' })
facts.deep_merge!(networking: { 'fqdn' => 'control1' })
end
let(:node) { 'control1' }

Expand Down Expand Up @@ -69,7 +69,7 @@

context 'when this node is a slave' do
before(:each) do
facts.merge!(networking: { 'fqdn' => 'slave' })
facts.deep_merge!(networking: { 'fqdn' => 'slave' })
end
let(:node) { 'slave' }

Expand All @@ -91,7 +91,7 @@
on_supported_os.each do |os, facts|
context "on #{os}" do # rubocop:disable RSpec/EmptyExampleGroup
let(:facts) do
facts.merge({})
facts
end

case facts[:osfamily]
Expand Down
46 changes: 23 additions & 23 deletions spec/classes/galera_init_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'galera' do
let :params do
let(:params) do
{
arbitrator_config_file: '/etc/default/garb',
arbitrator_package_ensure: 'present',
Expand Down Expand Up @@ -76,17 +76,17 @@
end

context 'when node is the master' do
before(:each) { params.merge!(galera_master: facts[:networking]['fqdn']) }
before(:each) { params.deep_merge!(galera_master: facts[:networking]['fqdn']) }
it { is_expected.to contain_exec('bootstrap_galera_cluster') }
end

context 'when node is not the master' do
before(:each) { params.merge!(galera_master: "not_#{facts[:networking]['fqdn']}") }
before(:each) { params.deep_merge!(galera_master: "not_#{facts[:networking]['fqdn']}") }
it { is_expected.not_to contain_exec('bootstrap_galera_cluster') }
end

context 'when installing mariadb' do
before(:each) { params.merge!(vendor_type: 'mariadb', vendor_version: '10.3') }
before(:each) { params.deep_merge!(vendor_type: 'mariadb', vendor_version: '10.3') }
it {
is_expected.to contain_class('mysql::server').with(
package_name: os_params[:m_mysql_package_name],
Expand All @@ -102,7 +102,7 @@
end

context 'when using xtrabackup' do
before(:each) { params.merge!(wsrep_sst_method: 'xtrabackup') }
before(:each) { params.deep_merge!(wsrep_sst_method: 'xtrabackup') }
it {
if os_params[:p_xtrabackup_package] != 'NONE'
is_expected.to contain_package(os_params[:p_xtrabackup_package]).with(ensure: 'installed')
Expand All @@ -111,7 +111,7 @@
end

context 'when using xtrabackup-v2' do
before(:each) { params.merge!(wsrep_sst_method: 'xtrabackup-v2') }
before(:each) { params.deep_merge!(wsrep_sst_method: 'xtrabackup-v2') }
it {
if os_params[:p_xtrabackup_package] != 'NONE'
is_expected.to contain_package(os_params[:p_xtrabackup_package]).with(ensure: 'installed')
Expand All @@ -120,7 +120,7 @@
end

context 'when using mariabackup' do
before(:each) { params.merge!(vendor_type: 'mariadb', vendor_version: '10.3', wsrep_sst_method: 'mariabackup') }
before(:each) { params.deep_merge!(vendor_type: 'mariadb', vendor_version: '10.3', wsrep_sst_method: 'mariabackup') }
it {
if os_params[:m_mariadb_backup_package_name] != 'NONE'
is_expected.to contain_package(os_params[:m_mariadb_backup_package_name]).with_ensure('installed')
Expand All @@ -130,38 +130,38 @@
end

context 'when managing root .my.cnf' do
before(:each) { params.merge!(create_root_my_cnf: true) }
before(:each) { params.deep_merge!(create_root_my_cnf: true) }
it { is_expected.to contain_class('mysql::server').with(create_root_my_cnf: true) }
it { is_expected.to contain_exec('create .my.cnf for user root') }
end

context 'when not managing root .my.cnf' do
before(:each) { params.merge!(create_root_my_cnf: false) }
before(:each) { params.deep_merge!(create_root_my_cnf: false) }
it { is_expected.to contain_class('mysql::server').with(create_root_my_cnf: false) }
it { is_expected.not_to contain_exec('create .my.cnf for user root') }
end

context 'when create_root_user=undef (default) and the master' do
before(:each) { params.merge!(galera_master: facts[:networking]['fqdn']) }
before(:each) { params.deep_merge!(galera_master: facts[:networking]['fqdn']) }
it { is_expected.to contain_class('galera').with(create_root_user: nil) }
it { is_expected.to contain_class('mysql::server').with(create_root_user: true) }
it { is_expected.to contain_mysql_user('root@localhost') }
end

context 'when create_root_user=undef (default) and not the master' do
before(:each) { params.merge!(galera_master: "not_#{facts[:networking]['fqdn']}") }
before(:each) { params.deep_merge!(galera_master: "not_#{facts[:networking]['fqdn']}") }
it { is_expected.to contain_class('mysql::server').with(create_root_user: false) }
it { is_expected.not_to contain_mysql_user('root@localhost') }
end

context 'when create_root_user=true' do
before(:each) { params.merge!(create_root_user: true) }
before(:each) { params.deep_merge!(create_root_user: true) }
it { is_expected.to contain_class('mysql::server').with(create_root_user: true) }
it { is_expected.to contain_mysql_user('root@localhost') }
end

context 'when create root user is false' do
before(:each) { params.merge!(create_root_user: false) }
before(:each) { params.deep_merge!(create_root_user: false) }
it { is_expected.to contain_class('mysql::server').with(create_root_user: false) }
it { is_expected.not_to contain_mysql_user('root@localhost') }
end
Expand All @@ -174,15 +174,15 @@
end

context 'when create_status_user=false' do
before(:each) { params.merge!(create_status_user: false) }
before(:each) { params.deep_merge!(create_status_user: false) }
it { is_expected.not_to contain_mysql_user('clustercheck@localhost') }
it { is_expected.not_to contain_mysql_user('clustercheck@%') }
it { is_expected.not_to contain_mysql_grant('clustercheck@localhost/*.*') }
it { is_expected.not_to contain_mysql_grant('clustercheck@%/*.*') }
end

context 'when status_allow=example' do
before(:each) { params.merge!(status_allow: 'example') }
before(:each) { params.deep_merge!(status_allow: 'example') }
it { is_expected.to contain_mysql_user('clustercheck@localhost') }
it { is_expected.to contain_mysql_user('clustercheck@example') }
it { is_expected.not_to contain_mysql_user('clustercheck@%') }
Expand All @@ -196,13 +196,13 @@
end

context 'when validate_connection=false' do
before(:each) { params.merge!(validate_connection: false) }
before(:each) { params.deep_merge!(validate_connection: false) }
it { is_expected.not_to contain_class('galera::validate') }
it { is_expected.not_to contain_exec('validate_connection') }
end

context 'when installing codership' do
before(:each) { params.merge!(vendor_type: 'codership') }
before(:each) { params.deep_merge!(vendor_type: 'codership') }
it {
is_expected.to contain_class('mysql::server').with(
package_name: os_params[:c_mysql_package_name],
Expand All @@ -218,7 +218,7 @@

context 'when specifying package names' do
before(:each) do
params.merge!(mysql_package_name: 'mysql-package-test',
params.deep_merge!(mysql_package_name: 'mysql-package-test',
galera_package_name: 'galera-package-test',
galera_package_ensure: 'present')
end
Expand Down Expand Up @@ -246,7 +246,7 @@
# Class[Mysql::Server]: parameter 'package_ensure' expects a match for Variant[Enum['absent', 'present']
#
# context 'when package_ensure=latest' do
# before(:each) { params.merge!(package_ensure: 'latest') }
# before(:each) { params.deep_merge!(package_ensure: 'latest') }
# it { is_expected.to contain_package(os_params[:p_galera_package_name]).with(ensure: 'absent') }
# it {
# is_expected.to contain_class('mysql::server').with(
Expand All @@ -257,19 +257,19 @@
# end
#
# context 'when galera_package_ensure=latest' do
# before(:each) { params.merge!(galera_package_ensure: 'latest') }
# before(:each) { params.deep_merge!(galera_package_ensure: 'latest') }
# it { is_expected.to contain_package(os_params[:p_galera_package_name]).with(ensure: 'latest') }
# end

context 'when configure_firewall=false' do
before(:each) { params.merge!(configure_firewall: false) }
before(:each) { params.deep_merge!(configure_firewall: false) }
it { is_expected.not_to contain_class('galera::firewall') }
it { is_expected.not_to contain_firewall('4567 galera accept tcp') }
end

context 'when specifying logging options' do
before(:each) do
params.merge!(status_log_on_success: 'PID HOST USERID EXIT DURATION TRAFFIC',
params.deep_merge!(status_log_on_success: 'PID HOST USERID EXIT DURATION TRAFFIC',
status_log_on_success_operator: '-=',
status_log_on_failure: 'USERID')
end
Expand All @@ -286,7 +286,7 @@
on_supported_os.each do |os, facts|
context "on #{os}" do # rubocop:disable RSpec/EmptyExampleGroup
let(:facts) do
facts.merge({})
facts
end

let(:os_params) do
Expand Down
Loading

0 comments on commit 8d4fca8

Please sign in to comment.