Skip to content

Avoid unnecessary containers in Aspire.Hosting.Testing.Tests #7666

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
Feb 19, 2025

Conversation

ReubenBond
Copy link
Member

Description

This PR removes unnecessary containers from the Aspire.Hosting.Testing.Tests suite.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

@Copilot Copilot AI review requested due to automatic review settings February 18, 2025 23:55
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.

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

Comments suppressed due to low confidence (4)

tests/Aspire.Hosting.Testing.Tests/TestingBuilderTests.cs:129

  • [nitpick] Ensure that the new connection string check covers all necessary cases and does not introduce any unintended side effects.
var connectionString = await app.GetConnectionStringAsync("cs");

tests/Aspire.Hosting.Testing.Tests/TestingBuilderTests.cs:149

  • The removal of the Redis container check might affect tests that rely on it. Ensure that all affected tests are updated accordingly.
Assert.Contains(appModel.GetContainerResources(), c => c.Name == "redis1");

tests/TestingAppHost1/TestingAppHost1.AppHost/Program.cs:28

  • The removal of AddPostgres("postgres1") could cause issues if the PostgreSQL container is still required.
builder.AddPostgres("postgres1");

tests/Aspire.Hosting.Testing.Tests/TestingFactoryTests.cs:20

  • The change from async to sync in HasEndPoints might affect the test's correctness. Verify that the test does not require async operations.
public void HasEndPoints()

@ReubenBond ReubenBond enabled auto-merge (squash) February 19, 2025 00:01
// Get a connection string from a resource
var pgConnectionString = await _app.GetConnectionStringAsync("postgres1");
Assert.NotNull(pgConnectionString);
Assert.True(pgConnectionString.Length > 0);
Copy link
Member Author

Choose a reason for hiding this comment

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

Note that the next test already exercises the GetConnectionStringAsync method

@ReubenBond ReubenBond merged commit 245ebdc into main Feb 19, 2025
70 checks passed
@ReubenBond ReubenBond deleted the rebond/less-containers-in-tests branch February 19, 2025 00:15
@github-actions github-actions bot added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Mar 10, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Apr 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants