Skip to content

Commit 5d91f45

Browse files
author
Patrick Meier
committed
added test to check unique UID's
Signed-off-by: Patrick Meier <patrick.meier111@googlemail.com>
1 parent 84dff35 commit 5d91f45

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

default/serverspec/os_spec.rb

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# encoding: utf-8
2+
3+
require 'spec_helper'
4+
5+
RSpec.configure do |c|
6+
c.filter_run_excluding skipOn: backend(Serverspec::Commands::Base).check_os[:family]
7+
end
8+
19
# GIS: Req 3.21-4
210
describe command('find / -name \'.rhosts\' | wc -l ') do
311
its(:stdout) { should match(/^0/) }
@@ -93,5 +101,14 @@
93101
end
94102
end
95103

96-
97-
# trennen von sysctl und uid's mit einer map suchen
104+
# GIS: Req 3.21-16
105+
describe "Unique uid" do
106+
it "check for unique uid's" do
107+
actual = command('cat /etc/passwd | cut -d \':\' -f 3').stdout.split(/\r?\n/)
108+
hm = actual.each_with_object(Hash.new(0)) { |d,counts| counts[d] += 1 }
109+
hm.each do |k,v|
110+
str = "User: UID #{k} instances: "
111+
("#{str}#{v}").should eq("#{str}1")
112+
end
113+
end
114+
end

0 commit comments

Comments
 (0)