NobbZ

NobbZ

Database mocking without requiring an *external* preconfigured database

For some python projects at work we found that there are pytest-{postgres,mysql,redis} and probably more.

These tools take the burden off of you to maintain a Dev database locally which you need to configure your in Dev applications accordingly.

Those are basically plugins for pytest, which use the fixture mechanism of pytest to provide temporary “installations” of the tool in question, “persisting” it’s data into temporary folders and removing after the suite has run.

Even though this has an obvious runtime cost to initialise the tooling for each test run, it really made onboarding the junior quite easy. We just told them to install mysql package for their Ubuntu WSL and told them to run make test which wrapped the actual test run with proper command line arguments. No need to walk them through configuring a local mysql or having remember to run some docker(-compose) whenever changing projects.

Has anyone seen something similar for elixir or is there any interest in it?

First Post!

dimitarvp

dimitarvp

I am sorry, what exactly do those packages do? Didn’t get it. What tool? What temporary installations? Why once per test? Could you clarify?

Most Liked

NobbZ

NobbZ

We used the MySQL version of those plugins, that basically starts a mysql demon with a configuration pointing the data dir to somewhere in tmp, listening on specified ports or domain sockets.

It manages the full database application lifecycle.

dallagi

dallagi

If I understood your requirement correctly, you may be interested in excontainers, a library I developed to tackle exactly this problem.

Unfortunately it has not seen much adoption yet, but in case you decide to give it a try I’d be happy to hear about any problem you may encounter or any feedback you may have :slight_smile:

Where Next?

Popular in Discussions Top

und0ck3d
Hello everyone! A few days ago I’ve created a topic here about how people were creating CMSs with Elixir and Phoenix. I’ve been studying...
New
nburkley
AWS re:Invent is on at the moment with some interesting announcements. One new feature in particular is the Lambda Runtime API for AWS La...
New
slashdotdash
Phoenix Live View is now publicly available on GitHub. Here’s Chris McCord’s tweet announcing making it public.
New
mikl
I wanted to capitalize a string, and tried using String.capitalize(). That generally works well, until you try to capitalize a word like...
New
opsb
We’re considering our architecture from a viewpoint of scaling our traffic heavily over the next 6 months. Our current deployment is runn...
New
owaisqayum
I have a sample string sentence = "Hello, world ... 123 *** ^%&*())^% %%:>" From this string, I want to only keep the integers, ...
New
Rustixir
Hi everyone, im working on find best language/framework/system for high concurrency, high performance and stable performance after wor...
New

Other popular topics Top

Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement