Fork me on GitHub

in datomic cloud there is no possibility to do in-memory unit tests without a connection to the cloud instance?


FAQ seems to state that


do people usually have test suites use an actual instance?

👍 4

ok, good to know


there is a library which implements the client api against the peer api designed for testing, it’s name escapes me


it’s not perfect and you need an on-prem license


but it’s something


Depending of your us-case, you can have to look to


@U11SJ6Q0K We wrote that library (I don't like the name but people started using it before we could change it haha). We really wanted to embrace the whole "test against the production system" but it's just too much of a pain. CI tests need to run the socks proxy to connect to the Datomic instance. IIRC, we never managed to get that set up in a stable way on CircleCI. It was almost there (again IIRC) but we needed to be able to control the hostname for the socks proxy. The Datomic team said they'd add it but that was 2 years ago or so. Further, you need a way to have developers create databases with the same name (e.g., "admin") but not trip over each other by transacting to the same database. You'll need to write something to handle that as well. You could have each dev run their own Datomic Cloud system but that gets unwieldy. If you're using Ions, you'll probably need to do that. Finally, the ability to test in memory is simply quite nice. I may not always have a stable internet connection (e.g., working in a cafe, on a plane, etc) and don't want to be blocked from developing. I wish the Datomic team would release an official in-memory implementation for testing. All that being said, we do run integration tests against the Datomic Cloud system.


yes, I really wish there was an in-memory impl for testing purposes as well... the socks proxy situation seems tricky to set up for ci


I don't see the database name as a problem though, your tests can always setup a unique name and we use $USER-dev named databases for all developers


Yes, if you place all your data in a single database, the naming shouldn't be an issue.


after a long battle, we managed to get the socks-proxy running on CircleCI


Nice! You should make a post on the Datomic forum about how you did it.


that's a great idea. i'll confirm that the work is shareable and then hopefully follow up with a post.


@U11SJ6Q0K we've also had some success building and then testing against an in-memory datahike database: you won't be able to test things like Datomic query and transaction functions, but it's a fun idea and faster than querying a database value returned by d/with-db . and of course it isn't "as real" as using Datomic itself.


Assuming I have the attribute :user/id in my schema, is this a valid datomic/metaschema.edn to generate a table?

{:tables {:user/id {}}}
I'm unable to see my table, although I can connect with my schema and catalog and can see the db__attrs and db__idents tables, and so the Troubleshooting docs suggest it's a problem with the metaschema itself. I've tried syncing and cycling my datomic-access connection and presto connection with no luck.


Came back to it later and it's working. Cool.