Skip to content
This repository has been archived by the owner on Jun 15, 2024. It is now read-only.

Commit

Permalink
reproduce #135
Browse files Browse the repository at this point in the history
  • Loading branch information
flosell committed Oct 16, 2016
1 parent a3043db commit b9cad00
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
1 change: 1 addition & 0 deletions example/clj/todopipeline/pipeline.clj
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
; wait-for-frontend-repo

; do-stuff
log-lots-of-output-in-chaining
compare-screenshots
;; this step executes his child-steps (the arguments after the in-parallel) in parallel and waits
;; until all of them are done. if one of them fails, the whole step fails.
Expand Down
24 changes: 23 additions & 1 deletion example/clj/todopipeline/steps.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
(:require [lambdacd.steps.shell :as shell]
[lambdacd.steps.git :as git]
[lambdacd.steps.manualtrigger :as manualtrigger]
[lambdacd.steps.support :as support]))
[lambdacd.steps.support :as support]
[clojure.core.async :as async]
[clojure.tools.logging :as log]))

;; Let's define some constants
(def backend-repo "[email protected]:flosell/todo-backend-compojure.git")
Expand Down Expand Up @@ -42,6 +44,26 @@
(defn wait-for-greeting [args ctx]
(manualtrigger/parameterized-trigger {:greeting { :desc "some greeting"}} ctx))

(defn log-lots-of-output [args ctx]
(support/capture-output ctx
(doall (for [i (range 800)]
(support/if-not-killed ctx
(do
(log/info (str "trying write to " (:result-channel ctx) " " i))
(async/>!! (:result-channel ctx) [:xyz i])
(log/info (str "tried write to " (:result-channel ctx) " " i)))
)))
{:status :success}))

(defn log-lots-of-output-in-chaining [args ctx]
(support/chaining args ctx
(log-lots-of-output support/injected-args support/injected-ctx)))

(defn log-lots-of-output-in-more-chaining [args ctx]
(support/chaining args ctx
(log-lots-of-output-in-chaining support/injected-args support/injected-ctx)))


(defn demonstrate-ansi [args ctx]
(shell/bash ctx "/"
"printf \"\\033[0mAll attributes off\\033[0m\\n\""
Expand Down
25 changes: 24 additions & 1 deletion test/clj/lambdacd/example/steps_test.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
(ns lambdacd.example.steps-test
(:require [clojure.test :refer [deftest testing is]]
[conjure.core :as c]
[lambdacd.internal.execution :as execution]
[lambdacd.testsupport.data :as data]
[lambdacd.steps.git :as git]
[lambdacd.testsupport.noop-pipeline-state :as noop-pipeline-state]
[todopipeline.steps :as steps]))

; testing a simple build step
Expand All @@ -13,4 +16,24 @@
:frontend-revision "some-revision"
:backend-revision "HEAD"
:revision "some-revision"}
(steps/wait-for-frontend-repo nil nil))))))
(steps/wait-for-frontend-repo nil nil))))))

(defmacro with-timeout [millis & body]
`(let [future# (future ~@body)]
(try
(.get future# ~millis java.util.concurrent.TimeUnit/MILLISECONDS)
(catch java.util.concurrent.TimeoutException x#
(do
(future-cancel future#)
"timeout")))))

(defn output-load-test-ctx []
(data/some-ctx-with :pipeline-state-component (noop-pipeline-state/new-no-op-pipeline-state)))

(deftest output-load-test
;(testing "that we don't fail if we come across lots of output for just in general"
; (is (not= "timeout" (with-timeout 10000
; (execution/execute-step {} [(output-load-test-ctx) steps/log-lots-of-output])))))
(testing "that we don't fail if we come across lots of output for chaining"
(is (not= "timeout" (with-timeout 5000
(execution/execute-step {} [(output-load-test-ctx) steps/log-lots-of-output-in-chaining]))))))

0 comments on commit b9cad00

Please sign in to comment.