Skip to content

Commit

Permalink
update tests for jsonb to allow back and forth
Browse files Browse the repository at this point in the history
  • Loading branch information
Cmdv committed Jun 10, 2024
1 parent ffde4af commit 758d311
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
5 changes: 3 additions & 2 deletions cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ unitTests iom knownMigrations =
"jsonb-in-schema"
[ test "jsonb in schema true" Config.configJsonbInSchemaTrue
, test "jsonb in schema false" Config.configJsonbInSchemaFalse
, expectFailSilent "jsonb in schema should Error" $
Config.configJsonbInSchemaShouldError iom knownMigrations
, test
"jsonb true then false should remove datatype from db"
Config.configJsonbInSchemaShouldAddThenRemove
]
, testGroup
"tx-out"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
module Test.Cardano.Db.Mock.Unit.Conway.Config.JsonbInSchema (
configJsonbInSchemaTrue,
configJsonbInSchemaFalse,
configJsonbInSchemaShouldError,
configJsonbInSchemaShouldAddThenRemove,
) where

import qualified Cardano.Db as DB
Expand Down Expand Up @@ -74,8 +74,8 @@ configJsonbInSchemaFalse ioManager metadata = do
{ dncInsertOptions = dncInsertOptions' {sioAddJsonbToSchema = AddJsonbToSchemaConfig False}
}

configJsonbInSchemaShouldError :: IOManager -> [(Text, Text)] -> Assertion
configJsonbInSchemaShouldError ioManager metadata = do
configJsonbInSchemaShouldAddThenRemove :: IOManager -> [(Text, Text)] -> Assertion
configJsonbInSchemaShouldAddThenRemove ioManager metadata = do
syncNodeConfig <- mksNodeConfig
withCustomConfigAndDropDB args (Just syncNodeConfig) cfgDir testLabel action ioManager metadata
where
Expand All @@ -95,11 +95,16 @@ configJsonbInSchemaShouldError ioManager metadata = do
}
startDBSync newDbSyncEnv
threadDelay 7_000_000
assertEqQuery
dbSync
DB.queryJsonbInSchemaExists
False
"There should be no jsonb types in database if option has been set to False"
-- Expected to fail
checkStillRuns dbSync

args = initCommandLineArgs {claFullMode = False}
testLabel = "conwayConfigJsonbInSchemaShouldError"
testLabel = "configJsonbInSchemaShouldAddThenRemove"

cfgDir = conwayConfigDir

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]

0 comments on commit 758d311

Please sign in to comment.