I've created a PR that fixes the problem that @billh has been experiencing: https://github.com/FundingCircle/jackdaw/pull/149
Just a disclaimer by the way: I sit next to @billh here at work π
@cddr I am finally trying out what you suggested above with the new
do!
command. I am running into an issue that I canβt tell if its my fault or not . The error is as follows:message "clojure.lang.Agent cannot be cast to clojure.lang.Associative"
i do not see any of my functions in the stack trace
Huh. I think my colleague has actually used this feature to do some live debugging stuff so it should work in principal.
Mind posting the function?
also i can confirm the do! is being called as I can see my data being received on the endpoint
Shouldn't need to see any of the code it calls. Just the body of the command
ok
[:do! (post-data world)]
that what your looking for ?
or the guts of that function
Ah ok. Does (post-data world)
return a function of argument 1 arity?
yes, it returns a function like your example above
Hm, maybe lemme check my colleague's examples
if it helps here is the stack trace after the
run-test
which is the last method of my code I see[[clojure.lang.RT assoc "RT.java" 827]
[clojure.core$assoc__5416 invokeStatic "core.clj" 193]
[clojure.core$assoc__5416 doInvoke "core.clj" 190]
[clojure.lang.RestFn invoke "RestFn.java" 494]
[jackdaw.test.commands$command_handler invokeStatic "commands.clj" 24]
[jackdaw.test.commands$command_handler invoke "commands.clj" 17]
[jackdaw.test$fn__37947 invokeStatic "test.clj" 67]
[jackdaw.test$fn__37947 invoke "test.clj" 66]
[jackdaw.test.middleware$with_status$fn__37932 invoke "middleware.clj" 8]
[jackdaw.test.middleware$with_timing$fn__37935 invoke "middleware.clj" 19]
[jackdaw.test.middleware$with_journal_snapshots$fn__37940 invoke "middleware.clj" 35]
[jackdaw.test$run_test$exe__37988 invoke "test.clj" 128]
[jackdaw.test$run_test$fn__37990 invoke "test.clj" 133]
[jackdaw.test$run_test invokeStatic "test.clj" 130]
[jackdaw.test$run_test invoke "test.clj" 112]
Ah. Are you returning the parameter passed to that function?
not sure i follow
So (post-data world)
returns a function that accepts a single argument. I have a hunch that your function returns that single arg (i.e. the journal)
(defn post-data [world]
(fn [journal]
(send journal log-result (write-logs world))))
Ah of course. As I recommended. OK after the send, return {:result true}
(defn post-data [world]
(fn [journal]
(send journal log-result (write-logs world)
{:result true}
)))
Yep.
The problem you are running into is that the test-machine is trying to assoc
the result of running the command with some metadata that the test-machine collects about the command itself
https://github.com/FundingCircle/jackdaw/blob/master/src/jackdaw/test/commands.clj#L24
gotcha
well that error went away and i think it completed as good as I expect for the moment until the rest of the code is written
thanks for the help!
I'll raise a bug for this. I think it shouldn't matter what is returned by :do
commands
gotcha
I will keep you posted but i think its beginning to come together