Hello, I am new to golang, and after I build my first (rather complex) backend in gin with gorm, I want to write e2e tests or atleast test the endpoints properly, I googled and came across a few posts but never something with an actual solution.
So here the requirements I want for the tests:
- Test endpoints, doesn't have to be via a fetch, but just the function that the router points to
- have a memory psql which I can seed with data, preferably before all tests, then create a connection, and run all tests on that one connection
- Possibly be able to also create extensions to test fulltextsearch etc. on the db.
What I found/tried/failed
- Failed: sqlMock, it just doesn't do what I want, I guess this is only to check basic sql stuff
- Found: embedded-postgres, but I couldn't find a proper example on how to use it with GIN/GORM
My main.go file
Here my attempted test file so you can see the top level that I try to test