Refactor session tests#2492
Merged
Merged
Conversation
* Update these external scripts to take formal arguments with `getopt` to
make it more straightforward what each of the currently positional
arguments are actually for.
* Create small helper classes for invoking these external scripts.
Instead of `startSessionProcess` that takes a dozen argument all but
three of which have defaults, we can use a construct like this:
```php
$runner = $this->sessionRunner()
->max_execution_time(300)
->locking_enabled(true)
->lock_wait_time(-1)
->lock_expires(0)
->data($data)
->compression($name);
// Invokes startSession.php with above args.
$result = $runner->exec_fg();
// Invokes regenerateSessionId.php with above args
$new_id = $runner->regenerate_id();
// Invokes getSessionData.php for this session ID.
$data = $runner->get_data();
```
* Add a bit of logic to TestSuite to dump more information about the
source of an assertion to make it easier to track down problems when
we assert outside of a top level public `test_*` method.
* Create a few new assertions like `assertKeyExists` and
`assertKeyMissing` which will generate much nicer assertions as
opposed to
```php
$this->assertTrue($this->redis->exists($some_key));
```
* If our externally spawned session scripts fail output the exact call
that was made along with all arguments as well as the output that we
received to make it easier to narrow down.
b9576e0 to
b258610
Compare
yatsukhnenko
requested changes
May 23, 2024
yatsukhnenko
left a comment
Member
There was a problem hiding this comment.
Could you change naming from snake case to camel case in SessionHelper class?
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.
Update these external scripts to take formal arguments with
getoptto make it more straightforward what each of the currently positional arguments are actually for.Create small helper classes for invoking these external scripts. Instead of
startSessionProcessthat takes a dozen arguments all but three of which have defaults, we can use a construct like this:Add a bit of logic to TestSuite to dump more information about the source of an assertion to make it easier to track down problems when we assert outside of a top level public
test_*method.Create a few new assertions like
assertKeyExistsandassertKeyMissingwhich will generate much nicer assertions as opposed to