Skip to content

Experiment using Test containers#175

Open
markusrt wants to merge 4 commits into
masterfrom
test-containers
Open

Experiment using Test containers#175
markusrt wants to merge 4 commits into
masterfrom
test-containers

Conversation

@markusrt

@markusrt markusrt commented Dec 9, 2024

Copy link
Copy Markdown
Owner

Test containers might be a better solution for integration
tests compared to an in-memory DB

Test containers might be a better solution for integration
tests compared to an in-memory DB

private static readonly MsSqlContainer _dbContainer = new MsSqlBuilder()
.WithImage("mcr.microsoft.com/mssql/server:2022-latest")
.WithPassword("Strong_password_123!")

Check failure

Code scanning / CodeQL

Hard-coded credentials

The hard-coded value "Strong_password_123!" flows to the [password](1) parameter in [call to method WithPassword](2).
{
_dbContainer.StartAsync().Wait();

_factory = new WebApplicationFactory<Program>().WithWebHostBuilder(builder =>

Check warning

Code scanning / CodeQL

Missing Dispose call on local IDisposable

Disposable 'WebApplicationFactory<Program>' is created but not disposed.
Comment on lines +67 to +71
catch (Exception ex)
{
var logger = loggerFactory.CreateLogger<Program>();
logger.LogError(ex, "An error occurred seeding the DB.");
}

Check notice

Code scanning / CodeQL

Generic catch clause

Generic catch clause.
@sonarqubecloud

sonarqubecloud Bot commented Dec 9, 2024

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants