Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: postgres WithDatabase() causes failure on WithContainerReuse() #774

Closed
cgeers opened this issue Jan 11, 2023 · 1 comment · Fixed by #785
Closed

Bug: postgres WithDatabase() causes failure on WithContainerReuse() #774

cgeers opened this issue Jan 11, 2023 · 1 comment · Fixed by #785

Comments

@cgeers
Copy link

cgeers commented Jan 11, 2023

Describe the bug
with the postgres preset, the WithDatabase option can't be used in combination with WithContainerReuse gnomock start option. The desired change is to make WithDatabase idempotent.

To Reproduce
create a postgres preset with WithDatabase option, also use gnomock WithContainerReuse start option. The first creation operates normally, the second attempt, when the container is reused, it fails with:

can't init container: pq: database "<db_name>" already exists

Expected behavior
multiple, subsequent runs of this preset with this configuration succeeds.

Screenshots
n/a

System (please complete the following information):

  • OS: macos
  • Version: v0.24.0
  • Docker version: 20.10.17

Additional context
n/a

@orlangure
Copy link
Owner

Hi @cgeers and thank you for the report.

I was able to reproduce the problem and have a fix in #785.
In addition, I'm planning another improvement in container reuse, would you like to share your thoughts about this draft? It will allow to not only reuse a database, but to reset the container to its default state when asked to, so that the container itself is not recreated, but the state is fresh for every test.

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 a pull request may close this issue.

2 participants