Skip to content

Fix Actions endpoint bugs, add real-server integration tests, CI pipeline, and modernized README - #77

Merged
mikemadeja merged 7 commits into
mainfrom
develop
Sep 18, 2026
Merged

mikemadeja merged 7 commits into
mainfrom
develop

Conversation

@mikemadeja

Copy link
Copy Markdown
Owner

Summary

  • Fixes Invoke-PiHoleFlushNetwork hitting the wrong endpoint (/api/action/flush/logs instead of /api/action/flush/network) and a double-slash URL bug shared with Restart-PiHoleDnsService, both confirmed 404ing against a real server. Both functions now also type $PiHoleServer as [System.URI] and $Password as mandatory [string], matching every other function in the module.
  • Adds Pester integration tests for the three Actions functions that run against a live Pi-hole server (tagged Integration, skipped automatically without a local config file so no credentials are ever committed).
  • Adds an Azure DevOps pipeline (azuredevops-pihole-pester-tests.yml) that runs on an on-prem self-hosted agent able to reach the internal Pi-hole server, running both unit and integration tests on push/PR.
  • Modernizes README.md: badges, a full command reference by category, a testing section, and fixed image links that used non-portable backslash paths.

Test plan

  • Invoke-Pester -Path .\tests -TagFilter Integration — all integration tests pass against a live Pi-hole v6 server
  • Invoke-Pester -Path .\tests\Set-PiHoleDnsBlocking.Tests.ps1 — confirmed its pre-existing failure predates this change (present on main too)
  • Invoke-ScriptAnalyzer -Path .\PiHoleShell\Public\Actions -Recurse — no findings
  • Dry-ran the new Azure DevOps pipeline steps directly on the on-prem agent machine

🤖 Generated with Claude Code

mikemadeja and others added 7 commits September 17, 2026 12:32
Invoke-PiHoleFlushNetwork posted to /api/action/flush/logs instead of
/api/action/flush/network. Both it and Restart-PiHoleDnsService built
the request URL via string interpolation of the [uri] PiHoleServer
value, which appends a trailing slash and produced a double slash
that the real API 404s on. Both now use .ToString().TrimEnd('/').

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds Pester integration tests for Invoke-PiHoleFlushNetwork,
Restart-PiHoleDnsService, and Update-PiHoleActionsGravity that run
against a live Pi-hole server instead of mocks. Tests are tagged
'Integration' and skip automatically unless
tests/IntegrationConfig.local.ps1 is present; that file is gitignored
so real server credentials never get committed. A tracked
IntegrationConfig.example.ps1 documents the expected shape.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Add badges, a table of contents, a command reference grouped by
category (flagging work-in-progress functions), and a testing section
covering the new unit/integration Pester split. Also fixes the
Pi-hole app-password screenshot links, which used backslash paths
that don't render on GitHub.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Runs on the mmadeja-dt self-hosted agent so it can reach the internal
Pi-hole server and exercise both the mocked unit tests and the
real-server integration tests. The integration config file is written
from secret pipeline variables (PiHoleTestServer/PiHoleTestToken) and
deleted after the run regardless of outcome.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… building

Matches the pattern already used elsewhere in the module. Building the
request URL from .OriginalString instead of ToString().TrimEnd('/')
needs PiHoleServer to actually be a [uri] object; it was previously
untyped, so a caller passing a plain string (as the function's own
.EXAMPLE showed) would have silently produced a broken relative URL.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Invoke-PiHoleFlushNetwork and Restart-PiHoleDnsService were the only
functions in the module missing [Parameter(Mandatory = $true)]
[string]$Password, unlike every other public function.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Fix Actions endpoint bugs, add real-server integration tests, modernize README
@mikemadeja
mikemadeja merged commit e4f6084 into main Sep 18, 2026
2 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