jackdaw

https://github.com/FundingCircle/jackdaw
kelveden 2019-06-19T15:06:49.054500Z

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

2019-06-19T15:08:30.055300Z

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

1πŸ‘
kelveden 2019-06-19T15:09:09.055500Z

Just a disclaimer by the way: I sit next to @billh here at work πŸ™‚

Travis 2019-06-19T20:33:53.056400Z

@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

Travis 2019-06-19T20:34:38.056800Z

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

Travis 2019-06-19T20:34:55.057100Z

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

2019-06-19T20:36:02.058200Z

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

2019-06-19T20:36:17.058700Z

Mind posting the function?

Travis 2019-06-19T20:36:20.058900Z

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

2019-06-19T20:36:56.059300Z

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

Travis 2019-06-19T20:37:04.059500Z

ok

Travis 2019-06-19T20:37:35.060Z

[:do! (post-data world)]

Travis 2019-06-19T20:37:44.060200Z

that what your looking for ?

Travis 2019-06-19T20:38:01.060600Z

or the guts of that function

2019-06-19T20:38:32.061200Z

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

Travis 2019-06-19T20:39:02.061600Z

yes, it returns a function like your example above

2019-06-19T20:39:29.062200Z

Hm, maybe lemme check my colleague's examples

Travis 2019-06-19T20:40:43.062800Z

if it helps here is the stack trace after the

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

Travis 2019-06-19T20:40:50.063Z

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

2019-06-19T20:46:42.064200Z

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

Travis 2019-06-19T20:47:00.064500Z

not sure i follow

2019-06-19T20:48:20.065900Z

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)

Travis 2019-06-19T20:49:14.066700Z

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

2019-06-19T20:50:39.067900Z

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

Travis 2019-06-19T20:51:12.068400Z

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

2019-06-19T20:52:37.069800Z

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

Travis 2019-06-19T20:52:54.070400Z

gotcha

Travis 2019-06-19T20:53:21.071300Z

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

Travis 2019-06-19T20:53:52.071900Z

thanks for the help!

2019-06-19T20:54:10.072300Z

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

Travis 2019-06-19T20:54:39.072500Z

gotcha

Travis 2019-06-19T21:01:53.073Z

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