Skip to content

Commit 2cd323b

Browse files
inode64claude
andcommitted
test(config): stub active-unit discovery in the php-fpm catalog test
Objective: keep TestPHPFPMCatalogDisabledProbeValidates independent of the host's running services. On the CI runner an active php8.3-fpm unit made the template materialize php-fpm8.3, whose app the fake bindir does not carry. Invariant: the shipped php-fpm profile with its fpm probe disabled still validates on systemd and OpenRC; no systemctl or rc-status call leaves the test. Evidence: make check; go test -race -count=1 -shuffle=on ./internal/config; the test also passes with a fake systemctl reporting php8.3-fpm active and with /usr/bin/php* hidden through an overlay mount. Limitations: None. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent aaf18dd commit 2cd323b

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎internal/config/php_fpm_catalog_test.go‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import "testing"
77
// backends. The php-fpm8.4 instance comes from a fake binary under a stubbed
88
// ${bindir}, so the result does not depend on which PHP the host has installed.
99
// Validate covers the whole catalog, and its python services need the python3
10-
// app template materialized the same way.
10+
// app template materialized the same way. Active-unit discovery is stubbed
11+
// empty so a php-fpm unit running on the host cannot materialize a version
12+
// the fake bindir does not carry.
1113
func TestPHPFPMCatalogDisabledProbeValidates(t *testing.T) {
1214
bindir := t.TempDir()
1315
fakeBinary(t, bindir, "php-fpm8.4")
@@ -19,7 +21,9 @@ func TestPHPFPMCatalogDisabledProbeValidates(t *testing.T) {
1921
"sermo.yml": "engine: {backend: " + backend + "}\npaths: {services: [@ROOT@/services]}\ndefaults: {policy: {cooldown: 5m}}\n",
2022
"services/php.yml": "name: php-fpm8.4\nuses: php-fpm8.4\nwatches:\n fpm: {enabled: false}\n",
2123
})
22-
cfg, err := loadConfig(t, global, WithCatalogDirs(repoCatalogDir(repoRoot(t))))
24+
cfg, err := loadConfig(t, global,
25+
WithCatalogDirs(repoCatalogDir(repoRoot(t))),
26+
withServiceUnits(backend, nil))
2327
if err != nil {
2428
t.Fatal(err)
2529
}

0 commit comments

Comments
 (0)