-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
Copy pathshould_modify_home.rb
37 lines (30 loc) · 1.21 KB
/
should_modify_home.rb
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
test_name "should modify the home directory of an user on OS X < 10.14" do
confine :to, :platform => /osx/
confine :except, :platform => /(osx-10.1[4-9]|osx-11-)/
tag 'audit:high',
'audit:acceptance' # Could be done as integration tests, but would
# require changing the system running the test
# in ways that might require special permissions
# or be harmful to the system running the test
require 'puppet/acceptance/common_utils'
extend Puppet::Acceptance::BeakerUtils
extend Puppet::Acceptance::ManifestUtils
user = "pl#{rand(999999).to_i}"
agents.each do |agent|
teardown do
agent.user_absent(user)
end
step "ensure the user is present" do
agent.user_present(user)
end
step "verify that the user has the correct home" do
new_home = "/opt/#{user}"
user_manifest = resource_manifest('user', user, ensure: 'present', home: new_home)
apply_manifest_on(agent, user_manifest)
agent.user_get(user) do |result|
user_home = result.stdout.split(':')[8]
assert_equal(user_home, new_home, "Expected home: #{new_home}, actual home: #{user_home}")
end
end
end
end