Skip to content

fix: source Azure DevOps pipeline secrets from the dns3 variable group - #91

Merged
mikemadeja merged 4 commits into
mainfrom
develop
Sep 19, 2026
Merged

mikemadeja merged 4 commits into
mainfrom
develop

Conversation

@mikemadeja

Copy link
Copy Markdown
Owner

Summary

Updates azuredevops-pihole-pester-tests.yml to pull its Pi-hole server credentials from the dns3 variable group in Azure DevOps (PiHoleServer, PiHoleToken, PiHoleIgnoreSsl), replacing the placeholder PiHoleTestServer/PiHoleTestToken pipeline variables from the original draft.

PiHoleIgnoreSsl's value in the group is the literal text $true, so it's substituted unquoted into the generated tests/IntegrationConfig.local.ps1 rather than as a quoted string, so it evaluates as an actual PowerShell boolean.

Test plan

  • Validated the updated YAML parses correctly
  • Dry-ran the exact config-writing script locally with env values matching the variable group, then dot-sourced the generated file and confirmed $PiHoleIgnoreSsl is [bool]$true (not the string "$true") and $PiHoleServer is a [uri]
  • Confirm a real pipeline run against the mmadeja-dt agent picks up the group correctly

🤖 Generated with Claude Code

mikemadeja and others added 4 commits September 19, 2026 13:26
Replaces the placeholder PiHoleTestServer/PiHoleTestToken pipeline
variables with a reference to the actual 'dns3' variable group
(PiHoleServer, PiHoleToken, PiHoleIgnoreSsl), matching what's really
configured in Azure DevOps. PiHoleIgnoreSsl's value is the literal
text '$true', so it's substituted unquoted into the generated config
script rather than as a quoted string, so it evaluates as a real
boolean - verified locally that the dot-sourced result is
[bool]$true, not the string "$true".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
fix: source Azure DevOps pipeline secrets from the dns3 variable group
…ice flakiness

Set-PiHoleDnsBlocking.Tests.ps1 has failed on every run since before
this branch existed: it mocked Request-PiHoleAuth and Format-PiHoleSecond,
both internal (unexported) helpers, without -ModuleName PiHoleShell, so
Pester's Mock couldn't find or intercept them - the module import
itself failed with CommandNotFoundException. Rewrote it to mock every
internal call (Request-PiHoleAuth, Format-PiHoleSecond,
Remove-PiHoleCurrentAuthSession, Invoke-RestMethod) with -ModuleName,
use Should -Invoke instead of the deprecated Assert-MockCalled, fix
RawOutput being passed as a bare switch when the parameter is [bool]
(same issue fixed earlier in the Actions functions), and assert on
actual error content instead of an unrealistic Should -Throw (the
function's catch block calls Write-Error, which doesn't throw by
default).

Restart-PiHoleDnsService.Integration.Tests.ps1 restarts the real
pihole-FTL service twice back-to-back (once per test), and the CI
agent's second call would occasionally hit the service while it was
still coming back up. Added a short Start-Sleep before the second
restart; confirmed stable over 3 consecutive real-server runs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
fix: repair Set-PiHoleDnsBlocking unit test and Restart-PiHoleDnsService flakiness
@mikemadeja
mikemadeja merged commit fb9e452 into main Sep 19, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant