Skip to content

Commit

Permalink
Enhance e2e spec over api
Browse files Browse the repository at this point in the history
  • Loading branch information
ffakenz authored and ch1bo committed Jan 12, 2024
1 parent 74bf84d commit 928e706
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions hydra-cluster/test/Test/HydraExplorerSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Hydra.Prelude hiding (get)
import Test.Hydra.Prelude

import CardanoClient (NodeLog, RunningNode (..), submitTx)
import CardanoNode (withCardanoNodeDevnet)
import CardanoNode (unsafeDecodeJson, withCardanoNodeDevnet)
import Control.Concurrent.Class.MonadSTM (modifyTVar', newTVarIO, readTVarIO)
import Control.Exception (IOException)
import Control.Lens ((^?))
Expand All @@ -22,7 +22,6 @@ import Hydra.Cardano.Api (NetworkId (..), NetworkMagic (..), unFile)
import Hydra.Cluster.Faucet (FaucetLog, publishHydraScriptsAs, seedFromFaucet_)
import Hydra.Cluster.Fixture (Actor (..), aliceSk, bobSk, cperiod)
import Hydra.Cluster.Util (chainConfigFor, keysFor)
import Hydra.HeadId (HeadId (..))
import Hydra.Logging (showLogsOnFailure)
import HydraNode (HydraNodeLog, input, output, requestCommitTx, send, waitFor, waitMatch, withHydraNode)
import Network.HTTP.Client qualified as HTTPClient
Expand Down Expand Up @@ -132,8 +131,8 @@ spec = do
response <- HTTPClient.httpLbs request manager
HTTPClient.responseStatus response `shouldBe` status200
print (HTTPClient.responseBody response)
let maybeOpenHeads = decode $ HTTPClient.responseBody response :: Maybe [HeadId]
maybeOpenHeads `shouldBe` Just [UnsafeHeadId $ encodeUtf8 headId]
allHeads <- unsafeDecodeJson . toStrict $ HTTPClient.responseBody response
allHeads `shouldBe` [headId]

headExplorerSees :: HasCallStack => HydraExplorerHandle -> Value -> Text -> IO ()
headExplorerSees explorer txType headId =
Expand Down
2 changes: 1 addition & 1 deletion hydra-explorer/src/Hydra/Explorer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ httpApp tracer explorerState req send = do
case (requestMethod req, pathInfo req) of
("HEAD", _) -> send $ responseLBS status200 corsHeaders ""
("GET", []) -> send $ handleFile "index.html"
("GET", ["heads"]) -> send $ responseLBS status200 corsHeaders "OK"
("GET", ["heads"]) -> send $ responseLBS status200 corsHeaders "[]"
-- FIXME: do proper file serving, this is dangerous
("GET", path) -> send $ handleFile $ toString $ mconcat $ List.intersperse "/" ("." : path)
(_, _) -> send handleNotFound
Expand Down

0 comments on commit 928e706

Please sign in to comment.