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

rower687
Hi all, I’ve been reading a lot about the “let it crash” term and how supervising processes and the whole messaging passing make an elixi...
New
rms.mrcs
A couple of days ago I was discussing with a friend about different approaches to write microservices. He said that if he was going to w...
New
chuck
Let me start by stating an assumption: Phoenix is a great approach to building REST APIs. There are many reasons for this, but I will ass...
New
eteeselink
Hi all, In the last days, two things happened: A blog post titled “They might never tell you it’s broken” made the rounds. It’s about ...
New
marciol
Please, let me know if this kind of discussion already took place in another topic . Hi all, how do you consider if is better to build ...
New
nunobernardes99
Hi there Elixir friends :vulcan_salute: In a recent task I was on, I needed to check in two dates which of them is the maximum and which...
New
AstonJ
Can you believe the first professionally published Elixir book was published just 8 years ago? Since then I think we’ve seen more books f...
New

Other popular topics Top

JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 55125 245
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 49266 226
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 42716 114
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement