mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-19 16:57:40 +03:00
Reuse sandbox & JSON API across daml ledger
tests (#11214)
Speeds them up by more than 2x and reduces flakiness. I also added a higher timeout to the allocate party call since that seems to still be sometimes too slow if lots of things run in parallel. changelog_begin changelog_end
This commit is contained in:
parent
f4ca876756
commit
cb1fb6f7bf
@ -35,12 +35,11 @@ main = do
|
||||
locateRunfiles (mainWorkspace </> "daml-assistant" </> "daml-helper" </> exe "daml-helper")
|
||||
testDar <- locateRunfiles (mainWorkspace </> "daml-assistant" </> "daml-helper" </> "test.dar")
|
||||
defaultMain $
|
||||
testGroup
|
||||
"daml ledger"
|
||||
[ withSandbox defaultSandboxConf $ \getSandboxPort -> do
|
||||
withSandbox defaultSandboxConf $ \getSandboxPort ->
|
||||
withHttpJson getSandboxPort (defaultHttpJsonConf "Alice") $ \getHttpJson ->
|
||||
testGroup
|
||||
"list-parties"
|
||||
"daml ledger"
|
||||
[ testGroup "list-parties"
|
||||
[ testCase "succeeds against HTTP JSON API" $ do
|
||||
HttpJson {hjPort, hjTokenFile} <- getHttpJson
|
||||
sandboxPort <- getSandboxPort
|
||||
@ -54,6 +53,7 @@ main = do
|
||||
, "localhost"
|
||||
, "--port"
|
||||
, show sandboxPort
|
||||
, "--timeout=120"
|
||||
, "Bob"
|
||||
]
|
||||
-- check for parties via json api
|
||||
@ -69,10 +69,7 @@ main = do
|
||||
((show $ PartyDetails (Party "Bob") "Bob" True) `elem` lines out) @?
|
||||
"Bob is not contained in list-parties output."
|
||||
]
|
||||
, withSandbox defaultSandboxConf $ \getSandboxPort -> do
|
||||
withHttpJson getSandboxPort (defaultHttpJsonConf "Alice") $ \getHttpJson ->
|
||||
testGroup
|
||||
"allocate-parties"
|
||||
, testGroup "allocate-parties"
|
||||
[ testCase "succeeds against HTTP JSON API" $ do
|
||||
HttpJson {hjPort, hjTokenFile} <- getHttpJson
|
||||
sandboxPort <- getSandboxPort
|
||||
@ -99,10 +96,7 @@ main = do
|
||||
((show $ PartyDetails (Party "Charlie") "Charlie" True) `elem` lines out) @?
|
||||
"Charlie is not contained in list-parties output."
|
||||
]
|
||||
, withSandbox defaultSandboxConf $ \getSandboxPort -> do
|
||||
withHttpJson getSandboxPort (defaultHttpJsonConf "Alice") $ \getHttpJson ->
|
||||
testGroup
|
||||
"upload-dar"
|
||||
, testGroup "upload-dar"
|
||||
[ testCase "succeeds against HTTP JSON API" $ do
|
||||
HttpJson {hjPort, hjTokenFile} <- getHttpJson
|
||||
sandboxPort <- getSandboxPort
|
||||
@ -139,10 +133,7 @@ main = do
|
||||
fetchedPkgId <- readDarMainPackageId tmp
|
||||
fetchedPkgId == testDarPkgId @? "Fechted dar differs from uploaded dar."
|
||||
]
|
||||
, withSandbox defaultSandboxConf $ \getSandboxPort -> do
|
||||
withHttpJson getSandboxPort (defaultHttpJsonConf "Alice") $ \getHttpJson ->
|
||||
testGroup
|
||||
"fetch-dar"
|
||||
, testGroup "fetch-dar"
|
||||
[ testCase "succeeds against HTTP JSON API" $ do
|
||||
HttpJson {hjPort, hjTokenFile} <- getHttpJson
|
||||
sandboxPort <- getSandboxPort
|
||||
@ -179,9 +170,7 @@ main = do
|
||||
fetchedPkgId <- readDarMainPackageId tmp
|
||||
testDarPkgId == fetchedPkgId @? "Fechted dar differs from uploaded dar."
|
||||
]
|
||||
, withSandbox defaultSandboxConf $ \getSandboxPort -> do
|
||||
testGroup
|
||||
"fetch-dar limited gRPC message size"
|
||||
, testGroup "fetch-dar limited gRPC message size"
|
||||
[ testCase "fails if the message size is too low" $ do
|
||||
sandboxPort <- getSandboxPort
|
||||
testDarPkgId <- readDarMainPackageId testDar
|
||||
|
Loading…
Reference in New Issue
Block a user