File: defined_spec.rb

package info (click to toggle)
puppet-agent 8.10.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 27,392 kB
  • sloc: ruby: 286,820; sh: 492; xml: 116; makefile: 88; cs: 68
file content (38 lines) | stat: -rw-r--r-- 1,240 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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 'defines a mount entry' do
        step 'creates a mount'
        args = ['ensure=defined',
                "fstype=#{fs_type}",
                "device='/tmp/#{name}'"]
        on(agent, puppet_resource('mount', "/#{name}", args))

        step 'verify entry in filesystem table'
        on(agent, "cat #{fs_file}")  do |result|
          fail_test "didn't find the mount #{name}" unless result.stdout.include?(name)
        end
      end

      it 'defines a mount entry with whitespace' do
        step 'creates a mount'
        args = ['ensure=defined',
                "fstype=#{fs_type}",
                "device='/tmp/#{name_w_whitespace}'"]
        on(agent, puppet_resource('mount', "'/#{name_w_whitespace}'", args))

        step 'verify entry in filesystem table'
        on(agent, "cat #{fs_file}") do |result|
          munged_name = name_w_whitespace.gsub(' ', '\\\040')
          fail_test "didn't find the mount #{name_w_whitespace}" unless result.stdout.include?(munged_name)
        end
      end
    end
  end
end