Skip to content

Create functional tests - #1217

Merged
Sébastien Ros (sebastienros) merged 22 commits into
mainfrom
sebros/functionalmongo
Dec 14, 2023
Merged

Sébastien Ros (sebastienros) merged 22 commits into
mainfrom
sebros/functionalmongo

Conversation

@sebastienros

@sebastienros Sébastien Ros (sebastienros) commented Dec 6, 2023 •

Copy link
Copy Markdown
Contributor

Added functional tests for

  • PostgreSQL
  • MongoDB
  • MS SQL
  • Redis
  • RabbitMQ
  • MySql

@ghost ghost added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Dec 6, 2023
@sebastienros

Copy link
Copy Markdown
Contributor Author

After some feedback I am going to change the tests to use a Fixture representing this AppHost such that each test can use the same app instance and shut it down when the tests are done.

@sebastienros Sébastien Ros (sebastienros) changed the title Add smoke tests for mongodb Create functional tests Dec 7, 2023
# Conflicts:
#	tests/testproject/TestProject.AppHost/TestProgram.cs
#	tests/testproject/TestProject.IntegrationServiceA/Program.cs
app.MapGet("/mongodb/movies", GetMoviesAsync);
}

private static async Task<List<string>> GetDatabaseNamesAsync(IMongoClient client, IMongoDatabase db)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These handlers should probably take the abstract version of the resource as a dependency as a well via keyed DI. That way you can test both flavors.

var mongodbContainer = AppBuilder.AddMongoDBContainer("mongodbcontainer")
.AddDatabase(mongoDbName);

var sqlserverAbstract = AppBuilder.AddSqlServerContainer("sqlserverabstract");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Mitch Denny (@mitchdenny) - what are these "Abstract" containers? It looks to be doing the same thing as above - AppBuilder.AddSqlServerContainer, just with a different name.

@eerhardt Eric Erhardt (eerhardt) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thanks for this great work.

It might be good to get Mitch Denny (@mitchdenny) to sign off on the changes as well.

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.

6 participants