mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-11 10:31:16 +10:00
Adding Mullvad to DNS (#4927)
* Update dns.json * Fix Mullvad DNS review issues * Add Mullvad secondary resolvers * Register DoH before changing adapter DNS * Report DNS failures to tweak workflow * Handle non-terminating DNS assignment failures * Preserve DNS fallback and document Mullvad options --------- Co-authored-by: Chris Titus <contact@christitus.com>
This commit is contained in:
co-authored by
Chris Titus
parent
afc3e1eec2
commit
0aa4ab3a40
+29
-1
@@ -181,9 +181,14 @@ Describe "Invoke-WPFtweaksbutton" {
|
||||
text = "Cloudflare"
|
||||
}
|
||||
})
|
||||
$script:capturedTweaksScriptBlock = $null
|
||||
|
||||
Mock Invoke-WPFRunspace { [pscustomobject]@{ MockHandle = $true } }
|
||||
Mock Invoke-WPFRunspace {
|
||||
$script:capturedTweaksScriptBlock = $ScriptBlock
|
||||
[pscustomobject]@{ MockHandle = $true }
|
||||
}
|
||||
Mock Invoke-WinUtilTweaks { }
|
||||
Mock Set-WinUtilTweaksProgressIndicator { }
|
||||
Mock Invoke-WPFUIThread { }
|
||||
Mock Write-WinUtilLog { }
|
||||
Mock Write-Host { }
|
||||
@@ -191,6 +196,7 @@ Describe "Invoke-WPFtweaksbutton" {
|
||||
|
||||
AfterEach {
|
||||
Remove-Variable -Name sync -Scope Script -ErrorAction SilentlyContinue
|
||||
Remove-Variable -Name capturedTweaksScriptBlock -Scope Script -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
It "passes selected tweaks, DNS provider, and progress counters to the tweak runspace" {
|
||||
@@ -236,4 +242,26 @@ Describe "Invoke-WPFtweaksbutton" {
|
||||
$ParameterList[3][1] -eq 2
|
||||
}
|
||||
}
|
||||
|
||||
It "stops the tweak workflow when the DNS change fails" {
|
||||
$script:sync.selectedTweaks.Add("WPFTweaksTelemetry")
|
||||
Mock Set-WinUtilDNS { return $false }
|
||||
|
||||
Invoke-WPFtweaksbutton
|
||||
& $script:capturedTweaksScriptBlock -tweaks @("WPFTweaksTelemetry") -dnsProvider "Mullvad" -completedSteps 0 -totalSteps 1
|
||||
|
||||
Should -Invoke -CommandName Invoke-WinUtilTweaks -Times 0 -Exactly
|
||||
Should -Invoke -CommandName Set-WinUtilTweaksProgressIndicator -Times 1 -Exactly -ParameterFilter {
|
||||
$Visible -eq $true -and $Label -eq "DNS change failed" -and $Percent -eq 100
|
||||
}
|
||||
Should -Invoke -CommandName Invoke-WPFUIThread -Times 1 -Exactly -ParameterFilter {
|
||||
$ScriptBlock.ToString() -like '*Set-WinUtilTaskbaritem -state "Error" -overlay "warning"*'
|
||||
}
|
||||
Should -Invoke -CommandName Write-WinUtilLog -Times 1 -Exactly -ParameterFilter {
|
||||
$Level -eq "ERROR" -and
|
||||
$Component -eq "Tweaks" -and
|
||||
$Message -eq "Tweaks workflow stopped because the DNS change failed."
|
||||
}
|
||||
$script:sync.ProcessRunning | Should -BeFalse
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user