Make flag-decision tests fail fast and assert the outbound metric

This commit is contained in:
2026-09-30 08:57:40 +03:00
parent 526710ef71
commit aee34f4e14
2 changed files with 13 additions and 9 deletions
+5 -3
View File
@@ -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