Make flag-decision tests fail fast and assert the outbound metric
This commit is contained in:
+5
-3
@@ -21,6 +21,7 @@ import HomeAssistant.Runtime.Metrics (registerAppMetrics)
|
||||
import Katip (Namespace (Namespace), runKatipContextT, Severity (..))
|
||||
import qualified System.Metrics as Metrics
|
||||
import System.IO.Temp (withTempDirectory)
|
||||
import System.Timeout (timeout)
|
||||
import Test.Hspec
|
||||
|
||||
spec :: Spec
|
||||
@@ -50,9 +51,10 @@ spec = describe "Bus" $ do
|
||||
svc = Service "light" "turn_on" Nothing [EntityId "light.test"]
|
||||
runKatipContextT (busLogEnv bus) () (Namespace ["test"]) $
|
||||
channelHassEval bus (CallService req svc)
|
||||
(_, svc') <- atomically $ readTChan (busOutbound bus)
|
||||
svc' `shouldBe` svc
|
||||
|
||||
result <- timeout 1000000 $ atomically $ readTChan (busOutbound bus)
|
||||
case result of
|
||||
Nothing -> expectationFailure "expected a write to the outbound channel"
|
||||
Just (_, svc') -> svc' `shouldBe` svc
|
||||
|
||||
it "generates unique sequential call ids" $ do
|
||||
gen <- mkCallIdGen 0
|
||||
|
||||
Reference in New Issue
Block a user