Skip to content

Conversation

Alirexaa
Copy link
Contributor

@Alirexaa Alirexaa commented May 13, 2025

from api review: #8736 (comment)
fixes #8897

/cc @eerhardt @davidfowl

@Copilot Copilot AI review requested due to automatic review settings May 13, 2025 10:45
@github-actions github-actions bot added the area-integrations Issues pertaining to Aspire Integrations packages label May 13, 2025
@Alirexaa Alirexaa changed the title Accept null value in Redis WithPassword to ensure password dosen't in redis-server Accept null value in Redis WithPassword to ensure password dosen't set in redis-server May 13, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enables Redis resources to accept a null password value, ensuring that no password is exposed in the redis-server configuration. Key changes include updating tests to verify behavior when no password is provided, modifying RedisResource to accept a nullable parameter, and updating the RedisBuilderExtensions.WithPassword method to support null values.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tests/Aspire.Hosting.Redis.Tests/RedisFunctionalTests.cs Adds a test case using WithPassword(null) for RedisInsight integration
tests/Aspire.Hosting.Redis.Tests/AddRedisTests.cs Adds and updates tests to verify manifest outputs and environment variable mappings based on password presence
src/Aspire.Hosting.Redis/RedisResource.cs Updates SetPassword to accept a nullable ParameterResource and removes the null check
src/Aspire.Hosting.Redis/RedisBuilderExtensions.cs Modifies WithPassword to optionally accept a password resource and pass a nullable value
Comments suppressed due to low confidence (2)

tests/Aspire.Hosting.Redis.Tests/AddRedisTests.cs:294

  • Resource 'myredis2' is used for both redis2 and redis3, which may lead to conflicts when identifying distinct resources. Consider using a unique name for redis3.
var redis3 = builder.AddRedis("myredis2").WithRedisInsight().WithPassword(null);

tests/Aspire.Hosting.Redis.Tests/AddRedisTests.cs:130

  • [nitpick] The test method names 'VerifyDefaultManifest' and 'VerifyWithoutPasswordManifest' are very similar. Consider renaming one to clearly differentiate the scenarios being tested.
[Fact] public async Task VerifyWithoutPasswordManifest()

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label May 13, 2025
@davidfowl
Copy link
Member

Somehow passing null feels dirtier than another method but idk.

@eerhardt
Copy link
Member

Somehow passing null feels dirtier than another method but idk.

You mean a new method like .WithNoPassword()?

@davidfowl
Copy link
Member

Yea

@davidfowl
Copy link
Member

not a hill I will die on

@eerhardt
Copy link
Member

I think I'm fine with a single method that takes null. It doesn't feel terrible to me.

Copy link
Member

@davidfowl davidfowl left a comment

Choose a reason for hiding this comment

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

Lets get this in.

@Alirexaa
Copy link
Contributor Author

Test failure is unrelated.

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

LGTM

@eerhardt eerhardt enabled auto-merge (squash) May 13, 2025 14:33
@Alirexaa
Copy link
Contributor Author

Don't forget to backport.

@eerhardt eerhardt merged commit b667b7b into dotnet:main May 13, 2025
344 of 346 checks passed
@Alirexaa Alirexaa deleted the redis-without-password branch May 13, 2025 14:38
@davidfowl
Copy link
Member

/backport to release/9.3

Copy link
Contributor

Started backporting to release/9.3: https://github.com/dotnet/aspire/actions/runs/14999610625

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-integrations Issues pertaining to Aspire Integrations packages community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The Redis API Surface is missing the WithPassword method
3 participants