Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for DNS function #72

Merged
merged 14 commits into from
Feb 19, 2019
72 changes: 72 additions & 0 deletions Tests/integration/DNS.Tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#
# Copyright 2018, Alexis La Goutte <alexis.lagoutte at gmail dot com>
# Copyright 2018, Cédric Moreau <moreaucedric0 at gmail dot com>
#
# SPDX-License-Identifier: Apache-2.0
#

. ../common.ps1

Describe "Get-ArubaSWDns" {
It "Get-ArubaSWDns Does not throw an error" {
{ Get-ArubaSWDns } | Should Not Throw
}
}

Describe "Set-ArubaSWDns" {
It "Set ArubaSWDns ip server 1" {
Set-ArubaSWDns -mode Manual -server1 1.1.1.1
$dns = Get-ArubaSWDns
$dns.server_1.version | Should be "IAV_IP_V4"
$dns.server_1.octets | Should be "1.1.1.1"
$dns.server_2 | Should -BeNullOrEmpty
$dns.dns_domain_names | Should -BeNullOrEmpty
Remove-ArubaSWDns -mode Manual -noconfirm
}

It "Set ArubaSWDns ip server 2" {
Set-ArubaSWDns -mode Manual -server2 8.8.8.8
$dns = Get-ArubaSWDns
$dns.server_1 | Should -BeNullOrEmpty
$dns.server_2.version | Should be "IAV_IP_V4"
$dns.server_2.octets | Should be "8.8.8.8"
$dns.dns_domain_names | Should -BeNullOrEmpty
Remove-ArubaSWDns -mode Manual -noconfirm
}

It "Set ArubaSWDns dns domain names" {
Set-ArubaSWDns -mode Manual -server1 1.1.1.1 -server2 8.8.8.8 -domain example.org
$dns = Get-ArubaSWDns
$dns.server_1.version | Should be "IAV_IP_V4"
$dns.server_1.octets | Should be "1.1.1.1"
$dns.server_2.version | Should be "IAV_IP_V4"
$dns.server_2.octets | Should be "8.8.8.8"
$dns.dns_domain_names | Should be "example.org"
Remove-ArubaSWDns -mode Manual -noconfirm
}
It "Set ArubaSWDns dns (multiple) domain names" {
Set-ArubaSWDns -mode Manual -server1 1.1.1.1 -server2 8.8.8.8 -domain example.org, example.net
$dns = Get-ArubaSWDns
$dns.server_1.version | Should be "IAV_IP_V4"
$dns.server_1.octets | Should be "1.1.1.1"
$dns.server_2.version | Should be "IAV_IP_V4"
$dns.server_2.octets | Should be "8.8.8.8"
$dns.dns_domain_names[0] | Should be "example.org"
$dns.dns_domain_names[1] | Should be "example.net"
Remove-ArubaSWDns -mode Manual -noconfirm
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a example with DHCP mode ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

always valid request

Describe "Remove-ArubaSWDns" {
It "Remove ArubaSWDns (Mode Manual)" {
Set-ArubaSWDns -mode Manual -server1 1.1.1.1 -server2 8.8.8.8 -domain example.org
Remove-ArubaSWDns -mode Manual -noconfirm
$dns = Get-ArubaSWDns
$dns.dns_config_mode | Should be "DCM_MANUAL"
$dns.server_1 | Should -BeNullOrEmpty
$dns.server_2 | Should -BeNullOrEmpty
$dns.dns_domain_names | Should -BeNullOrEmpty
}
}

Disconnect-ArubaSW -noconfirm