Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix Integration tests skipped with Redis cluster #49449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Feb 21, 2023

Conversation

maxbeckers
Copy link
Contributor

Q A
Branch? 6.3
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #49285
License MIT
Doc PR n/a

It seems to me, that the getenv('MESSENGER_REDIS_SENTINEL_MASTER') in the setUp() might return false because it's unset. To ignore the sentinel, it must be null:

if (null !== $sentinelMaster) {
$sentinelClass = \extension_loaded('redis') ? \RedisSentinel::class : Sentinel::class;
$sentinelClient = new $sentinelClass($host, $port, $options['timeout'], $options['persistent_id'], $options['retry_interval'], $options['read_timeout']);
if (!$address = $sentinelClient->getMasterAddrByName($sentinelMaster)) {
throw new InvalidArgumentException(sprintf('Failed to retrieve master information from master name "%s" and address "%s:%d".', $sentinelMaster, $host, $port));

@carsonbot carsonbot added this to the 6.3 milestone Feb 20, 2023
@maxbeckers maxbeckers force-pushed the patch_49285_redis_tests branch 4 times, most recently from d5de72c to ae9637a Compare February 20, 2023 09:37
@maxbeckers maxbeckers force-pushed the patch_49285_redis_tests branch 2 times, most recently from 5c4f20c to fcacb7f Compare February 20, 2023 10:26
@maxbeckers
Copy link
Contributor Author

For now there are failing 5 tests with Invalid HELLO reply, Redis Server version may be too old (RELAY_ERR_COMPAT; commands.c:6660). I'll need to investigate a bit more of time to that or maybe someone else has an idea.

@maxbeckers maxbeckers force-pushed the patch_49285_redis_tests branch 3 times, most recently from 5c545e6 to 93b94c0 Compare February 20, 2023 15:17

public function testConnectionSendAndGetDelayed()
{
self::markTestSkipped(self::SKIP_TEST_NOT_RUNNING_WITH_RELAY);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now I added a skip to the tests not working with relay. Could be another issue to fix this tests working with relay. In this PR i focussed on the topic of the ticket, that cluster tests were not running. This problems came up after enabling this.

@maxbeckers maxbeckers force-pushed the patch_49285_redis_tests branch 2 times, most recently from 6e33711 to f8e07cb Compare February 21, 2023 06:16
Evan Shaw and others added 2 commits February 21, 2023 12:06
…arent::setContainer in ServiceSubscriberTrait (edsrzf)

This PR was squashed before being merged into the 5.4 branch.

Discussion
----------

[Contracts] Fix setting $container before calling parent::setContainer in ServiceSubscriberTrait

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix symfony#49382
| License       | MIT

This changes the `setContainer` method of `ServiceSubscriberTrait` so that it calls `parent::setContainer` first, before updating `$this->container`. This is so that the parent method can work correctly if it relies on the old container value.

This is particularly relevant for `AbstractController`, since it returns the old container value. When used with `ServiceSubscriberTrait`, it returned the _new_ container rather than the old one. This, in turn, caused incorrect behavior in framework bundle's `ControllerResolver`, as described in symfony#49382.

Commits
-------

bccb074 [Contracts] Fix setting $container before calling parent::setContainer in ServiceSubscriberTrait
@carsonbot carsonbot changed the title Fix Integration tests skipped with Redis cluster [Messenger] Fix Integration tests skipped with Redis cluster Feb 21, 2023
@carsonbot carsonbot changed the title [Messenger] Fix Integration tests skipped with Redis cluster Fix Integration tests skipped with Redis cluster Feb 21, 2023
@nicolas-grekas
Copy link
Member

I suppose we should merge this on 5.4?

@maxbeckers maxbeckers force-pushed the patch_49285_redis_tests branch from f8e07cb to 1ede8db Compare February 21, 2023 11:53
@maxbeckers
Copy link
Contributor Author

@nicolas-grekas yes, i didn't check this, in the issue was mentioned the 6.3 branch. Is it possible to handle this during the merge or should I rebase it?

@nicolas-grekas
Copy link
Member

Please submit another PR for 5.4, I'll use this one when merging up.

@maxbeckers maxbeckers force-pushed the patch_49285_redis_tests branch from 1ede8db to 4ead381 Compare February 21, 2023 11:57
nicolas-grekas and others added 5 commits February 21, 2023 13:11
…in async expiration handler (AdamKatzDev)

This PR was merged into the 5.4 branch.

Discussion
----------

[Cache][Messenger] fixed CallbackInterface support in async expiration handler

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Adds support for CallbackInterface in EarlyExpirationHandler and thus fixes async cache recomputing for callables that implement CallbackInterface. Earlier similar errors were fixed in symfony#31879.

Commits
-------

a8dea95 [Messenger][Cache] fixed CallbackInterface support in async expiration handler
…33300)

This PR was squashed before being merged into the 6.2 branch.

Discussion
----------

[Form] Skip password hashing on empty password

| Q             | A
| ------------- | ---
| Branch?       | 6.2
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | N/A
| License       | MIT
| Doc PR        | N/A

When using the new `hash_property_path` option to hash password submitted by forms, we should skip hashing if the submitted password is empty.

- Because empty passwords are not allowed and saving an empty password hash will prevent the user to login his account:
https://github.com/symfony/symfony/blob/8c19af2346ed6ed4021d3efc024e0af138e69794/src/Symfony/Component/Security/Http/EventListener/CheckCredentialsListener.php#L59-L62

- Because a common use case when creating a user profile form is to ignore the "new password" input if it's left blank.

Commits
-------

b4aa3ea [Form] Skip password hashing on empty password
This PR was merged into the 5.4 branch.

Discussion
----------

[TwigBridge] do not drop embed label classes

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix symfony#45727
| License       | MIT
| Doc PR        |

Commits
-------

cd50683 do not drop embed label classes
juagarc4 and others added 4 commits February 21, 2023 13:28
…rows PHP 8.1 deprecation when no user agent is set (juagarc4)

This PR was squashed before being merged into the 5.4 branch.

Discussion
----------

[MonologBridge] FirePHPHandler::onKernelResponse throws PHP 8.1 deprecation when no user agent is set

| Q             | A
| ------------- | ---
| Branch?       |  5.4
| Bug fix?      | yes/no
| New feature?  no
| Deprecations? no
| Tickets       | Fix symfony#49392
| License       | MIT

- Add casting to the second parameter to pass always the right type.

**PHPstan before:**

 ------ --------------------------------------------------------------------------------------------------------
  Line   FirePHPHandler.php
 ------ --------------------------------------------------------------------------------------------------------
  27     Property Symfony\Bridge\Monolog\Handler\FirePHPHandler::$headers has no type specified.
  37     Method Symfony\Bridge\Monolog\Handler\FirePHPHandler::onKernelResponse() has no return type specified.
  **44     Parameter symfony#2 $subject of function preg_match expects string, string|null given.**
  68     If condition is always true.
 ------ --------------------------------------------------------------------------------------------------------

**PHPstan after:**

 ------ --------------------------------------------------------------------------------------------------------
  Line   FirePHPHandler.php
 ------ --------------------------------------------------------------------------------------------------------
  27     Property Symfony\Bridge\Monolog\Handler\FirePHPHandler::$headers has no type specified.
  37     Method Symfony\Bridge\Monolog\Handler\FirePHPHandler::onKernelResponse() has no return type specified.
  68     If condition is always true.
 ------ --------------------------------------------------------------------------------------------------------

Commits
-------

4d84c46 [MonologBridge] FirePHPHandler::onKernelResponse throws PHP 8.1 deprecation when no user agent is set
…c firewall (chalasr)

This PR was merged into the 6.2 branch.

Discussion
----------

[SecurityBundle] Fix `Security::login()` on specific firewall

| Q             | A
| ------------- | ---
| Branch?       | 6.2
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | symfony#49444
| License       | MIT
| Doc PR        | -

Commits
-------

f7043db [SecurityBundle] Fix `Security::login()` on specific firewall
nicolas-grekas and others added 5 commits February 21, 2023 13:35
…s (maxbeckers)

This PR was merged into the 5.4 branch.

Discussion
----------

Update Redis version to 6.2.8 for integrationtests

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix symfony#49285
| License       | MIT
| Doc PR        | n/a

Related to symfony#49449 to bring the redis versions all to the same version 6.2.8

/cc `@nicolas`-grekas

Commits
-------

a1696bf Update Redis version to 6.2.8
* 5.4:
  [Translation] Fix merge
  [MonologBridge] FirePHPHandler::onKernelResponse throws PHP 8.1 deprecation when no user agent is set
  Update Redis version to 6.2.8
  [Contracts] Fix setting $container before calling parent::setContainer in ServiceSubscriberTrait
  [Messenger][Cache] fixed CallbackInterface support in async expiration handler
  do not drop embed label classes
* 6.2:
  [Translation] Fix merge
  [SecurityBundle] Fix `Security::login()` on specific firewall
  [MonologBridge] FirePHPHandler::onKernelResponse throws PHP 8.1 deprecation when no user agent is set
  [Form] Skip password hashing on empty password
  Update Redis version to 6.2.8
  [Contracts] Fix setting $container before calling parent::setContainer in ServiceSubscriberTrait
  [Messenger][Cache] fixed CallbackInterface support in async expiration handler
  do not drop embed label classes
@nicolas-grekas
Copy link
Member

Thank you @maxbeckers.

@nicolas-grekas nicolas-grekas merged commit 1851e89 into symfony:6.3 Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integration tests skipped with Redis cluster should be fixed
9 participants