Closed ghost closed 5 years ago
According to https://github.com/samphilipd/rihanna/issues/38 it should be possible ... Am I holding it wrong?
# in config.exs
config :rihanna,
producer_postgres_connection: {Ecto, App.Repo}
# in application.ex
{Rihanna.Supervisor, postgrex: App.Repo.config()}
I would advise not running the poller in test and instead testing that the job exists in the jobs table.
The jobs themselves can then be executed and tested synchronously by calling them directly.
The table should be rolled back when using the sandbox. Can you share a minimal example project that replicates the bug? We'll be happy to take a look at that.
The table should be rolled back when using the sandbox. Can you share a minimal example project that replicates the bug? We'll be happy to take a look at that.
Hi @lpil! You are right, the transaction is indeed rolled back, but the autoincremented job id is not -- that's what got confused, sorry.
Great, glad we could help!
👋
I've added a simple test like this and is seems to be failing:
The repo that rihanna uses runs in an ecto sandbox.
I've also noted that rihanna_jobs table doesn't seem to be rolled back after the test exits. Does rihanna run job polling queries outside of the sandbox transaction? Then it would explain why the job created in the test is never executed.