Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an integration test for canton-repl #12772

Merged
merged 14 commits into from
Feb 8, 2022
Prev Previous commit
Next Next commit
fix test
  • Loading branch information
sofiafaro-da committed Feb 7, 2022
commit 26c2ca138e551517af8f1b56de4e43e7431a0586
2 changes: 1 addition & 1 deletion daml-assistant/integration-tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ da_haskell_test(
"@tar_dev_env//:tar",
] + ([] if is_windows else ts_libraries + ["@script_nix//:bin/script"]),
# I’m sure the mvn stuff will be flaky.
flaky = True,
flaky = False,
hackage_deps = [
"aeson",
"async",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import qualified Data.ByteString.Lazy.Char8 as LBS8
import qualified Data.Conduit.Tar.Extra as Tar.Conduit.Extra
import Data.List.Extra
import Data.String (fromString)
import Data.Maybe (maybeToList)
import Data.Maybe (maybeToList, isJust)
import qualified Data.Text as T
import qualified Data.Text.Encoding as T
import qualified Data.Vector as Vector
Expand Down Expand Up @@ -807,27 +807,28 @@ cantonTests = testGroup "daml sandbox"
, "--ledger-host=localhost", "--ledger-port=" <> show ledgerApiPort
]
step "Start canton-repl"
env <- getEnvironment
let cmd = unwords
-- NOTE (Sofia): We need `script` on Linux and Mac because of this ammonite issue:
-- https://github.com/com-lihaoyi/Ammonite/issues/276
[ "daml canton-repl"
, "--port", show ledgerApiPort
, "--admin-api-port", show adminApiPort
, "--domain-public-port", show domainPublicApiPort
, "--domain-admin-port", show domainAdminApiPort
]
wrappedCmd
| isWindows = cmd
| isMac = concat ["script -q tty.txt ", cmd]
| otherwise = concat ["script --quiet --command '", cmd, "'"]
input = unlines
input =
[ "sandbox.health.running"
, "local.health.running"
]
proc' = (shell wrappedCmd) { cwd = Just dir }
output <- readCreateProcess proc' input
hPutStrLn stderr "canton-repl output:"
hPutStrLn stderr output
wrappedCmd
| isWindows = cmd
| otherwise = "script -q tty.txt " <> cmd
-- NOTE (Sofia): We need to use `script` on Linux and Mac because of this Ammonite issue:
-- https://github.com/com-lihaoyi/Ammonite/issues/276
env' | isWindows || isJust (lookup "TERM" env) = Nothing
| otherwise = Just (("TERM", "xterm-16color") : env)
-- We also need to set TERM to something, otherwise tput complains and crashes Ammonite.
proc' = (shell wrappedCmd) { cwd = Just dir, env = env' }
output <- readCreateProcess proc' (unlines input)

let outputLines = lines output
-- NOTE (Sofia): We use `isInfixOf` extensively because
Expand Down