testcontainers / testcontainers-dotnet

A library to support tests with throwaway instances of Docker containers for all compatible .NET Standard versions.
https://dotnet.testcontainers.org
MIT License
3.76k stars 271 forks source link

Add SQLite package #1158

Closed hishamco closed 3 months ago

hishamco commented 5 months ago

Problem

Lack to support SQLite database OOB

Solution

Introducing Testcontainers.Sqlite package

Benefit

Allow devs to use SQLite

Alternatives

Nothing

Would you like to help contributing this enhancement?

Yes

0xced commented 5 months ago

Could you please elaborate on what are the advantages of using a Docker container over directly using one of the many available SQLite libraries such as Microsoft.Data.Sqlite, SQLite-net or System.Data.SQLite?

hishamco commented 5 months ago

I working on an OSS project I just find myself need a docker image for integration testing. I know I can manage it myself by creating a .db but I need to cleanup everything after the testing

HofmeisterAn commented 5 months ago

Couldn't you use the generic container builder? We could add a section to our documentation covering common builder patterns, similar to an article or how-to guide. I am uncertain whether we require modules for all kinds of "simple" configurations.

Is there even a container image available? How would you access the database from remote? Looking forward to discussing this topic and hear your thoughts (since I would simply store the database in-memory and might miss something).

hishamco commented 5 months ago

Is there even a container image available?

https://hub.docker.com/r/keinos/sqlite3#!

(since I would simply store the database in-memory and might miss something).

This sometimes problematic especially in testing

HofmeisterAn commented 5 months ago

https://hub.docker.com/r/keinos/sqlite3#!

As I commented here, I do not think it hosts a database accessible remotely. According to the Docker Hub docs, they also mount the database file from the host. I am not sure how you are planning to implement a module, but I am curious to see the proof of concept.

HofmeisterAn commented 3 months ago

I will close this issue. As mentioned, I do not think the image is a hosted SQLite instance. If you have any further information, do not hesitate to reopen the issue.