mirror of
https://github.com/inspec/inspec
synced 2024-11-10 07:04:15 +00:00
CFINSPEC-291: Fix test according to changes introduced in processes
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
This commit is contained in:
parent
39b4f0a7a5
commit
c3b1ce3e9e
3 changed files with 14 additions and 5 deletions
6
test/fixtures/cmd/get-process_processes
vendored
6
test/fixtures/cmd/get-process_processes
vendored
|
@ -1,3 +1,3 @@
|
|||
PriorityClass,Id,CPU,PM,VirtualMemorySize,NPM,SessionId,Responding,StartTime,TotalProcessorTime,UserName,Path
|
||||
Normal,2456,0.296875,4808704,118202368,14576,1,True,5/31/2017 9:13:17 AM,00:00:00.2968750,WINVAGR-QQQNHPN\Administrator,C:\Windows\system32\mmc.exe
|
||||
High,396,0.15625,1323008,53710848,7776,1,True,5/31/2017 9:12:56 AM,00:00:00.1562500,NT AUTHORITY\SYSTEM,C:\Windows\system32\winlogon.exe
|
||||
PriorityClass,Id,CPU,PM,VirtualMemorySize,NPM,SessionId,Responding,StartTime,TotalProcessorTime,UserName,Path,ProcessName
|
||||
Normal,2456,0.296875,4808704,118202368,14576,1,True,5/31/2017 9:13:17 AM,00:00:00.2968750,WINVAGR-QQQNHPN\Administrator,C:\Windows\system32\mmc.exe,,
|
||||
High,396,0.15625,1323008,53710848,7776,1,True,5/31/2017 9:12:56 AM,00:00:00.1562500,NT AUTHORITY\SYSTEM,C:\Windows\system32\winlogon.exe,winlogon
|
||||
|
|
|
@ -528,7 +528,8 @@ class MockLoader
|
|||
# modprobe for kernel_module
|
||||
"modprobe --showconfig" => cmd.call("modprobe-config"),
|
||||
# get-process cmdlet for processes resource
|
||||
'$Proc = Get-Process -IncludeUserName | Where-Object {$_.Path -ne $null } | Select-Object PriorityClass,Id,CPU,PM,VirtualMemorySize,NPM,SessionId,Responding,StartTime,TotalProcessorTime,UserName,Path | ConvertTo-Csv -NoTypeInformation;$Proc.Replace("""","").Replace("`r`n","`n")' => cmd.call("get-process_processes"),
|
||||
# '$Proc = Get-Process -IncludeUserName | Where-Object {$_.Path -ne $null } | Select-Object PriorityClass,Id,CPU,PM,VirtualMemorySize,NPM,SessionId,Responding,StartTime,TotalProcessorTime,UserName,Path | ConvertTo-Csv -NoTypeInformation;$Proc.Replace("""","").Replace("`r`n","`n")' => cmd.call("get-process_processes"),
|
||||
'$Proc = Get-Process -IncludeUserName | Select-Object PriorityClass,Id,CPU,PM,VirtualMemorySize,NPM,SessionId,Responding,StartTime,TotalProcessorTime,UserName,Path,ProcessName | ConvertTo-Csv -NoTypeInformation;$Proc.Replace("""","").Replace("`r`n","`n")' => cmd.call("get-process_processes"),
|
||||
# host resource: TCP/UDP reachability check on linux
|
||||
%{sh -c 'type "nc"'} => empty.call,
|
||||
%{sh -c 'type "ncat"'} => empty.call,
|
||||
|
|
|
@ -29,6 +29,7 @@ describe "Inspec::Resources::Processes" do
|
|||
time: "0:00.05",
|
||||
user: "root",
|
||||
command: "login -fp apop",
|
||||
process_name: nil,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -48,6 +49,7 @@ describe "Inspec::Resources::Processes" do
|
|||
time: "00:00:00",
|
||||
user: "opscode-pgsql",
|
||||
command: "postgres: bifrost bifrost 127.0.0.1(43699) idle",
|
||||
process_name: nil,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -68,6 +70,7 @@ describe "Inspec::Resources::Processes" do
|
|||
time: "00:00:00",
|
||||
user: "opscode-pgsql",
|
||||
command: "postgres: bifrost bifrost 127.0.0.1(43699) idle",
|
||||
process_name: nil,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -87,6 +90,7 @@ describe "Inspec::Resources::Processes" do
|
|||
time: "00:01:01",
|
||||
user: "root",
|
||||
command: "/usr/local/apache2/bin/httpd -k start",
|
||||
process_name: nil,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -96,7 +100,7 @@ describe "Inspec::Resources::Processes" do
|
|||
_(process.user).must_equal "opscode-pgsql"
|
||||
_(process[:user]).must_equal "opscode-pgsql"
|
||||
_(process["user"]).must_equal "opscode-pgsql"
|
||||
_(process[-1]).must_equal "postgres: bifrost bifrost 127.0.0.1(43699) idle"
|
||||
_(process[-2]).must_equal "postgres: bifrost bifrost 127.0.0.1(43699) idle"
|
||||
_(process[1]).must_equal 5127
|
||||
end
|
||||
|
||||
|
@ -139,6 +143,7 @@ describe "Inspec::Resources::Processes" do
|
|||
time: "00:00:00",
|
||||
user: "ntp",
|
||||
command: "/usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 112:117",
|
||||
process_name: nil,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -158,6 +163,7 @@ describe "Inspec::Resources::Processes" do
|
|||
time: "0:00",
|
||||
user: "joe",
|
||||
command: "/some/other/coolprogram",
|
||||
process_name: nil,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -177,6 +183,7 @@ describe "Inspec::Resources::Processes" do
|
|||
time: "3:50",
|
||||
user: "frank",
|
||||
command: "/a/bigger/program",
|
||||
process_name: nil,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -196,6 +203,7 @@ describe "Inspec::Resources::Processes" do
|
|||
time: "39:00",
|
||||
user: "tim",
|
||||
command: "/the/biggest/program",
|
||||
process_name: nil,
|
||||
})
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue