Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

In-memory database #97

Open
hasufell opened this issue Oct 20, 2020 · 3 comments
Open

In-memory database #97

hasufell opened this issue Oct 20, 2020 · 3 comments

Comments

@hasufell
Copy link

hasufell commented Oct 20, 2020

PostgreSQL is quite heavy to set up for e.g. integration tests. There could be an option to run everything in-memory.

Or... sqlite.

Related: cardano-foundation/cardano-wallet#2249

@hasufell
Copy link
Author

It seems there's already some support for it, but it isn't exposed in the cli:

smash/src/Lib.hs

Lines 129 to 137 in d335fed

runAppStubbed :: Configuration -> IO ()
runAppStubbed configuration = do
let port = cPortNumber configuration
let settings =
setPort port $
setBeforeMainLoop (hPutStrLn stderr ("listening on port " ++ show port)) $
defaultSettings
runSettings settings =<< mkAppStubbed configuration

@hasufell
Copy link
Author

I actually think the way forward is SQLite. I've done some hacking on that in a local branch. The reasoning is:

  1. it might be interesting for end-users: postgres is a heavy dependency
  2. SQLite can be run in-memory for integration tests, which means I have more coverage for the smash implementation compared to the stubbed Configuration (since we still run through the persistent framework)

@ksaric
Copy link
Contributor

ksaric commented Oct 22, 2020

I have some additional ideas about how to make this even nicer.
Some of this will be covered by the upcoming issue creatively called "Add tests for the existing functionality" 😄

Will report back to you, should be handled in this sprint as well.

iohk-bors bot added a commit that referenced this issue Oct 26, 2020
102: Improve stub server r=ksaric a=hasufell

1. expose a cli option to start the stub server in test-mode
2. add an endpoint to insert pool metadata manually in test-mode

Related: #97 

Co-authored-by: Julian Ospald <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants