PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /opt/puppetlabs/puppet/vendor_modules/mount_core/spec/acceptance/tests/
Server: Linux server1.ngambekcore.com 4.18.0-553.51.1.el8_10.x86_64 #1 SMP Wed Apr 30 04:00:07 EDT 2025 x86_64
IP: 159.198.77.92
Choose File :

Url:
Dir : //opt/puppetlabs/puppet/vendor_modules/mount_core/spec/acceptance/tests/query_spec.rb

require 'spec_helper_acceptance'

require 'mount_utils'

RSpec.context 'when managing mounts' do
  agents.each do |agent|
    context "on #{agent}" do
      include_context('mount context', agent)

      it 'finds an existing filesystem table entry' do
        step '(setup) add entry to filesystem table'
        MountUtils.add_entry_to_filesystem_table(agent, name)

        step 'verify mount with puppet'
        on(agent, puppet_resource('mount', "/#{name}")) do |result|
          fail_test "didn't find the mount #{name}" unless %r{'/#{name}':\s+ensure\s+=>\s+'unmounted'}.match?(result.stdout)
        end
      end

      it 'finds an existing filesystem table entry containing whitespace' do
        step '(setup) add entry to filesystem table'
        MountUtils.add_entry_to_filesystem_table(agent, name_w_whitespace)

        step 'verify mount with puppet'
        on(agent, puppet_resource('mount', "'/#{name_w_whitespace}'")) do |result|
          fail_test "didn't find the mount #{name_w_whitespace}" unless %r{'/#{name_w_whitespace}':\s+ensure\s+=>\s+'unmounted'}.match?(result.stdout)
        end
      end

      # There is a discrepancy between how `puppet resource` and `puppet apply` handle this case.
      # With this patch, using a resource title with a trailing slash in `puppet apply` will match a mount resource without a trailing slash.
      # However, `puppet resource mount` with a trailing slash will not match.
      # Therefore, this test cheats by performing the munging that occurs during a manifest application
      it 'finds an existing filesystem table entry with trailing slash' do
        munged_name = name_w_slash.gsub(%r{^(.+?)/*$}, '\1')
        step '(setup) add entry to filesystem table'
        MountUtils.add_entry_to_filesystem_table(agent, name_w_slash)

        step 'verify mount with puppet'
        on(agent, puppet_resource('mount', "/#{munged_name}")) do |result|
          fail_test "didn't find the mount #{name_w_slash}" unless %r{'/#{munged_name}':\s+ensure\s+=>\s+'unmounted'}.match?(result.stdout)
        end
      end
    end
  end
end