8000 [Messenger] [Redis] Fix auth option wrongly considered invalid by chalasr · Pull Request #42173 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Messenger] [Redis] Fix auth option wrongly considered invalid #42173

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 1 commit into from
Jul 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[Messenger][Redis] Fix auth option wrongly considered invalid
  • Loading branch information
chalasr committed Jul 18, 2021
commit 8bc6ee52fc6ba209b0fff507e4b3ece693cc6d1a
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,14 @@ public function testItSendsAndReceivesMessages()
$this->assertEmpty(iterator_to_array($receiver->get()));
}

/**
* @group legacy
* ^ for now, deprecation errors are thrown during serialization.
*/
Copy link
Member Author
@chalasr chalasr Jul 18, 2021

Choose a reason for hiding this comment

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

This test was broken because it uses an incomplete symfony serializer (see https://github.com/symfony/symfony/runs/3097443193#step:11:72)

public function testRetryAndDelay()
{
$serializer = $this->createSerializer();

$connection = Connection::fromDsn(getenv('MESSENGER_AMQP_DSN'));
$connection->setup();
$connection->purgeQueues();

$sender = new AmqpSender($connection, $serializer);
$receiver = new AmqpReceiver($connection, $serializer);
$sender = new AmqpSender($connection);
$receiver = new AmqpReceiver($connection);

// send a first message
$sender->send($first = new Envelope(new DummyMessage('First')));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,17 +191,6 @@ public function testAuthFromOptionsAndDsn()
Connection::fromDsn('redis://password1@localhost/queue', ['auth' => 'password2'], $redis);
}

public function testAuthAsUserInDsn()
{
$redis = $this->createMock(\Redis::class);

$redis->expects($this->exactly(1))->method('auth')
->with('password')
->willReturn(true);

Connection::fromDsn('redis://password:localhost/queue', [], $redis);
}

Copy link
Member Author
@chalasr chalasr Jul 18, 2021

Choose a reason for hiding this comment

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

This test was added in #42067 but it never passed, the dsn is invalid (https://github.com/symfony/symfony/runs/3097443193#step:11:102)

public function testNoAuthWithEmptyPassword()
{
$redis = $this->createMock(\Redis::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class Connection
'redeliver_timeout' => 3600, // Timeout before redeliver messages still in pending state (seconds)
'claim_interval' => 60000, // Interval by which pending/abandoned messages should be checked
'lazy' => false,
'auth' => null,
'serializer' => \Redis::SERIALIZER_PHP,
];

private $connection;
Expand Down Expand Up @@ -224,7 +226,6 @@ public static function fromDsn(string $dsn, array $redisOptions = [], \Redis $re
private static function validateOptions(array $options): void
{
$availableOptions = array_keys(self::DEFAULT_OPTIONS);
$availableOptions[] = 'serializer';

if (0 < \count($invalidOptions = array_diff(array_keys($options), $availableOptions))) {
trigger_deprecation('symfony/messenger', '5.1', 'Invalid option(s) "%s" passed to the Redis Messenger transport. Passing invalid options is deprecated.', implode('", "', $invalidOptions));
Expand Down
0