This repository has been archived by the owner on Jun 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move start-pipeline-state-updater to pipeline-state and make it publi…
…c so it can be reused by other persistence components
- Loading branch information
Showing
6 changed files
with
58 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
(ns lambdacd.internal.pipeline-state-test | ||
(:use [lambdacd.testsupport.test-util]) | ||
(:require [clojure.test :refer :all] | ||
[lambdacd.internal.pipeline-state :refer :all] | ||
[lambdacd.testsupport.test-util :as tu] | ||
[lambdacd.testsupport.data :refer [some-ctx-with some-ctx]] | ||
[lambdacd.util :as util] | ||
[lambdacd.event-bus :as event-bus] | ||
[clojure.core.async :as async])) | ||
|
||
(deftest pipeline-state-updater-test | ||
(testing "that we tap into the event bus update the pipeline state with its information" | ||
(let [updates (atom []) | ||
ctx (some-ctx) | ||
pipeline-state (reify PipelineStateComponent | ||
(update [self build-number step-id step-result] | ||
(swap! updates #(conj %1 [build-number step-id step-result]))))] | ||
(start-pipeline-state-updater pipeline-state ctx) | ||
|
||
(event-bus/publish ctx :step-result-updated {:build-number 1 :step-id [1 2] :step-result {:status :running}}) | ||
(event-bus/publish ctx :step-result-updated {:build-number 2 :step-id [1 2] :step-result {:status :success}}) | ||
(event-bus/publish ctx :step-result-updated {:build-number 1 :step-id [1 2] :step-result {:status :running :foo :bar}}) | ||
|
||
(wait-for (= 3 (count @updates))) | ||
(is (= [[1 [1 2] {:status :running}] | ||
[2 [1 2] {:status :success}] | ||
[1 [1 2] {:status :running :foo :bar}]] @updates))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters