mirror of
https://github.com/inspec/inspec
synced 2025-02-16 22:18:38 +00:00
CFINSPEC-90: Correct existing unit test for windows to include ipv6 address
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
This commit is contained in:
parent
1200638c84
commit
72a986ace3
3 changed files with 15 additions and 2 deletions
12
test/fixtures/cmd/Resolve-DnsName-ipv6
vendored
Normal file
12
test/fixtures/cmd/Resolve-DnsName-ipv6
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"IP6Address": "2404:6800:4009:827::200e",
|
||||
"Name": "microsoft.com",
|
||||
"Type": 28,
|
||||
"CharacterSet": 1,
|
||||
"Section": 1,
|
||||
"DataLength": 16,
|
||||
"TTL": 176,
|
||||
"Address": "2404:6800:4009:827::200e",
|
||||
"IPAddress": "2404:6800:4009:827::200e",
|
||||
"QueryType": 28
|
||||
}
|
|
@ -366,6 +366,7 @@ class MockLoader
|
|||
"Get-NetAdapterBinding -ComponentID ms_bridge | Get-NetAdapter | Select-Object -Property Name, InterfaceDescription | ConvertTo-Json" => cmd.call("get-netadapter-binding-bridge"),
|
||||
# host for Windows
|
||||
"Resolve-DnsName –Type A microsoft.com | ConvertTo-Json" => cmd.call("Resolve-DnsName"),
|
||||
"Resolve-DnsName –Type AAAA microsoft.com | ConvertTo-Json" => cmd.call("Resolve-DnsName-ipv6"),
|
||||
"Test-NetConnection -ComputerName microsoft.com -WarningAction SilentlyContinue| Select-Object -Property ComputerName, TcpTestSucceeded, PingSucceeded | ConvertTo-Json" => cmd.call("Test-NetConnection"),
|
||||
# host for Linux
|
||||
"getent ahosts example.com" => cmd.call("getent-ahosts-example.com"),
|
||||
|
|
|
@ -32,7 +32,7 @@ describe "Inspec::Resources::Host" do
|
|||
resource = MockLoader.new(:windows).load_resource("host", "microsoft.com")
|
||||
_(resource.resolvable?).must_equal true
|
||||
_(resource.reachable?).must_equal false
|
||||
_(resource.ipaddress).must_equal ["134.170.185.46", "134.170.188.221"]
|
||||
_(resource.ipaddress).must_equal ["134.170.188.221", "2404:6800:4009:827::200e"]
|
||||
_(resource.to_s).must_equal "Host microsoft.com"
|
||||
end
|
||||
|
||||
|
@ -96,7 +96,7 @@ describe "Inspec::Resources::Host" do
|
|||
resource = MockLoader.new(:windows).load_resource("host", "microsoft.com", port: 1234, protocol: "tcp")
|
||||
_(resource.resolvable?).must_equal true
|
||||
_(resource.reachable?).must_equal true
|
||||
_(resource.ipaddress).must_equal ["134.170.185.46", "134.170.188.221"]
|
||||
_(resource.ipaddress).must_equal ["134.170.188.221", "2404:6800:4009:827::200e"]
|
||||
_(resource.to_s).must_equal "Host microsoft.com port 1234 proto tcp"
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue