From 15f0a642124b870a9901e5f6cd98e29edf40db1a Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 15 Dec 2021 20:49:49 +0100 Subject: [PATCH 1/9] modulesync 5.1.0 --- .msync.yml | 2 +- .puppet-lint.rc | 3 ++- Gemfile | 4 ++-- Rakefile | 2 +- spec/spec_helper.rb | 10 +++++----- spec/spec_helper_acceptance.rb | 2 ++ 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.msync.yml b/.msync.yml index 43966c2f5..a83abd9b6 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '4.2.0' +modulesync_config_version: '5.1.0' diff --git a/.puppet-lint.rc b/.puppet-lint.rc index 33d6a853d..dd8272c7b 100644 --- a/.puppet-lint.rc +++ b/.puppet-lint.rc @@ -1,2 +1,3 @@ --fail-on-warnings ---no-class_inherits_from_params_class-check +--no-parameter_documentation-check +--no-parameter_types-check diff --git a/Gemfile b/Gemfile index a39114ce3..b6dcf456a 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" group :test do - gem 'voxpupuli-test', '~> 2.5', :require => false + gem 'voxpupuli-test', '~> 5.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 1.0', :require => false @@ -21,7 +21,7 @@ end group :release do gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' - gem 'voxpupuli-release', '>= 1.0.2', :require => false + gem 'voxpupuli-release', '>= 1.2.0', :require => false gem 'puppet-strings', '>= 2.2', :require => false end diff --git a/Rakefile b/Rakefile index 80b799d63..f92f05164 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,7 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -# Attempt to load voxupuli-test (which pulls in puppetlabs_spec_helper), +# Attempt to load voxpupuli-test (which pulls in puppetlabs_spec_helper), # otherwise attempt to load it directly. begin require 'voxpupuli/test/rake' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index fb5f0cbea..4d617f393 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,17 +1,17 @@ +# frozen_string_literal: true + # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ # puppetlabs_spec_helper will set up coverage if the env variable is set. # We want to do this if lib exists and it hasn't been explicitly set. -ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../../lib', __FILE__)) +ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../lib', __dir__)) require 'voxpupuli/test/spec_helper' if File.exist?(File.join(__dir__, 'default_module_facts.yml')) facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) - if facts - facts.each do |name, value| - add_custom_fact name.to_sym, value - end + facts&.each do |name, value| + add_custom_fact name.to_sym, value end end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index d3b906bfe..d3a6e23cf 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ From eaac9d32a6b52ee86860e7a00c04691d103d0bce Mon Sep 17 00:00:00 2001 From: Christos Papageorgiou Date: Sun, 13 Mar 2022 11:11:37 +0200 Subject: [PATCH 2/9] modulesync 5.2.0 --- .github/CONTRIBUTING.md | 7 ++- .github/workflows/ci.yml | 84 +++-------------------------------- .github/workflows/release.yml | 32 +++++-------- .msync.yml | 2 +- Dockerfile | 2 +- Gemfile | 4 +- 6 files changed, 23 insertions(+), 108 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 048d2b55d..8b466cfb9 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -124,7 +124,7 @@ If you have Ruby 2.x or want a specific version of Puppet, you must set an environment variable such as: ```sh -export PUPPET_VERSION="~> 5.5.6" +export PUPPET_GEM_VERSION="~> 6.1.0" ``` You can install all needed gems for spec tests into the modules directory by @@ -232,17 +232,16 @@ simple tests against it after applying the module. You can run this with: ```sh -BEAKER_setfile=debian10-x64 bundle exec rake beaker +BEAKER_setfile=debian11-64 bundle exec rake beaker ``` You can replace the string `debian10` with any common operating system. The following strings are known to work: -* ubuntu1604 * ubuntu1804 * ubuntu2004 -* debian9 * debian10 +* debian11 * centos7 * centos8 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d08d05e8f..8a0779116 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,84 +7,12 @@ name: CI on: pull_request concurrency: - group: ${{ github.head_ref }} + group: ${{ github.ref_name }} cancel-in-progress: true jobs: - setup_matrix: - name: 'Setup Test Matrix' - runs-on: ubuntu-latest - timeout-minutes: 40 - outputs: - puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }} - github_action_test_matrix: ${{ steps.get-outputs.outputs.github_action_test_matrix }} - env: - BUNDLE_WITHOUT: development:system_tests:release - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.0' - bundler-cache: true - - name: Run static validations - run: bundle exec rake validate lint check - - name: Run rake rubocop - run: bundle exec rake rubocop - - name: Setup Test Matrix - id: get-outputs - run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false - - unit: - needs: setup_matrix - runs-on: ubuntu-latest - timeout-minutes: 40 - strategy: - fail-fast: false - matrix: - include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}} - env: - BUNDLE_WITHOUT: development:system_tests:release - PUPPET_VERSION: "~> ${{ matrix.puppet }}.0" - name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }}) - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - name: Run tests - run: bundle exec rake parallel_spec - - acceptance: - needs: setup_matrix - runs-on: ubuntu-latest - env: - BUNDLE_WITHOUT: development:test:release - strategy: - fail-fast: false - matrix: - include: ${{fromJson(needs.setup_matrix.outputs.github_action_test_matrix)}} - name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }} - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.0' - bundler-cache: true - - name: Run tests - run: bundle exec rake beaker - env: - BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }} - BEAKER_setfile: ${{ matrix.setfile.value }} - - tests: - needs: - - unit - - acceptance - runs-on: ubuntu-latest - name: Test suite - steps: - - run: echo Test suite completed + puppet: + name: Puppet + uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1 + with: + pidfile_workaround: 'false' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 664ba6946..15f172134 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,26 +9,14 @@ on: tags: - '*' -env: - BUNDLE_WITHOUT: development:test:system_tests - jobs: - deploy: - name: 'deploy to forge' - runs-on: ubuntu-latest - if: github.repository_owner == 'voxpupuli' - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '2.7' - bundler-cache: true - - name: Build and Deploy - env: - # Configure secrets here: - # https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets - BLACKSMITH_FORGE_USERNAME: '${{ secrets.PUPPET_FORGE_USERNAME }}' - BLACKSMITH_FORGE_API_KEY: '${{ secrets.PUPPET_FORGE_API_KEY }}' - run: bundle exec rake module:push + release: + name: Release + uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1 + with: + allowed_owner: 'voxpupuli' + secrets: + # Configure secrets here: + # https://docs.github.com/en/actions/security-guides/encrypted-secrets + username: ${{ secrets.PUPPET_FORGE_USERNAME }} + api_key: ${{ secrets.PUPPET_FORGE_API_KEY }} diff --git a/.msync.yml b/.msync.yml index a83abd9b6..968a93678 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.1.0' +modulesync_config_version: '5.2.0' diff --git a/Dockerfile b/Dockerfile index e3cf307f1..8dd82d636 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ WORKDIR /opt/puppet # https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39 RUN mkdir -p /etc/sv -ARG PUPPET_VERSION="~> 6.0" +ARG PUPPET_GEM_VERSION="~> 6.0" ARG PARALLEL_TEST_PROCESSORS=4 # Cache gems diff --git a/Gemfile b/Gemfile index b6dcf456a..225c39694 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -source ENV['GEM_SOURCE'] || "https://rubygems.org" +source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do gem 'voxpupuli-test', '~> 5.0', :require => false @@ -28,7 +28,7 @@ end gem 'rake', :require => false gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] -puppetversion = ENV['PUPPET_VERSION'] || '>= 6.0' +puppetversion = ENV['PUPPET_GEM_VERSION'] || '>= 6.0' gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby From 6172a65bd44bcebbf5139da51d7ac5d9e87da52e Mon Sep 17 00:00:00 2001 From: Christos Papageorgiou Date: Sun, 13 Mar 2022 11:15:37 +0200 Subject: [PATCH 3/9] robocop:auto_correct --- lib/facter/phpversion.rb | 6 ++++-- lib/puppet/parser/functions/ensure_prefix.rb | 21 +++++++------------ .../parser/functions/to_hash_settings.rb | 5 +++-- lib/puppet/provider/package/pear.rb | 4 +++- lib/puppet/provider/package/pecl.rb | 2 ++ spec/acceptance/php_spec.rb | 3 +++ spec/classes/php_fpm_config_spec.rb | 3 +++ spec/classes/php_fpm_service_spec.rb | 2 ++ spec/classes/php_fpm_spec.rb | 2 ++ spec/classes/php_repo_spec.rb | 3 +++ spec/classes/php_repo_ubuntu_spec.rb | 2 ++ spec/classes/php_spec.rb | 12 +++++++---- spec/defines/config_spec.rb | 2 ++ spec/defines/extension_rhscl_spec.rb | 2 ++ spec/defines/extension_spec.rb | 14 ++++++++----- spec/defines/fpm_pool_spec.rb | 2 ++ spec/functions/to_hash_settings_spec.rb | 2 ++ spec/unit/provider/package/pear_spec.rb | 2 ++ spec/unit/provider/package/pecl_spec.rb | 2 ++ 19 files changed, 64 insertions(+), 27 deletions(-) diff --git a/lib/facter/phpversion.rb b/lib/facter/phpversion.rb index 310f651fd..5f390a8a9 100644 --- a/lib/facter/phpversion.rb +++ b/lib/facter/phpversion.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + Facter.add(:phpversion) do setcode do output = Facter::Util::Resolution.exec('php -v') unless output.nil? - output.split("\n").first.split(' '). - select { |x| x =~ %r{^(?:(\d+)\.)(?:(\d+)\.)?(\*|\d+)} }.first + output.split("\n").first.split. + grep(%r{^(?:(\d+)\.)(?:(\d+)\.)?(\*|\d+)}).first end end end diff --git a/lib/puppet/parser/functions/ensure_prefix.rb b/lib/puppet/parser/functions/ensure_prefix.rb index f1985518b..687800d3e 100644 --- a/lib/puppet/parser/functions/ensure_prefix.rb +++ b/lib/puppet/parser/functions/ensure_prefix.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Puppet::Parser::Functions newfunction(:ensure_prefix, type: :rvalue, doc: <<-EOS @@ -18,26 +19,20 @@ module Puppet::Parser::Functions Will return: ['p.a', 'p.b', 'p.c'] -EOS - ) do |arguments| + EOS + ) do |arguments| if arguments.size < 2 raise(Puppet::ParseError, 'ensure_prefix(): Wrong number of arguments ' \ - "given (#{arguments.size} for 2)") + "given (#{arguments.size} for 2)") end enumerable = arguments[0] - unless enumerable.is_a?(Array) || enumerable.is_a?(Hash) - raise Puppet::ParseError, "ensure_prefix(): expected first argument to be an Array or a Hash, got #{enumerable.inspect}" - end + raise Puppet::ParseError, "ensure_prefix(): expected first argument to be an Array or a Hash, got #{enumerable.inspect}" unless enumerable.is_a?(Array) || enumerable.is_a?(Hash) prefix = arguments[1] if arguments[1] - if prefix - unless prefix.is_a?(String) - raise Puppet::ParseError, "ensure_prefix(): expected second argument to be a String, got #{prefix.inspect}" - end - end + raise Puppet::ParseError, "ensure_prefix(): expected second argument to be a String, got #{prefix.inspect}" if prefix && !prefix.is_a?(String) result = if enumerable.is_a?(Array) # Turn everything into string same as join would do ... @@ -46,10 +41,10 @@ module Puppet::Parser::Functions prefix && !i.start_with?(prefix) ? prefix + i : i end else - Hash[enumerable.map do |k, v| + enumerable.map do |k, v| k = k.to_s [prefix && !k.start_with?(prefix) ? prefix + k : k, v] - end] + end.to_h end return result diff --git a/lib/puppet/parser/functions/to_hash_settings.rb b/lib/puppet/parser/functions/to_hash_settings.rb index 9e33ee97f..9b494beb7 100644 --- a/lib/puppet/parser/functions/to_hash_settings.rb +++ b/lib/puppet/parser/functions/to_hash_settings.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Puppet::Parser::Functions newfunction(:to_hash_settings, type: :rvalue, doc: <<-EOS @@ -23,8 +24,8 @@ module Puppet::Parser::Functions 'foo: a' => {'key' => 'a', 'value' => 1}, 'foo: b' => {'key' => 'b', 'value' => 2} } -EOS - ) do |arguments| + EOS + ) do |arguments| hash, id = arguments id = (id.nil? ? '' : "#{id}: ") diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index 94d5b558c..301dd81a1 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'puppet/provider/package' Puppet::Type.type(:package).provide :pear, parent: Puppet::Provider::Package do @@ -38,7 +40,7 @@ def self.pearsplit(desc, channel) when %r{no packages installed}i then nil when %r{^=} then nil when %r{^package}i then nil - when %r{^(\S+)\s+(\S+)\s+(\S+)\s*$} then + when %r{^(\S+)\s+(\S+)\s+(\S+)\s*$} name = Regexp.last_match(1) version = Regexp.last_match(2) state = Regexp.last_match(3) diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index 442aa45fd..368f92b44 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'puppet/provider/package' Puppet::Type.type(:package).provide :pecl, parent: :pear do diff --git a/spec/acceptance/php_spec.rb b/spec/acceptance/php_spec.rb index f5fc2c312..a78487739 100644 --- a/spec/acceptance/php_spec.rb +++ b/spec/acceptance/php_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' describe 'php with default settings' do @@ -30,6 +32,7 @@ it { is_expected.to be_enabled } end end + context 'default parameters with extensions' do case default[:platform] when %r{ubuntu-20.04}, %r{ubuntu-18.04} diff --git a/spec/classes/php_fpm_config_spec.rb b/spec/classes/php_fpm_config_spec.rb index 18f6c3622..9f0a7b136 100644 --- a/spec/classes/php_fpm_config_spec.rb +++ b/spec/classes/php_fpm_config_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rspec' require 'spec_helper' @@ -13,6 +15,7 @@ it { is_expected.to contain_class('php::globals') } it { is_expected.to contain_class('php::params') } end + describe 'creates config file' do let(:params) do { diff --git a/spec/classes/php_fpm_service_spec.rb b/spec/classes/php_fpm_service_spec.rb index 3fb2c8f0e..6370e05db 100644 --- a/spec/classes/php_fpm_service_spec.rb +++ b/spec/classes/php_fpm_service_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'php::fpm::service', type: :class do diff --git a/spec/classes/php_fpm_spec.rb b/spec/classes/php_fpm_spec.rb index 1d39fa783..b93fbf4d0 100644 --- a/spec/classes/php_fpm_spec.rb +++ b/spec/classes/php_fpm_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'php::fpm', type: :class do diff --git a/spec/classes/php_repo_spec.rb b/spec/classes/php_repo_spec.rb index dc1e5429a..55faf500c 100644 --- a/spec/classes/php_repo_spec.rb +++ b/spec/classes/php_repo_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'php::repo', type: :class do @@ -18,6 +20,7 @@ it { is_expected.to compile.with_all_deps } end end + describe 'when configuring a package repo' do case facts[:osfamily] when 'Debian' diff --git a/spec/classes/php_repo_ubuntu_spec.rb b/spec/classes/php_repo_ubuntu_spec.rb index e283c6b0f..8c7520955 100644 --- a/spec/classes/php_repo_ubuntu_spec.rb +++ b/spec/classes/php_repo_ubuntu_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'php::repo::ubuntu', type: :class do diff --git a/spec/classes/php_spec.rb b/spec/classes/php_spec.rb index 92b9a6c4a..ff181545c 100644 --- a/spec/classes/php_spec.rb +++ b/spec/classes/php_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'php', type: :class do @@ -70,6 +72,7 @@ describe 'works without params' do it { is_expected.to compile.with_all_deps } end + describe 'when called with no parameters' do case facts[:osfamily] when 'Suse', 'RedHat', 'CentOS' @@ -198,6 +201,7 @@ it { is_expected.to contain_file(dstfile).with_content(%r{user = nginx}) } end + describe 'when called with fpm_group parameter' do let(:params) { { fpm_group: 'nginx' } } @@ -297,10 +301,10 @@ { 'settings' => { - 'PHP/memory_limit' => '300M', + 'PHP/memory_limit' => '300M', 'PHP/safe_mode_include_dir' => :undef, - 'PHP/error_reporting' => '', - 'PHP/max_execution_time' => 60 + 'PHP/error_reporting' => '', + 'PHP/max_execution_time' => 60 } } end @@ -314,7 +318,7 @@ describe 'when called with cli_settings parameter' do let(:params) do { - 'settings' => { 'PHP/memory_limit' => '300M' }, + 'settings' => { 'PHP/memory_limit' => '300M' }, 'cli_settings' => { 'PHP/memory_limit' => '1000M' } } end diff --git a/spec/defines/config_spec.rb b/spec/defines/config_spec.rb index 77976bb02..772ccdf2f 100644 --- a/spec/defines/config_spec.rb +++ b/spec/defines/config_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'php::config' do diff --git a/spec/defines/extension_rhscl_spec.rb b/spec/defines/extension_rhscl_spec.rb index 213844e05..383f45821 100644 --- a/spec/defines/extension_rhscl_spec.rb +++ b/spec/defines/extension_rhscl_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'php::extension' do diff --git a/spec/defines/extension_spec.rb b/spec/defines/extension_spec.rb index a3d273b37..d20fee840 100644 --- a/spec/defines/extension_spec.rb +++ b/spec/defines/extension_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'php::extension' do @@ -46,12 +48,13 @@ end it { is_expected.to contain_package('php5-json') } + it do is_expected.to contain_php__config('json').with( file: "#{etcdir}/json.ini", config: { 'extension' => 'json.so', - 'test' => 'foo' + 'test' => 'foo' } ) end @@ -74,7 +77,7 @@ require: nil, config: { 'extension' => 'json.so', - 'test' => 'foo' + 'test' => 'foo' } ) end @@ -118,7 +121,7 @@ is_expected.to contain_php__config('json').with( config: { 'extension' => 'json.so', - 'bar.test' => 'foo' + 'bar.test' => 'foo' } ) end @@ -211,7 +214,7 @@ it { is_expected.to contain_php__config('xdebug').with_file("#{etcdir}/xdebug.ini") } - # note to consider: As of PHP 5.2.0, the JSON extension is bundled and compiled into PHP by default + # NOTE: to consider: As of PHP 5.2.0, the JSON extension is bundled and compiled into PHP by default # http://php.net/manual/en/json.installation.php context 'pecl installation' do let(:title) { 'json' } @@ -229,12 +232,13 @@ it { is_expected.to contain_package('json') } it { is_expected.to contain_package('libmemcached-dev') } it { is_expected.to contain_package('build-essential') } + it do is_expected.to contain_php__config('json').with( file: "#{etcdir}/nice_name.ini", config: { 'extension' => 'nice_name.so', - 'test' => 'foo' + 'test' => 'foo' } ) end diff --git a/spec/defines/fpm_pool_spec.rb b/spec/defines/fpm_pool_spec.rb index d6bdd1f00..a5d6cdd05 100644 --- a/spec/defines/fpm_pool_spec.rb +++ b/spec/defines/fpm_pool_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'php::fpm::pool' do diff --git a/spec/functions/to_hash_settings_spec.rb b/spec/functions/to_hash_settings_spec.rb index de70a8a5e..0b92bca7f 100644 --- a/spec/functions/to_hash_settings_spec.rb +++ b/spec/functions/to_hash_settings_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'to_hash_settings' do diff --git a/spec/unit/provider/package/pear_spec.rb b/spec/unit/provider/package/pear_spec.rb index cdc17ccb7..f0caecb40 100644 --- a/spec/unit/provider/package/pear_spec.rb +++ b/spec/unit/provider/package/pear_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe Puppet::Type.type(:package).provider(:pear) do diff --git a/spec/unit/provider/package/pecl_spec.rb b/spec/unit/provider/package/pecl_spec.rb index 1233a65a7..ba7a82fa1 100644 --- a/spec/unit/provider/package/pecl_spec.rb +++ b/spec/unit/provider/package/pecl_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe Puppet::Type.type(:package).provider(:pecl) do From b8c4503bd11beadae0679188d17c106bfb76678f Mon Sep 17 00:00:00 2001 From: Christos Papageorgiou Date: Sun, 13 Mar 2022 11:27:30 +0200 Subject: [PATCH 4/9] Fix remaining rubocop offences --- lib/puppet/provider/package/pear.rb | 2 ++ spec/acceptance/php_spec.rb | 8 ++------ spec/classes/php_fpm_service_spec.rb | 9 ++------- spec/classes/php_repo_spec.rb | 2 +- spec/classes/php_spec.rb | 4 ++-- spec/defines/config_spec.rb | 2 +- spec/defines/fpm_pool_spec.rb | 6 +++--- 7 files changed, 13 insertions(+), 20 deletions(-) diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index 301dd81a1..e25ddde66 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -34,6 +34,7 @@ def self.pearlist(only = nil) def self.pearsplit(desc, channel) desc.strip! + # rubocop:disable Lint/DuplicateBranch case desc when '' then nil when %r{^installed}i then nil @@ -55,6 +56,7 @@ def self.pearsplit(desc, channel) Puppet.warning format('Could not match %s', desc) nil end + # rubocop:enable Lint/DuplicateBranch end def self.instances diff --git a/spec/acceptance/php_spec.rb b/spec/acceptance/php_spec.rb index a78487739..5ab763d98 100644 --- a/spec/acceptance/php_spec.rb +++ b/spec/acceptance/php_spec.rb @@ -12,7 +12,7 @@ end case default[:platform] - when %r{ubuntu-20.04} + when %r{ubuntu-20.04}, %r{debian-11} packagename = 'php7.4-fpm' when %r{ubuntu-18.04} packagename = 'php7.2-fpm' @@ -20,8 +20,6 @@ packagename = 'php-fpm' when %r{debian-10} packagename = 'php7.3-fpm' - when %r{debian-11} - packagename = 'php7.4-fpm' end describe package(packagename) do it { is_expected.to be_installed } @@ -78,7 +76,7 @@ end case default[:platform] - when %r{ubuntu-20.04} + when %r{ubuntu-20.04}, %r{debian-11} packagename = 'php7.4-fpm' when %r{ubuntu-18.04} packagename = 'php7.2-fpm' @@ -86,8 +84,6 @@ packagename = 'php-fpm' when %r{debian-10} packagename = 'php7.3-fpm' - when %r{debian-11} - packagename = 'php7.4-fpm' end describe package(packagename) do it { is_expected.to be_installed } diff --git a/spec/classes/php_fpm_service_spec.rb b/spec/classes/php_fpm_service_spec.rb index 6370e05db..9bc48d377 100644 --- a/spec/classes/php_fpm_service_spec.rb +++ b/spec/classes/php_fpm_service_spec.rb @@ -25,8 +25,7 @@ it { is_expected.to contain_class('php::pear') } end - describe 'when called with no parameters' do - # rubocop:disable RSpec/RepeatedExample + describe 'when called with no parameters' do # rubocop: disable RSpec/EmptyExampleGroup case facts[:osfamily] when 'Debian' case facts[:operatingsystemrelease] @@ -37,11 +36,7 @@ when '20.04', '11' it { is_expected.to contain_service('php7.4-fpm').with_ensure('running') } end - when 'Suse' - it { is_expected.to contain_service('php-fpm').with_ensure('running') } - when 'FreeBSD' - it { is_expected.to contain_service('php-fpm').with_ensure('running') } - else + when 'Suse', 'FreeBSD' it { is_expected.to contain_service('php-fpm').with_ensure('running') } end end diff --git a/spec/classes/php_repo_spec.rb b/spec/classes/php_repo_spec.rb index 55faf500c..70c006c09 100644 --- a/spec/classes/php_repo_spec.rb +++ b/spec/classes/php_repo_spec.rb @@ -21,7 +21,7 @@ end end - describe 'when configuring a package repo' do + describe 'when configuring a package repo' do # rubocop: disable RSpec/EmptyExampleGroup case facts[:osfamily] when 'Debian' case facts[:operatingsystem] diff --git a/spec/classes/php_spec.rb b/spec/classes/php_spec.rb index ff181545c..ab579318d 100644 --- a/spec/classes/php_spec.rb +++ b/spec/classes/php_spec.rb @@ -73,7 +73,7 @@ it { is_expected.to compile.with_all_deps } end - describe 'when called with no parameters' do + describe 'when called with no parameters' do # rubocop: disable RSpec/EmptyExampleGroup case facts[:osfamily] when 'Suse', 'RedHat', 'CentOS' it { is_expected.to contain_class('php::global') } @@ -127,7 +127,7 @@ end end - describe 'when called with package_prefix parameter' do + describe 'when called with package_prefix parameter' do # rubocop: disable RSpec/EmptyExampleGroup package_prefix = 'myphp-' let(:params) { { package_prefix: package_prefix } } diff --git a/spec/defines/config_spec.rb b/spec/defines/config_spec.rb index 772ccdf2f..f01cbbe9c 100644 --- a/spec/defines/config_spec.rb +++ b/spec/defines/config_spec.rb @@ -4,7 +4,7 @@ describe 'php::config' do on_supported_os.each do |os, facts| - context "on #{os}" do + context "on #{os}" do # rubocop:disable RSpec/EmptyExampleGroup let :facts do facts end diff --git a/spec/defines/fpm_pool_spec.rb b/spec/defines/fpm_pool_spec.rb index a5d6cdd05..649f79352 100644 --- a/spec/defines/fpm_pool_spec.rb +++ b/spec/defines/fpm_pool_spec.rb @@ -4,7 +4,7 @@ describe 'php::fpm::pool' do on_supported_os.each do |os, facts| - context "on #{os}" do + context "on #{os}" do # rubocop: disable RSpec/EmptyExampleGroup let :facts do facts end @@ -12,7 +12,7 @@ case facts[:os]['name'] when 'Debian' - context 'plain config' do + context 'plain config' do # rubocop: disable RSpec/EmptyExampleGroup let(:title) { 'unique-name' } let(:params) { {} } @@ -26,7 +26,7 @@ end end when 'Ubuntu' - context 'plain config' do + context 'plain config' do # rubocop: disable RSpec/EmptyExampleGroup let(:title) { 'unique-name' } let(:params) { {} } From 45b2940115d6adac94c975ba08e5f2b81d2eeba0 Mon Sep 17 00:00:00 2001 From: Christos Papageorgiou Date: Mon, 14 Mar 2022 12:34:05 +0200 Subject: [PATCH 5/9] Fix frozen string error --- lib/puppet/provider/package/pear.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index e25ddde66..80e66a4bd 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -74,10 +74,11 @@ def install(useversion = true) command << '--alldeps' end - pear_pkg = @resource[:source] || @resource[:name] if !@resource[:ensure].is_a?(Symbol) && useversion command << '-f' - pear_pkg << "-#{@resource[:ensure]}" + pear_pkg = "#{@resource[:source] || @resource[:name]}-#{@resource[:ensure]}" + else + pear_pkg = @resource[:source] || @resource[:name] end command << pear_pkg From 2ce23d414ed337f35a4669b16d3c6c4ede00d57d Mon Sep 17 00:00:00 2001 From: Christos Papageorgiou Date: Sun, 20 Mar 2022 18:23:20 +0200 Subject: [PATCH 6/9] Release 8.0.3 --- CHANGELOG.md | 15 ++++++++++++++- REFERENCE.md | 12 +++++++----- metadata.json | 2 +- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 830323371..555c595a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,20 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. -## [v8.0.2](https://github.com/voxpupuli/puppet-php/tree/v8.0.2) (2021-09-05) +## [v8.0.3](https://github.com/voxpupuli/puppet-php/tree/v8.0.3) (2022-03-21) + +[Full Changelog](https://github.com/voxpupuli/puppet-php/compare/v8.0.2...v8.0.3) + +**Fixed bugs:** + +- Fix forcing a php::setting to be absent by setting its value to undef [\#647](https://github.com/voxpupuli/puppet-php/pull/647) ([jadestorm](https://github.com/jadestorm)) + +**Closed issues:** + +- Unable to remove extension configuration settings [\#653](https://github.com/voxpupuli/puppet-php/issues/653) +- update supported os matrix [\#617](https://github.com/voxpupuli/puppet-php/issues/617) + +## [v8.0.2](https://github.com/voxpupuli/puppet-php/tree/v8.0.2) (2021-09-06) [Full Changelog](https://github.com/voxpupuli/puppet-php/compare/v8.0.1...v8.0.2) diff --git a/REFERENCE.md b/REFERENCE.md index 6b2aabed5..d6e5207e7 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -2043,8 +2043,8 @@ Configure php.ini settings The following parameters are available in the `php::config::setting` defined type: * [`key`](#key) -* [`value`](#value) * [`file`](#file) +* [`value`](#value) ##### `key` @@ -2052,18 +2052,20 @@ Data type: `String[1]` -##### `value` +##### `file` -Data type: `Variant[Integer, String]` +Data type: `Stdlib::Absolutepath` -##### `file` +##### `value` -Data type: `Stdlib::Absolutepath` +Data type: `Optional[Variant[Integer, String]]` +Default value: ``undef`` + ### `php::extension` Install a PHP extension package diff --git a/metadata.json b/metadata.json index fa56ba84a..aa6b2f07f 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-php", - "version": "8.0.3-rc0", + "version": "8.0.3", "author": "Vox Pupuli", "summary": "Generic PHP module that supports many platforms", "license": "MIT", From 45d56b8ae8bea1a699090fd87aa6bafc3cd43350 Mon Sep 17 00:00:00 2001 From: Christos Papageorgiou Date: Mon, 21 Mar 2022 10:49:13 +0200 Subject: [PATCH 7/9] [blacksmith] Bump version to 8.0.4-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index aa6b2f07f..d8f729480 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-php", - "version": "8.0.3", + "version": "8.0.4-rc0", "author": "Vox Pupuli", "summary": "Generic PHP module that supports many platforms", "license": "MIT", From c4647f972aa11a45f689f36116a790040ca8ee48 Mon Sep 17 00:00:00 2001 From: Philippe Beaumont Date: Wed, 9 Mar 2022 11:51:18 +0100 Subject: [PATCH 8/9] Change source URL for composer that depend of the channel. initial test for composer --- data/default.yaml | 8 ++++++-- manifests/composer.pp | 9 ++++----- manifests/composer/auto_update.pp | 4 ---- manifests/params.pp | 1 - spec/classes/php_composer_spec.rb | 22 ++++++++++++++++++++++ spec/classes/php_fpm_service_spec.rb | 2 +- spec/classes/php_repo_spec.rb | 2 +- spec/classes/php_spec.rb | 4 ++-- spec/defines/config_spec.rb | 2 +- spec/defines/fpm_pool_spec.rb | 6 +++--- 10 files changed, 40 insertions(+), 20 deletions(-) create mode 100644 spec/classes/php_composer_spec.rb diff --git a/data/default.yaml b/data/default.yaml index 5e9d47959..f75cf051b 100644 --- a/data/default.yaml +++ b/data/default.yaml @@ -1,6 +1,10 @@ --- - lookup_options: php::fpm::pools: merge: first - +php::composer::channel_sources: + stable: 'https://getcomposer.org/download/latest-stable/composer.phar' + preview: 'https://getcomposer.org/download/latest-preview/composer.phar' + snapshot: 'https://getcomposer.org/composer.phar' + 1: 'https://getcomposer.org/download/latest-1.x/composer.phar' + 2: 'https://getcomposer.org/download/latest-2.x/composer.phar' diff --git a/manifests/composer.pp b/manifests/composer.pp index 4177ee220..286b1f225 100644 --- a/manifests/composer.pp +++ b/manifests/composer.pp @@ -2,8 +2,8 @@ # # === Parameters # -# [*source*] -# Holds URL to the Composer source file +# [*channel_sources*] +# Define channel URLs to the Composer source file # # [*path*] # Holds path to the Composer executable @@ -27,7 +27,7 @@ # UNIX group of the root user # class php::composer ( - String $source = $php::params::composer_source, + Hash $channel_sources = {}, Stdlib::Absolutepath $path = $php::params::composer_path, Optional[String[1]] $proxy_type = undef, Optional[String[1]] $proxy_server = undef, @@ -40,7 +40,7 @@ archive { 'download composer': path => $path, - source => $source, + source => $channel_sources.dig($channel), proxy_type => $proxy_type, proxy_server => $proxy_server, } @@ -53,7 +53,6 @@ if $auto_update { class { 'php::composer::auto_update': max_age => $max_age, - source => $source, path => $path, channel => $channel, proxy_type => $proxy_type, diff --git a/manifests/composer/auto_update.pp b/manifests/composer/auto_update.pp index fe7a4f692..51d440165 100644 --- a/manifests/composer/auto_update.pp +++ b/manifests/composer/auto_update.pp @@ -5,9 +5,6 @@ # [*max_age*] # Defines number of days after which Composer should be updated # -# [*source*] -# Holds URL to the Composer source file -# # [*path*] # Holds path to the Composer executable # @@ -30,7 +27,6 @@ # class php::composer::auto_update ( Integer[1] $max_age, - String[1] $source, Stdlib::Absolutepath $path, Php::ComposerChannel $channel = 'stable', Optional[String[1]] $proxy_type = undef, diff --git a/manifests/params.pp b/manifests/params.pp index 9d7d975f5..8e71146c8 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -4,7 +4,6 @@ $ensure = 'present' $fpm_service_enable = true $fpm_service_ensure = 'running' - $composer_source = 'https://getcomposer.org/composer.phar' $composer_path = '/usr/local/bin/composer' $composer_max_age = 30 $pear_ensure = 'present' diff --git a/spec/classes/php_composer_spec.rb b/spec/classes/php_composer_spec.rb new file mode 100644 index 000000000..651b8ca15 --- /dev/null +++ b/spec/classes/php_composer_spec.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'php::composer', type: :class do + on_supported_os.each do |os, facts| + context "on #{os}" do + let :facts do + facts + end + let(:pre_condition) { 'class {"php": composer => false}' } + + describe 'works without params' do + it { is_expected.to compile.with_all_deps } + end + + describe 'when called with no parameters' do + it { is_expected.to contain_file('/usr/local/bin/composer') } + end + end + end +end diff --git a/spec/classes/php_fpm_service_spec.rb b/spec/classes/php_fpm_service_spec.rb index 9bc48d377..06c03d16b 100644 --- a/spec/classes/php_fpm_service_spec.rb +++ b/spec/classes/php_fpm_service_spec.rb @@ -25,7 +25,7 @@ it { is_expected.to contain_class('php::pear') } end - describe 'when called with no parameters' do # rubocop: disable RSpec/EmptyExampleGroup + describe 'when called with no parameters' do case facts[:osfamily] when 'Debian' case facts[:operatingsystemrelease] diff --git a/spec/classes/php_repo_spec.rb b/spec/classes/php_repo_spec.rb index 70c006c09..55faf500c 100644 --- a/spec/classes/php_repo_spec.rb +++ b/spec/classes/php_repo_spec.rb @@ -21,7 +21,7 @@ end end - describe 'when configuring a package repo' do # rubocop: disable RSpec/EmptyExampleGroup + describe 'when configuring a package repo' do case facts[:osfamily] when 'Debian' case facts[:operatingsystem] diff --git a/spec/classes/php_spec.rb b/spec/classes/php_spec.rb index ab579318d..ff181545c 100644 --- a/spec/classes/php_spec.rb +++ b/spec/classes/php_spec.rb @@ -73,7 +73,7 @@ it { is_expected.to compile.with_all_deps } end - describe 'when called with no parameters' do # rubocop: disable RSpec/EmptyExampleGroup + describe 'when called with no parameters' do case facts[:osfamily] when 'Suse', 'RedHat', 'CentOS' it { is_expected.to contain_class('php::global') } @@ -127,7 +127,7 @@ end end - describe 'when called with package_prefix parameter' do # rubocop: disable RSpec/EmptyExampleGroup + describe 'when called with package_prefix parameter' do package_prefix = 'myphp-' let(:params) { { package_prefix: package_prefix } } diff --git a/spec/defines/config_spec.rb b/spec/defines/config_spec.rb index f01cbbe9c..772ccdf2f 100644 --- a/spec/defines/config_spec.rb +++ b/spec/defines/config_spec.rb @@ -4,7 +4,7 @@ describe 'php::config' do on_supported_os.each do |os, facts| - context "on #{os}" do # rubocop:disable RSpec/EmptyExampleGroup + context "on #{os}" do let :facts do facts end diff --git a/spec/defines/fpm_pool_spec.rb b/spec/defines/fpm_pool_spec.rb index 649f79352..a5d6cdd05 100644 --- a/spec/defines/fpm_pool_spec.rb +++ b/spec/defines/fpm_pool_spec.rb @@ -4,7 +4,7 @@ describe 'php::fpm::pool' do on_supported_os.each do |os, facts| - context "on #{os}" do # rubocop: disable RSpec/EmptyExampleGroup + context "on #{os}" do let :facts do facts end @@ -12,7 +12,7 @@ case facts[:os]['name'] when 'Debian' - context 'plain config' do # rubocop: disable RSpec/EmptyExampleGroup + context 'plain config' do let(:title) { 'unique-name' } let(:params) { {} } @@ -26,7 +26,7 @@ end end when 'Ubuntu' - context 'plain config' do # rubocop: disable RSpec/EmptyExampleGroup + context 'plain config' do let(:title) { 'unique-name' } let(:params) { {} } From 5a8244dc3df438032cf53779eb6075939f0c01b6 Mon Sep 17 00:00:00 2001 From: Philippe Beaumont Date: Wed, 9 Mar 2022 11:51:18 +0100 Subject: [PATCH 9/9] Change source URL for composer that depend of the channel. initial test for composer --- data/default.yaml | 8 ++++++-- manifests/composer.pp | 9 ++++----- manifests/composer/auto_update.pp | 4 ---- manifests/params.pp | 1 - spec/classes/php_composer_spec.rb | 22 ++++++++++++++++++++++ spec/classes/php_fpm_service_spec.rb | 2 +- spec/classes/php_repo_spec.rb | 2 +- spec/classes/php_spec.rb | 4 ++-- spec/defines/config_spec.rb | 2 +- spec/defines/fpm_pool_spec.rb | 6 +++--- 10 files changed, 40 insertions(+), 20 deletions(-) create mode 100644 spec/classes/php_composer_spec.rb diff --git a/data/default.yaml b/data/default.yaml index 5e9d47959..f75cf051b 100644 --- a/data/default.yaml +++ b/data/default.yaml @@ -1,6 +1,10 @@ --- - lookup_options: php::fpm::pools: merge: first - +php::composer::channel_sources: + stable: 'https://getcomposer.org/download/latest-stable/composer.phar' + preview: 'https://getcomposer.org/download/latest-preview/composer.phar' + snapshot: 'https://getcomposer.org/composer.phar' + 1: 'https://getcomposer.org/download/latest-1.x/composer.phar' + 2: 'https://getcomposer.org/download/latest-2.x/composer.phar' diff --git a/manifests/composer.pp b/manifests/composer.pp index 4177ee220..286b1f225 100644 --- a/manifests/composer.pp +++ b/manifests/composer.pp @@ -2,8 +2,8 @@ # # === Parameters # -# [*source*] -# Holds URL to the Composer source file +# [*channel_sources*] +# Define channel URLs to the Composer source file # # [*path*] # Holds path to the Composer executable @@ -27,7 +27,7 @@ # UNIX group of the root user # class php::composer ( - String $source = $php::params::composer_source, + Hash $channel_sources = {}, Stdlib::Absolutepath $path = $php::params::composer_path, Optional[String[1]] $proxy_type = undef, Optional[String[1]] $proxy_server = undef, @@ -40,7 +40,7 @@ archive { 'download composer': path => $path, - source => $source, + source => $channel_sources.dig($channel), proxy_type => $proxy_type, proxy_server => $proxy_server, } @@ -53,7 +53,6 @@ if $auto_update { class { 'php::composer::auto_update': max_age => $max_age, - source => $source, path => $path, channel => $channel, proxy_type => $proxy_type, diff --git a/manifests/composer/auto_update.pp b/manifests/composer/auto_update.pp index fe7a4f692..51d440165 100644 --- a/manifests/composer/auto_update.pp +++ b/manifests/composer/auto_update.pp @@ -5,9 +5,6 @@ # [*max_age*] # Defines number of days after which Composer should be updated # -# [*source*] -# Holds URL to the Composer source file -# # [*path*] # Holds path to the Composer executable # @@ -30,7 +27,6 @@ # class php::composer::auto_update ( Integer[1] $max_age, - String[1] $source, Stdlib::Absolutepath $path, Php::ComposerChannel $channel = 'stable', Optional[String[1]] $proxy_type = undef, diff --git a/manifests/params.pp b/manifests/params.pp index 9d7d975f5..8e71146c8 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -4,7 +4,6 @@ $ensure = 'present' $fpm_service_enable = true $fpm_service_ensure = 'running' - $composer_source = 'https://getcomposer.org/composer.phar' $composer_path = '/usr/local/bin/composer' $composer_max_age = 30 $pear_ensure = 'present' diff --git a/spec/classes/php_composer_spec.rb b/spec/classes/php_composer_spec.rb new file mode 100644 index 000000000..651b8ca15 --- /dev/null +++ b/spec/classes/php_composer_spec.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'php::composer', type: :class do + on_supported_os.each do |os, facts| + context "on #{os}" do + let :facts do + facts + end + let(:pre_condition) { 'class {"php": composer => false}' } + + describe 'works without params' do + it { is_expected.to compile.with_all_deps } + end + + describe 'when called with no parameters' do + it { is_expected.to contain_file('/usr/local/bin/composer') } + end + end + end +end diff --git a/spec/classes/php_fpm_service_spec.rb b/spec/classes/php_fpm_service_spec.rb index 9bc48d377..06c03d16b 100644 --- a/spec/classes/php_fpm_service_spec.rb +++ b/spec/classes/php_fpm_service_spec.rb @@ -25,7 +25,7 @@ it { is_expected.to contain_class('php::pear') } end - describe 'when called with no parameters' do # rubocop: disable RSpec/EmptyExampleGroup + describe 'when called with no parameters' do case facts[:osfamily] when 'Debian' case facts[:operatingsystemrelease] diff --git a/spec/classes/php_repo_spec.rb b/spec/classes/php_repo_spec.rb index 70c006c09..55faf500c 100644 --- a/spec/classes/php_repo_spec.rb +++ b/spec/classes/php_repo_spec.rb @@ -21,7 +21,7 @@ end end - describe 'when configuring a package repo' do # rubocop: disable RSpec/EmptyExampleGroup + describe 'when configuring a package repo' do case facts[:osfamily] when 'Debian' case facts[:operatingsystem] diff --git a/spec/classes/php_spec.rb b/spec/classes/php_spec.rb index ab579318d..ff181545c 100644 --- a/spec/classes/php_spec.rb +++ b/spec/classes/php_spec.rb @@ -73,7 +73,7 @@ it { is_expected.to compile.with_all_deps } end - describe 'when called with no parameters' do # rubocop: disable RSpec/EmptyExampleGroup + describe 'when called with no parameters' do case facts[:osfamily] when 'Suse', 'RedHat', 'CentOS' it { is_expected.to contain_class('php::global') } @@ -127,7 +127,7 @@ end end - describe 'when called with package_prefix parameter' do # rubocop: disable RSpec/EmptyExampleGroup + describe 'when called with package_prefix parameter' do package_prefix = 'myphp-' let(:params) { { package_prefix: package_prefix } } diff --git a/spec/defines/config_spec.rb b/spec/defines/config_spec.rb index f01cbbe9c..772ccdf2f 100644 --- a/spec/defines/config_spec.rb +++ b/spec/defines/config_spec.rb @@ -4,7 +4,7 @@ describe 'php::config' do on_supported_os.each do |os, facts| - context "on #{os}" do # rubocop:disable RSpec/EmptyExampleGroup + context "on #{os}" do let :facts do facts end diff --git a/spec/defines/fpm_pool_spec.rb b/spec/defines/fpm_pool_spec.rb index 649f79352..a5d6cdd05 100644 --- a/spec/defines/fpm_pool_spec.rb +++ b/spec/defines/fpm_pool_spec.rb @@ -4,7 +4,7 @@ describe 'php::fpm::pool' do on_supported_os.each do |os, facts| - context "on #{os}" do # rubocop: disable RSpec/EmptyExampleGroup + context "on #{os}" do let :facts do facts end @@ -12,7 +12,7 @@ case facts[:os]['name'] when 'Debian' - context 'plain config' do # rubocop: disable RSpec/EmptyExampleGroup + context 'plain config' do let(:title) { 'unique-name' } let(:params) { {} } @@ -26,7 +26,7 @@ end end when 'Ubuntu' - context 'plain config' do # rubocop: disable RSpec/EmptyExampleGroup + context 'plain config' do let(:title) { 'unique-name' } let(:params) { {} }