Skip to content

Commit

Permalink
Revert commits pushed by mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
paolino committed Jan 2, 2024
1 parent 9476826 commit 25d66cd
Show file tree
Hide file tree
Showing 15 changed files with 182 additions and 301 deletions.
17 changes: 6 additions & 11 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ default:
@just --list

# check that the code is formatted with stylish-haskell
check:
./.buildkite/check-code-format.sh
check target="stylish":
./.buildkite/check-{{target}}.sh

# build wallet-e2e suite with cabal
build:
Expand Down Expand Up @@ -36,19 +36,14 @@ integration:
# run wallet-e2e suite against the preprod network
e2e-preprod:
nix run '.#cardano-wallet-e2e' -- preprod \
-s lib/wallet-e2e/test-state/preprod \
-c lib/wallet-e2e/config/cardano-node/preprod \
-t lib/wallet-e2e/test-output/preprod

-s lib/wallet-e2e/test-state \
-c lib/wallet-e2e/config/cardano-node/preprod

# run wallet-e2e suite against the local test cluster
e2e-local:
nix shell \
'.#local-cluster' '.#cardano-node' '.#cardano-wallet' '.#cardano-wallet-e2e' \
-c wallet-e2e local \
-s lib/wallet-e2e/test-state/local \
-c lib/local-cluster/test/data/cluster-configs \
-t lib/wallet-e2e/test-output/local
'.#local-cluster' '.#cardano-node' '.#cardano-wallet' '.#cardano-wallet-e2e' '.#local-cluster' \
-c wallet-e2e local -s lib/wallet-e2e/test-state -c lib/local-cluster/test/data/cluster-configs

# run wallet-e2e suite against the manually started node/wallet
e2e-manual:
Expand Down
2 changes: 0 additions & 2 deletions lib/wallet-e2e/cardano-wallet-e2e.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ library
Cardano.Wallet.Spec.Effect.Random
Cardano.Wallet.Spec.Effect.Timeout
Cardano.Wallet.Spec.Effect.Trace
Cardano.Wallet.Spec.Interpreters.Config
Cardano.Wallet.Spec.Interpreters.Effectfully
Cardano.Wallet.Spec.Interpreters.Pure
Cardano.Wallet.Spec.Network.Configured
Expand All @@ -117,7 +116,6 @@ executable wallet-e2e
hs-source-dirs: exe
main-is: Main.hs
ghc-options: -threaded -rtsopts -with-rtsopts=-N
other-modules: Options
build-depends:
, base ^>=4.14.3.0
, cardano-wallet-e2e
Expand Down
124 changes: 119 additions & 5 deletions lib/wallet-e2e/exe/Main.hs
Original file line number Diff line number Diff line change
@@ -1,23 +1,137 @@
module Main where

import qualified Options.Applicative as OptParse
import qualified Test.Syd.OptParse as SydTest

import Cardano.Wallet.Spec
( effectsSpec
( TestNetworkConfig (..)
, effectsSpec
, walletSpec
)
import Data.Tagged
( Tagged (..)
)
import Main.Utf8
( withUtf8
)
import Options
( withTestOptions
import Options.Applicative
( Parser
, eitherReader
, execParser
, fullDesc
, help
, helper
, info
, long
, metavar
, option
, progDesc
, short
)
import Path
( Dir
, SomeBase (..)
, parseSomeDir
)
import Path.IO
( AnyPath (makeAbsolute)
)
import Test.Syd
( sydTestWith
)

main :: IO ()
main = withUtf8 $ withTestOptions $ \testNetwork traceConfiguration ->
main = withUtf8 do
testNetworkOptions <-
execParser
$ info
(parser <**> helper)
(fullDesc <> progDesc "E2E Wallet test suite")
testNetwork <- testNetworkOptionsToConfig testNetworkOptions
sydTestWith SydTest.defaultSettings{SydTest.settingRetries = 1} do
effectsSpec
walletSpec traceConfiguration testNetwork
walletSpec testNetwork

--------------------------------------------------------------------------------
-- Command line options --------------------------------------------------------

data TestNetworkOptions
= TestNetworkOptionManual
| TestNetworkOptionLocal
(Tagged "state" (SomeBase Dir))
(Tagged "config" (SomeBase Dir))
| TestNetworkOptionPreprod
(Tagged "state" (SomeBase Dir))
(Tagged "config" (SomeBase Dir))

testNetworkOptionsToConfig :: TestNetworkOptions -> IO TestNetworkConfig
testNetworkOptionsToConfig = \case
TestNetworkOptionManual ->
pure TestNetworkManual
TestNetworkOptionLocal stateDir nodeConfigsDir -> do
absStateDir <- traverse makeDirAbsolute stateDir
absNodeConfigsDir <- traverse makeDirAbsolute nodeConfigsDir
pure (TestNetworkLocal absStateDir absNodeConfigsDir)
TestNetworkOptionPreprod stateDir nodeConfigsDir -> do
absStateDir <- traverse makeDirAbsolute stateDir
absNodeConfigsDir <- traverse makeDirAbsolute nodeConfigsDir
pure (TestNetworkPreprod absStateDir absNodeConfigsDir)
where
makeDirAbsolute = \case
Abs absDir -> pure absDir
Rel relDir -> makeAbsolute relDir

parser :: Parser TestNetworkOptions
parser = OptParse.subparser $ cmdManual <> cmdLocal <> cmdPreprod
where
cmdManual =
OptParse.command
"manual"
( OptParse.info
(pure TestNetworkOptionManual)
( OptParse.progDesc
"Relies on a node and wallet started manually."
)
)
cmdLocal =
OptParse.command
"local"
( OptParse.info
( TestNetworkOptionLocal
<$> stateDirOption
<*> nodeConfigsDirOption
)
(OptParse.progDesc "Automatically starts a local test cluster.")
)
cmdPreprod =
OptParse.command
"preprod"
( OptParse.info
( TestNetworkOptionPreprod
<$> stateDirOption
<*> nodeConfigsDirOption
)
( OptParse.progDesc
"Automatically starts a preprod node and wallet."
)
)
stateDirOption :: Parser (Tagged "state" (SomeBase Dir)) =
option
(eitherReader (bimap show Tagged . parseSomeDir))
( long "state-dir"
<> short 's'
<> metavar "STATE_DIR"
<> help
"Absolute or relative directory path \
\ to save node and wallet state"
)
nodeConfigsDirOption :: Parser (Tagged "config" (SomeBase Dir)) =
option
(eitherReader (bimap show Tagged . parseSomeDir))
( long "node-configs-dir"
<> short 'c'
<> metavar "NODE_CONFIGS_DIR"
<> help
"Absolute or relative directory path \
\ to a directory with node configs"
)
142 changes: 0 additions & 142 deletions lib/wallet-e2e/exe/Options.hs

This file was deleted.

Loading

0 comments on commit 25d66cd

Please sign in to comment.