commit d0cbcd614ab66f2afe01fbec96bc9380bc77bb46
parent ba8951beb0bd2d7a921e97255b3ab8ee3539e88d
Author: triesap <tyson@radroots.org>
Date: Tue, 11 Aug 2026 21:02:15 +0000
test: stabilize packaged health TestKit coverage
- Split each packaged-health failure into an isolated functional test.
- Give immediate fixtures a bounded budget while preserving timeout proof.
- Repeat only the missing-close scenario in the stability lane.
- Retain the original expected and observed diagnostics in output.
Diffstat:
2 files changed, 59 insertions(+), 30 deletions(-)
diff --git a/build-logic/plugins/src/functionalTest/kotlin/org/harvestcircle/buildlogic/plugins/ConventionPluginSmokeTest.kt b/build-logic/plugins/src/functionalTest/kotlin/org/harvestcircle/buildlogic/plugins/ConventionPluginSmokeTest.kt
@@ -320,39 +320,68 @@ class ConventionPluginSmokeTest {
}
@Test
- fun packagingPluginRejectsMissingCloseTimeoutAndSecretOutput() {
- listOf(
- Triple("close", "printf 'HARVESTCIRCLE_HEALTH_READY\\n'", "did not report closed health evidence"),
- Triple("timeout", "sleep 5", "health-check timed out"),
- Triple(
- "redaction",
- "printf 'nsec1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa HARVESTCIRCLE_HEALTH_READY HARVESTCIRCLE_HEALTH_CLOSED\\n'",
- "emitted secret material",
- ),
- Triple(
- "residue",
+ fun packagingPluginRejectsMissingCloseEvidence() {
+ assertPackagingHealthFailure(
+ caseName = "close",
+ scriptBody = "printf 'HARVESTCIRCLE_HEALTH_READY\\n'",
+ expected = "did not report closed health evidence",
+ )
+ }
+
+ @Test
+ fun packagingPluginRejectsHealthTimeout() {
+ assertPackagingHealthFailure(
+ caseName = "timeout",
+ scriptBody = "sleep 5",
+ expected = "health-check timed out",
+ timeoutSeconds = 1L,
+ )
+ }
+
+ @Test
+ fun packagingPluginRejectsSecretHealthOutput() {
+ assertPackagingHealthFailure(
+ caseName = "redaction",
+ scriptBody =
+ "printf 'nsec1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa " +
+ "HARVESTCIRCLE_HEALTH_READY HARVESTCIRCLE_HEALTH_CLOSED\\n'",
+ expected = "emitted secret material",
+ )
+ }
+
+ @Test
+ fun packagingPluginRejectsResidualHealthData() {
+ assertPackagingHealthFailure(
+ caseName = "residue",
+ scriptBody =
"touch \"\$HARVESTCIRCLE_DEVELOPMENT_DATA_DIR/leftover\"; " +
"printf 'HARVESTCIRCLE_HEALTH_READY\\nHARVESTCIRCLE_HEALTH_CLOSED\\n'",
- "did not clean its isolated health data root",
- ),
- ).forEach { (caseName, scriptBody, expected) ->
- val fixture = createTempDirectory("harvestcircle-package-$caseName-")
- preparePackagingBuild(fixture, scriptBody, timeoutSeconds = if (caseName == "timeout") 1L else 10L)
+ expected = "did not clean its isolated health data root",
+ )
+ }
- val result =
- GradleRunner.create()
- .withProjectDir(fixture.toFile())
- .withPluginClasspath()
- .withArguments(
- ":app:desktop:verifyPackagedApplicationHealth",
- "-x",
- ":app:desktop:createDistributable",
- "--stacktrace",
- )
- .buildAndFail()
+ private fun assertPackagingHealthFailure(
+ caseName: String,
+ scriptBody: String,
+ expected: String,
+ timeoutSeconds: Long = 30L,
+ ) {
+ val fixture = createTempDirectory("harvestcircle-package-$caseName-")
+ preparePackagingBuild(fixture, scriptBody, timeoutSeconds = timeoutSeconds)
- assertTrue(result.output.contains(expected), result.output)
- }
+ val result =
+ GradleRunner.create()
+ .withProjectDir(fixture.toFile())
+ .withPluginClasspath()
+ .withArguments(
+ ":app:desktop:verifyPackagedApplicationHealth",
+ "-x",
+ ":app:desktop:createDistributable",
+ "--stacktrace",
+ )
+ .buildAndFail()
+
+ assertTrue(result.output.contains(expected), result.output)
}
@Test
diff --git a/tools/test-build-logic-stability.sh b/tools/test-build-logic-stability.sh
@@ -3,7 +3,7 @@ set -eu
repository_root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
gradle="$repository_root/gradlew"
-test_name='org.harvestcircle.buildlogic.plugins.ConventionPluginSmokeTest.packagingPluginRejectsMissingCloseTimeoutAndSecretOutput'
+test_name='org.harvestcircle.buildlogic.plugins.ConventionPluginSmokeTest.packagingPluginRejectsMissingCloseEvidence'
runs=25
run=1