Promote develop to main - #111
Merged
Merged
Conversation
Implements POST /action/flush/logs, one of the two remaining "Actions" gaps
from the API coverage audit. Flushes the DNS log file and purges the most
recent 24 hours of query history from both the database and FTL's internal
memory.
The other gap, POST /action/flush/arp, is deprecated by Pi-hole itself in
favor of /action/flush/network ("Deprecated! Use '/action/flush/network'
instead."), which the module already implements via
Invoke-PiHoleFlushNetwork - so it's intentionally not being added as a
separate function.
Also fixed a copy-paste bug found along the way: Invoke-PiHoleFlushNetwork's
.DESCRIPTION described flushing a log file, which is what this new function
actually does, not what flushing the network table does.
Verified against a real Pi-hole v6 server: formatted output, RawOutput, and
bad-password error handling. Added a dedicated integration test file.
README regenerated.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Moves every per-function test file from a flat tests/ directory into tests/<Category>/, mirroring PiHoleShell/Public/<Category>/ exactly (e.g. PiHoleShell/Public/Actions/Invoke-PiHoleFlushNetwork.ps1 now pairs with tests/Actions/Invoke-PiHoleFlushNetwork.Integration.Tests.ps1). Shared support files (IntegrationConfig.example.ps1, IntegrationConfig.local.ps1, Initialize-PiHoleTestData.ps1) stay at tests/ root since they don't belong to any single function. Updated every moved file's $PSScriptRoot-relative path lookups for those shared files accordingly (Pester still discovers tests recursively by default, so no path change was needed on the Pester side). This mirroring is what makes the second change straightforward: the Azure DevOps pipeline now scopes PR builds to only the test file(s) matching whatever PiHoleShell/Public/<Category>/<Function>.ps1 files actually changed, instead of always running the entire suite (which includes many real-server integration tests that individually take 10-40+ seconds). Direct pushes to develop/main still always run the full suite. On a PR build, anything that isn't a clean 1:1 function-to-test-file match falls back to the full suite rather than risk silently skipping coverage: changes to Private/ files, PiHoleShell.psm1/.psd1, the shared Request-PiHoleAuth helper (used by every function), the shared test helpers, or a failure computing the diff itself. Changed test files run directly; non-code changes (README, workflows, tools/) are ignored. Verified the scoping logic locally against real git diffs before trusting it in CI, and re-ran a representative slice of the moved integration tests against the real Pi-hole server to confirm the path fixes work end-to-end. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… windows
The changed-file scoping added in the previous commit failed on its first
real run: the default Azure Pipelines checkout is shallow, so there's no
common ancestor with the target branch to diff against ("no merge base"/
"unknown revision"). Fixed by unshallowing first when the repo is shallow,
and fetching the target branch with an explicit refspec so origin/<branch>
gets created even under a checkout whose default fetch refspec is
restricted to a single branch. Verified both fixes end-to-end against a
real shallow, single-branch clone before trusting them in CI again.
Because the scoping fallback ran the full suite on that failed attempt, it
also surfaced a real, pre-existing bug (unrelated to this PR, already
broken on main): Get-PiHoleHistoryDatabase/Get-PiHoleHistoryDatabaseClient
asserted `Should -Not -BeNullOrEmpty` on their history array, but an empty
array is a legitimate response when nothing was logged in the queried
window - unlike the Stats(database) summary endpoints, which always return
a populated object shape even with zero matching rows. Changed those
assertions to verify the call succeeds (and, when data is present, that
its shape is correct) instead of requiring non-empty results.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…-file-ci chore: reorg tests to mirror module structure, scope CI to changed files
Merges the latest develop (which reorganized tests/ to mirror PiHoleShell/Public/<Category>/) into this branch, then moves this PR's own new test file - added before that reorg landed - into tests/Actions/ to match, fixing its $PSScriptRoot-relative IntegrationConfig.local.ps1 lookup accordingly. Verified against the real Pi-hole server post-move. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
feat: add Invoke-PiHoleFlushLogs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Promotes the following merged PRs from
developtomain:Invoke-PiHoleFlushLogs(POST /action/flush/logs), completing the "Actions" API areaTest plan
develop🤖 Generated with Claude Code