Skip to content

test: cover redis session store staging - #1331

Merged
ramonskie merged 1 commit into
masterfrom
test/sessions-service-binding
Oct 22, 2026
Merged

ramonskie merged 1 commit into
masterfrom
test/sessions-service-binding

Conversation

@ramonskie

Copy link
Copy Markdown
Contributor

Adds switchblade coverage for apps bound to a Redis session store. There is none today: the existing with_phpredis integration test binds no service, so the sessions extension never runs its Compile phase.

What the test does

  • Deploys fixtures/with_sessions with a user-provided service named redis-sessions (WithServices).
  • Asserts staging succeeds and the logs contain the extension Compile phase with no compilation failure.
  • Asserts the runtime php.ini directives the extension rewrites are visible: session.save_handler=redis, session.name=PHPSESSIONID.

The fixture only reads ini_get() values and never starts a session, so no Redis server is required.

Why it fails right now

NewPHPConfigHelper resolves php.ini/php-fpm.conf from ctx.BuildDir, which is empty at staging. It opens the relative path php/etc/php.ini, so the app fails with:

Extension compilation failed: extension sessions compile failed: failed to load PHP config: failed to load php.ini: failed to read config file php/etc/php.ini: no such file or directory

Fix is in #1313. This PR is expected to be red until that lands; it is the regression guard for it. Rebase/re-run after #1313 merges, no changes to the test should be needed.

Notes

  • CI runs the integration suite on the docker platform, where WithServices turns each entry into a user-provided VCAP_SERVICES entry named <app>-<key>. The redis-sessions key is what triggers SessionsExtension.ShouldCompile.
  • Adds one app push per integration matrix entry.

The sessions extension reads php.ini and php-fpm.conf through
NewPHPConfigHelper, which resolves those paths from ctx.BuildDir. BUILD_DIR
is not exported by the lifecycle, and PHP config is written under the
dependency directory, so any app bound to a *-sessions service fails
staging with "extension sessions compile failed: failed to load PHP config".

Add a switchblade integration test that binds a user-provided service named
redis-sessions, asserts staging succeeds, and checks the runtime php.ini
directives the extension rewrites. The fixture reads the ini values without
starting a session, so no Redis server is needed.

Expected to fail until #1313 is merged.
@ramonskie
ramonskie merged commit ba71ede into master Oct 22, 2026
4 of 7 checks passed
@ramonskie
ramonskie deleted the test/sessions-service-binding branch October 22, 2026 11:42
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