-
Notifications
You must be signed in to change notification settings - Fork 152
#940 upgrade papercut and changed portnumbers #988
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
#940 upgrade papercut and changed portnumbers #988
Conversation
|
LGTM, I did some testing and revising the ports worked as expected. The only problem I found was that I had to replace Aspire/src/CommunityToolkit.Aspire.Hosting.PapercutSmtp/PapercutSmtpHostingExtension.cs Line 38 in 4fc8f80
Also do you think it's worth adding some example code for the connection string to README? var connStr = config.GetConnectionString("papercut");
var uri = new Uri(connStr[9..]);
var sc = new SmtpClient(uri.Host, uri.Port); |
…-status (default value is 200 -> removed parameter from call)
|
@mguinness thanks for pointing out this bug which might have been present from the start of this component. |
… URI from the connection-string using a DbConnectionStringBuilder
|
@mguinness about your second note: In my example project I used the DbConnectionStringBuilder and added this code to the readme.md. |
|
I noticed the bug when I changed AddPapercutSmtp to specify ports.
Then health check then failed, but I'm not sure why it didn't occur when The message in UriHealthCheck should be returned when status code 80 is incorrectly expected. @sungam3r Any ideas? |
What do you mean? |
|
Ah, now I see why my test doesn't fail. When you don't override the httpPort this parameter will be null on the line you mentioned @mguinness and the default httpStatus 200 will be used. Should I create two papercut resources in my example project and use them both in my unittest so as to make sure that setting the optional parameters won't break the healthcheck? |
Apologies, I wasn't very clear. I suppose the question should be whether bounds checking occur in The check could also be done in ResourceBuilderExtensions and throw a
I don't think that is necessary since you have now removed the statusCode parameter from WithHttpHealthCheck. |
|
@mguinness I have a local change ready to commit that I can push if we want to test whether setting the portnumbers on the papercut host will effect the healthcheck. var papercut = builder.AddPapercutSmtp(PapercutConstants.ResourceNameDefaultParameters);
var papercut2 = builder.AddPapercutSmtp(PapercutConstants.ResourceNameOverrideParameters, httpPort: 8080, smtpPort: 2525);Now I can use the two resource-names in my unittest in a Theory. My previous code would fail on the second papercut-resource. Changes will be:
|
|
@aaronpowell might be better placed to answer. I suppose you could test that a port number outside the range 1-65535 fails. |
|
not sure I'm properly following - is the issue that if you set a port number outside a certain range things break unexpectedly? |
|
I just tested and AllocatedEndpoint throws a Arno, I think what you already have in the PR is sufficient for merging if it can be assigned for review. |
|
Port range management should delegate to Aspire, unless a resource has very specific requirements |
Closes #940
PR Checklist
Other information
@mguinness thanks for the pointer to the changed ports.
I don't know if this is a breaking change for this component.