diff --git a/cardano-testnet/cardano-testnet.cabal b/cardano-testnet/cardano-testnet.cabal index cd00694abbc..8566ad8afdf 100644 --- a/cardano-testnet/cardano-testnet.cabal +++ b/cardano-testnet/cardano-testnet.cabal @@ -174,6 +174,7 @@ test-suite cardano-testnet-test type: exitcode-stdio-1.0 build-depends: aeson + , aeson-pretty , async , base16-bytestring , bytestring @@ -196,7 +197,6 @@ test-suite cardano-testnet-test , time , transformers , transformers-except - , yaml ghc-options: -threaded -rtsopts -with-rtsopts=-N -with-rtsopts=-T diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/SubmitApi/Babbage/Transaction.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/SubmitApi/Babbage/Transaction.hs index 47204bdffad..95d3533a011 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/SubmitApi/Babbage/Transaction.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/SubmitApi/Babbage/Transaction.hs @@ -44,12 +44,12 @@ import Testnet.Runtime import qualified Cardano.Api.Ledger as L import qualified Data.Aeson as Aeson +import qualified Data.Aeson.Encode.Pretty as Aeson import qualified Data.Aeson.Lens as Aeson import qualified Data.ByteString as BS import qualified Data.ByteString.Base16 as Base16 import qualified Data.ByteString.Lazy as LBS import qualified Data.List as List -import qualified Data.Yaml as Yaml import qualified Hedgehog.Extras.Test.Golden as H import Lens.Micro import Testnet.SubmitApi @@ -95,7 +95,8 @@ hprop_transaction = H.integrationRetryWorkspace 0 "submit-api-babbage-transactio txbodySignedFp <- H.note $ work "tx.body.signed" txbodySignedBinFp <- H.note $ work "tx.body.signed.bin" txFailedResponseFp <- H.note $ work "tx.failed.response" - txFailedResponseYamlFp <- H.note $ work "tx.failed.response.yaml" + txFailedResponseYamlFp <- H.note $ work "tx.failed.response.json" + txFailedResponseYamlGoldenFp <- H.note "test/cardano-testnet-test/files/golden/tx.failed.response.json.golden" void $ execCli' execConfig [ "babbage", "query", "utxo" @@ -195,12 +196,9 @@ hprop_transaction = H.integrationRetryWorkspace 0 "submit-api-babbage-transactio v <- H.leftFailM $ H.evalIO $ Aeson.eitherDecodeFileStrict @Aeson.Value txFailedResponseFp - let opts = Yaml.defaultEncodeOptions - - H.evalIO $ Yaml.encodeFileWith opts txFailedResponseYamlFp v - - H.diffFileVsGoldenFile txFailedResponseYamlFp "test/cardano-testnet-test/files/golden/tx.failed.response.yaml.golden" + H.evalIO $ LBS.writeFile txFailedResponseYamlFp $ Aeson.encodePretty v + H.diffFileVsGoldenFile txFailedResponseYamlFp txFailedResponseYamlGoldenFp redactHashLbs :: LBS.ByteString -> LBS.ByteString redactHashLbs = id diff --git a/cardano-testnet/test/cardano-testnet-test/files/golden/tx.failed.response.json.golden b/cardano-testnet/test/cardano-testnet-test/files/golden/tx.failed.response.json.golden new file mode 100644 index 00000000000..8561163b649 --- /dev/null +++ b/cardano-testnet/test/cardano-testnet-test/files/golden/tx.failed.response.json.golden @@ -0,0 +1,29 @@ +{ + "contents": { + "contents": { + "contents": { + "era": "ShelleyBasedEraBabbage", + "error": [ + { + "contents": { + "contents": "AlonzoInBabbageUtxoPredFailure (ValueNotConservedUTxO (MaryValue (Coin 0) (MultiAsset (fromList []))) (MaryValue (Coin 300000000000) (MultiAsset (fromList []))))", + "tag": "UtxoFailure" + }, + "tag": "UtxowFailure" + }, + { + "contents": { + "contents": "AlonzoInBabbageUtxoPredFailure (BadInputsUTxO (fromList [TxIn (TxId {unTxId = SafeHash \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}) (TxIx 0)]))", + "tag": "UtxoFailure" + }, + "tag": "UtxowFailure" + } + ], + "kind": "ShelleyTxValidationError" + }, + "tag": "TxValidationErrorInCardanoMode" + }, + "tag": "TxCmdTxSubmitValidationError" + }, + "tag": "TxSubmitFail" +} \ No newline at end of file diff --git a/cardano-testnet/test/cardano-testnet-test/files/golden/tx.failed.response.yaml.golden b/cardano-testnet/test/cardano-testnet-test/files/golden/tx.failed.response.yaml.golden deleted file mode 100644 index 6b37ef39bab..00000000000 --- a/cardano-testnet/test/cardano-testnet-test/files/golden/tx.failed.response.yaml.golden +++ /dev/null @@ -1,21 +0,0 @@ -contents: - contents: - contents: - era: ShelleyBasedEraBabbage - error: - - contents: - contents: AlonzoInBabbageUtxoPredFailure (ValueNotConservedUTxO (MaryValue - (Coin 0) (MultiAsset (fromList []))) (MaryValue (Coin 300000000000) (MultiAsset - (fromList [])))) - tag: UtxoFailure - tag: UtxowFailure - - contents: - contents: AlonzoInBabbageUtxoPredFailure (BadInputsUTxO (fromList [TxIn - (TxId {unTxId = SafeHash "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}) - (TxIx 0)])) - tag: UtxoFailure - tag: UtxowFailure - kind: ShelleyTxValidationError - tag: TxValidationErrorInCardanoMode - tag: TxCmdTxSubmitValidationError -tag: TxSubmitFail