Repository navigation
Conversation
…- roles stay off (0039), a session's page comes from the application each time and nothing is kept for it -- instead of failing on every leg without APCu The end-to-end test "a page per role" and the showcase's tab "Cache" expected a member's page from the cache on every leg, but roles are remembered in APCu only: the file-store legs and the minimal-hosting leg (S1) failed on them since the roles were merged. tests/helpers.php has serverApcu() (the servers a test starts have APCu: the extension loaded, not TESTS_HOSTING=minimal); with it the tests check the roles as before, without it they check that a session's page is never kept or given from the cache and that anonymous visitors still get their kept page.
This branch has not been deployed
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.
What fails
Since the HTTP cache's roles were merged (8f94bd1,
Merge branch 'wip/g4-cache'),the Tests workflow on
mainhas failed on every leg without APCu: the sixfile-store legs (
PHP 8.0…PHP 8.5 (file store)) andPHP 8.0, minimal hosting (S1).main(a92a37b): https://github.com/cjw-network/request-shield/actions/runs/38043321121PHP 8.3 (file store): https://github.com/cjw-network/request-shield/actions/runs/38043321121/job/114187792382PHP 8.0, minimal hosting (S1): https://github.com/cjw-network/request-shield/actions/runs/38043321121/job/114187761237Each of these legs fails the same two tests:
The legs with APCu pass.
Why
Roles are remembered in APCu only (0039). Without APCu they stay off, as the
proposal says: a session's page is the visitor's own, made by the application
each time, and nothing is kept for it. The library does exactly that. The two
tests, however, expect a member's page from the cache on every leg. Without
APCu, the first test never sees the
X-RS-Cache: missit waits for, and theshowcase test never sees member A's page served to member B.
So the code is right and the tests ask for something the proposal rules out
without APCu.
The fix
Tests only, no change in
src/:tests/helpers.php:serverApcu()says whether the servers a test starts(
php -S, PHP-FPM) have APCu: the extension is loaded (they do not needapc.enable_cli) andTESTS_HOSTINGis notminimal.tests/CacheTest.php, "a page per role": with APCu, unchanged. Without it,the test holds what 0039 promises: a session's page comes from the
application each time (the run counter goes up by two for two requests),
nothing is kept for it (no
X-RS-Cache: missthat a later request couldhit), and anonymous visitors still get their kept page, never a session's.
tests/ShowcaseTest.php, the tab "Cache": with APCu, unchanged. Without it,member B gets the members' page from the application, not from the cache,
and not the second time either.
Tested
file-store and S1 legs pass both tests. The other failures in that run are
the flaky disk-cap test on
PHP 8.0 + APCu(Fixed: The disk's cap test no longer depends on the clock moving to the next second #7) and a PHP8.0.30 segfault on
PHP 8.0 + APCu, single file(PHP 8.0.30 legs: segfaults (exit 139) in FeedsTest and status 0 from the demo's built-in server #9).https://github.com/se7enxweb/request-shield/actions/runs/38120981093
php tests/run.php RSF04-03:TESTS_HOSTING=minimal: both tests fail on a92a37b and pass with this commit.