jepsen-io / jepsen

A framework for distributed systems verification, with fault injection
6.69k stars 710 forks source link

Making `jepsen.cli/run!` more repl friendly #479

Open stevana opened 3 years ago

stevana commented 3 years ago

I'd like to be able to run my tests from the repl (to make debugging easier), i.e.:

(defn main
  [& args]
  (cli/run! (merge (cli/test-all-cmd    {:tests-fn all-tests
                                         :opt-spec cli-opts})
                   (cli/single-test-cmd {:test-fn smartlog-test
                                         :opt-spec cli-opts})
                   (cli/serve-cmd))

            args))

(main "test" "--workload" ...)

While this works, the use of System/exit in run! and single-test-cmd causes the repl to quit. Could we make variants of those functions that return pure data {:exit exit-code} instead and have wrapper functions with the current names that actually do the System/exit?

aphyr commented 3 years ago

Yeah, I don't see why not. You might have to muck around a bit with the exception and signal handlers but this shouldn't be too hard.On Jul 16, 2020 10:09, Stevan Andjelkovic notifications@github.com wrote: I'd like to be able to run my tests from the repl (to make debugging easier), i.e.: (defn main [& args] (cli/run! (merge (cli/test-all-cmd {:tests-fn all-tests :opt-spec cli-opts}) (cli/single-test-cmd {:test-fn smartlog-test :opt-spec cli-opts}) (cli/serve-cmd))

        args))

(main "test" "--workload" ...) While this works, the use of System/exit in run! and single-test-cmd causes the repl to quit. Could we make variants of those functions that return pure data {:exit exit-code} instead and have wrapper functions with the current names that actually do the System/exit?

—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe.

aphyr commented 3 years ago

Maybe worth mentioning that the usual entry point for repl/library calls to Jepsen is jepsen.core/run!--but if that doesn't meet your needs I understand!On Jul 16, 2020 10:33, aphyr@aphyr.com wrote:Yeah, I don't see why not. You might have to muck around a bit with the exception and signal handlers but this shouldn't be too hard.On Jul 16, 2020 10:09, Stevan Andjelkovic notifications@github.com wrote: I'd like to be able to run my tests from the repl (to make debugging easier), i.e.: (defn main [& args] (cli/run! (merge (cli/test-all-cmd {:tests-fn all-tests :opt-spec cli-opts}) (cli/single-test-cmd {:test-fn smartlog-test :opt-spec cli-opts}) (cli/serve-cmd))

        args))

(main "test" "--workload" ...) While this works, the use of System/exit in run! and single-test-cmd causes the repl to quit. Could we make variants of those functions that return pure data {:exit exit-code} instead and have wrapper functions with the current names that actually do the System/exit?

—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe.