Fork me on GitHub
#jackdaw
<
2019-06-19
>
kelveden15:06:49

I've created a PR that fixes the problem that @billh has been experiencing: https://github.com/FundingCircle/jackdaw/pull/149

cddr15:06:30

Many thanks for chasing it down @billh and @kelveden. Looks good to me. I'll try to get some other eyes on it soon.

👍 4
kelveden15:06:09

Just a disclaimer by the way: I sit next to @billh here at work 🙂

Travis20:06:53

@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

Travis20:06:38

:message "clojure.lang.Agent cannot be cast to clojure.lang.Associative"

Travis20:06:55

i do not see any of my functions in the stack trace

cddr20:06:02

Huh. I think my colleague has actually used this feature to do some live debugging stuff so it should work in principal.

cddr20:06:17

Mind posting the function?

Travis20:06:20

also i can confirm the do! is being called as I can see my data being received on the endpoint

cddr20:06:56

Shouldn't need to see any of the code it calls. Just the body of the command

Travis20:06:35

[:do! (post-data world)]

Travis20:06:44

that what your looking for ?

Travis20:06:01

or the guts of that function

cddr20:06:32

Ah ok. Does (post-data world) return a function of argument 1 arity?

Travis20:06:02

yes, it returns a function like your example above

cddr20:06:29

Hm, maybe lemme check my colleague's examples

Travis20:06:43

if it helps here is the stack trace after the

run-test
which is the last method of my code I see

Travis20:06:50

[[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]

cddr20:06:42

Ah. Are you returning the parameter passed to that function?

Travis20:06:00

not sure i follow

cddr20:06:20

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)

Travis20:06:14

(defn post-data [world]
  (fn [journal]
    (send journal log-result (write-logs world))))

cddr20:06:39

Ah of course. As I recommended. OK after the send, return {:result true}

Travis20:06:12

(defn post-data [world]
  (fn [journal]
    (send journal log-result (write-logs world)
    {:result true}
)))

cddr20:06:37

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

Travis20:06:21

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

Travis20:06:52

thanks for the help!

cddr20:06:10

I'll raise a bug for this. I think it shouldn't matter what is returned by :do commands

Travis21:06:53

I will keep you posted but i think its beginning to come together