File: sysctl_spec.rb

package info (click to toggle)
ruby-rspec-puppet 4.0.2%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,444 kB
  • sloc: ruby: 6,377; makefile: 6
file content (27 lines) | stat: -rw-r--r-- 660 bytes parent folder | download
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
# frozen_string_literal: true

require 'spec_helper'

nodoublequotes = proc do |x|
  !x.include?('"')
end

describe 'sysctl' do
  let(:title) { 'vm.swappiness' }
  let(:params) { { value: '60' } }
  let(:pre_condition) {}

  it { is_expected.to contain_class('sysctl::common') }

  it {
    expect(subject).to create_augeas('sysctl/vm.swappiness')
      .with_context('/files/etc/sysctl.conf')
      .with_changes("set vm.swappiness '60'")
      .with_changes(nodoublequotes)
      .with_onlyif("match vm.swappiness[.='60'] size == 0")
      .with_notify('Exec[sysctl/reload]')
      .without_foo
  }

  it { is_expected.to have_sysctl_resource_count(1) }
end