vvvvalvalval / datomock

Mocking and forking Datomic Peer connections in-memory.
MIT License
130 stars 6 forks source link

Not compatible with datomic 1.0.6527 #10

Open favila opened 1 year ago

favila commented 1 year ago

Datomic 1.0.6527 added additional methods to the Connection interface related to io-stats to support the new arities of transact and transact async. The datomic.api/transact and transact-async wrappers seem to always use this new method, even if called with only one argument.

This means datomock fails with 1.0.6527. Exceptions look like this:

Uncaught exception, not in assertion.
Exception: java.lang.AbstractMethodError: Method datomock/impl/MockConnection.transact(Ljava/util/List;Ljava/lang/Object;)Ldatomic/ListenableFuture; is abstract
 at datomock.impl.MockConnection.transact (impl.clj:-1)
    datomic.api$transact.invokeStatic (api.clj:107)
    datomic.api$transact.doInvoke (api.clj:105)
    ...

A quick fix is to add the additional method signatures but ignore the io-stat argument:

(defrecord MockConnection [...]
  Connection
  ...
  (transact [this tx-data _] (.transact this tx-data))
  (transactAsync [this tx-data _] (.transact this tx-data))
  ...
)
favila commented 1 year ago

I added #11 to address this.

favila commented 1 year ago

For any future readers: A fork with this patch is available on clojars with coordinate [org.clojars.favila/datomock "0.2.2-favila1"]. We are already using it in our (large) datomock-using test suite with 1.0.6527 without any issues.

svdo commented 1 year ago

Thanks @favila! Would love it if a new release could be made from this repo as well, being the official one. Thanks in advance! :)

dazld commented 1 year ago

@favila thanks a ton - @vvvvalvalval any chance of a release to fix this?

holyjak commented 5 months ago

@vvvvalvalval could you be so very kind and release this fix? It blocks Fulcro from abandoning the old datomic-free for the new, truly free stuff. 🙏