Skip to content

Commit

Permalink
Merge 6fc9ee1 into 6915b3e
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjfisher committed Mar 2, 2020
2 parents 6915b3e + 6fc9ee1 commit 8fd1c8e
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 25 deletions.
6 changes: 4 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,18 +256,20 @@ Beaker also supports docker containers. We also use that in our automated CI
pipeline at [travis-ci](http://travis-ci.org). To use that instead of Vagrant:

```sh
PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker
PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian10-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker
```

You can replace the string `debian9` with any common operating system.
You can replace the string `debian10` with any common operating system.
The following strings are known to work:

* ubuntu1604
* ubuntu1804
* debian8
* debian9
* debian10
* centos6
* centos7
* centos8

The easiest way to debug in a docker container is to open a shell:

Expand Down
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
modulesync_config_version: '2.10.0'
modulesync_config_version: '2.11.0'
3 changes: 2 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require: rubocop-rspec
AllCops:
TargetRubyVersion: 2.1
# Puppet Server 5 defaults to jruby 1.7 so TargetRubyVersion must stay at 1.9 until we drop support for puppet 5
TargetRubyVersion: 1.9
Include:
- ./**/*.rb
Exclude:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ group :test do
gem 'puppet-lint-legacy_facts-check', :require => false
gem 'puppet-lint-anchor-check', :require => false
gem 'metadata-json-lint', :require => false
gem 'redcarpet', :require => false
gem 'rubocop', '~> 0.49.1', :require => false
gem 'rubocop-rspec', '~> 1.15.0', :require => false
gem 'mocha', '~> 1.4.0', :require => false
Expand Down Expand Up @@ -62,6 +61,7 @@ group :system_tests do
gem 'rbnacl', '>= 4', :require => false
gem 'rbnacl-libsodium', :require => false
gem 'bcrypt_pbkdf', :require => false
gem 'ed25519', :require => false
end

group :release do
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace :check do
desc 'Check for trailing whitespace'
task :trailing_whitespace do
Dir.glob('**/*.md', File::FNM_DOTMATCH).sort.each do |filename|
next if filename =~ %r{^((modules|acceptance|\.?vendor|spec/fixtures|pkg)/|REFERENCE.md)}
next if filename =~ %r{^((modules|acceptance|\.?vendor|spec/fixtures|pkg)/|REFERENCE.md|CHANGELOG.md)}
File.foreach(filename).each_with_index do |line, index|
if line =~ %r{\s\n$}
puts "#{filename} has trailing whitespace on line #{index + 1}"
Expand Down
20 changes: 10 additions & 10 deletions lib/puppet/provider/proxy_mysql_galera_hostgroup/proxysql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,20 @@ def sql_where
end

def self.namevar_db_fields
%i[
writer_hostgroup
backup_writer_hostgroup
reader_hostgroup
offline_hostgroup
[
:writer_hostgroup,
:backup_writer_hostgroup,
:reader_hostgroup,
:offline_hostgroup
]
end

def self.integer_db_fields
namevar_db_fields + %i[
active
max_writers
writer_is_also_reader
max_transactions_behind
namevar_db_fields + [
:active,
:max_writers,
:writer_is_also_reader,
:max_transactions_behind
]
end

Expand Down
10 changes: 5 additions & 5 deletions lib/puppet/type/proxy_mysql_galera_hostgroup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ def self.title_patterns
end

validate do
%i[
writer_hostgroup
backup_writer_hostgroup
reader_hostgroup
offline_hostgroup
[
:writer_hostgroup,
:backup_writer_hostgroup,
:reader_hostgroup,
:offline_hostgroup
].each do |namevar|
raise Puppet::Error, "proxy_mysql_galera_hostgroup: #{namevar} is required or use `<writer_hostgroup>-<backup_writer_hostgroup>-<reader_hostgroup>-<offline_hostgroup>` style resource title" unless self[namevar]
end
Expand Down
6 changes: 6 additions & 0 deletions spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ class { 'proxysql':
its(:exit_status) { is_expected.to eq 0 }
its(:stderr) { is_expected.to match %r{^ProxySQL version 1\.4\.} }
end

if fact('os.family') == 'RedHat'
describe command('yum clean metadata') do
its(:exit_status) { is_expected.to eq 0 }
end
end
end
end

Expand Down
6 changes: 5 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,14 @@
# Otherwise we need to match the correct facter version to the used puppet version.
# as of 2019-10-31, puppet 5 ships facter 3.11 and puppet 6 ships facter 3.14
# https://puppet.com/docs/puppet/5.5/about_agent.html
#
# The environment variable `PUPPET_VERSION` is available in our travis environment, but we cannot rely on it
# if somebody runs the tests locally. For that case we should fallback the the puppet gem version.
c.default_facter_version = if ENV['FACTERDB_FACTS_VERSION']
ENV['FACTERDB_FACTS_VERSION']
else
Gem::Dependency.new('', ENV['PUPPET_VERSION']).match?('', '5') ? '3.11.0' : '3.14.0'
puppet_version = ENV['PUPPET_VERSION'] ? ENV['PUPPET_VERSION'] : Gem.loaded_specs['puppet'].version.to_s
Gem::Dependency.new('', puppet_version).match?('', '5') ? '3.11.0' : '3.14.0'
end

# Coverage generation
Expand Down
6 changes: 3 additions & 3 deletions spec/unit/puppet/type/proxy_mysql_galera_hostgroup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

describe Puppet::Type.type(:proxy_mysql_galera_hostgroup) do
describe 'parameters' do
%i[name provider writer_hostgroup backup_writer_hostgroup reader_hostgroup offline_hostgroup load_to_runtime save_to_disk].each do |param|
[:name, :provider, :writer_hostgroup, :backup_writer_hostgroup, :reader_hostgroup, :offline_hostgroup, :load_to_runtime, :save_to_disk].each do |param|
it "should have a #{param} parameter" do
expect(described_class.attrtype(param)).to eq(:param)
end
end
%i[ensure active max_writers writer_is_also_reader max_transactions_behind comment].each do |prop|
[:ensure, :active, :max_writers, :writer_is_also_reader, :max_transactions_behind, :comment].each do |prop|
it "should have a #{prop} property" do
expect(described_class.attrtype(prop)).to eq(:property)
end
Expand All @@ -19,7 +19,7 @@
it 'has 5 namevars' do
expect(described_class.key_attributes.size).to eq(5)
end
%i[name writer_hostgroup backup_writer_hostgroup reader_hostgroup offline_hostgroup].each do |param|
[:name, :writer_hostgroup, :backup_writer_hostgroup, :reader_hostgroup, :offline_hostgroup].each do |param|
it "'#{param}' should be a namevar" do
expect(described_class.key_attributes).to include(param)
end
Expand Down

0 comments on commit 8fd1c8e

Please sign in to comment.