1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

MSDNS: Improve reliability of zone dump (#1179)

* MSDNS: Improve reliability of zone dump

* Update tests
This commit is contained in:
Tom Limoncelli
2021-06-24 06:05:33 -04:00
committed by GitHub
parent be1f03fb75
commit 311a6d74ce
2 changed files with 27 additions and 15 deletions

View File

@@ -49,17 +49,17 @@ func Test_generatePSZoneDump(t *testing.T) {
{
name: "local",
args: args{domainname: "example.com"},
want: `Get-DnsServerResourceRecord -ZoneName "example.com" | ConvertTo-Json -depth 4`,
want: `$OutputEncoding = [Text.UTF8Encoding]::UTF8 ; Get-DnsServerResourceRecord -ZoneName "example.com" | Select-Object -Property * -ExcludeProperty Cim* | ConvertTo-Json -depth 4 | Out-File "foo" -Encoding utf8`,
},
{
name: "remote",
args: args{domainname: "example.com", dnsserver: "mydnsserver"},
want: `Get-DnsServerResourceRecord -ComputerName "mydnsserver" -ZoneName "example.com" | ConvertTo-Json -depth 4`,
want: `$OutputEncoding = [Text.UTF8Encoding]::UTF8 ; Get-DnsServerResourceRecord -ComputerName "mydnsserver" -ZoneName "example.com" | Select-Object -Property * -ExcludeProperty Cim* | ConvertTo-Json -depth 4 | Out-File "foo" -Encoding utf8`,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := generatePSZoneDump(tt.args.dnsserver, tt.args.domainname); got != tt.want {
if got := generatePSZoneDump(tt.args.dnsserver, tt.args.domainname, "foo"); got != tt.want {
t.Errorf("generatePSZoneDump() = got=(\n%s\n) want=(\n%s\n)", got, tt.want)
}
})