Skip to content

Commit 117d2c3

Browse files
Cmdvkderme
authored andcommitted
update tests for jsonb to allow back and forth
1 parent 328bee3 commit 117d2c3

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ unitTests iom knownMigrations =
3939
"jsonb-in-schema"
4040
[ test "jsonb in schema true" Config.configJsonbInSchemaTrue
4141
, test "jsonb in schema false" Config.configJsonbInSchemaFalse
42-
, expectFailSilent "jsonb in schema should Error" $
43-
Config.configJsonbInSchemaShouldError iom knownMigrations
42+
, test
43+
"jsonb true then false should remove datatype from db"
44+
Config.configJsonbInSchemaShouldAddThenRemove
4445
]
4546
, testGroup
4647
"tx-out"

cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway/Config/JsonbInSchema.hs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
module Test.Cardano.Db.Mock.Unit.Conway.Config.JsonbInSchema (
55
configJsonbInSchemaTrue,
66
configJsonbInSchemaFalse,
7-
configJsonbInSchemaShouldError,
7+
configJsonbInSchemaShouldAddThenRemove,
88
) where
99

1010
import qualified Cardano.Db as DB
@@ -74,8 +74,8 @@ configJsonbInSchemaFalse ioManager metadata = do
7474
{ dncInsertOptions = dncInsertOptions' {sioAddJsonbToSchema = AddJsonbToSchemaConfig False}
7575
}
7676

77-
configJsonbInSchemaShouldError :: IOManager -> [(Text, Text)] -> Assertion
78-
configJsonbInSchemaShouldError ioManager metadata = do
77+
configJsonbInSchemaShouldAddThenRemove :: IOManager -> [(Text, Text)] -> Assertion
78+
configJsonbInSchemaShouldAddThenRemove ioManager metadata = do
7979
syncNodeConfig <- mksNodeConfig
8080
withCustomConfigAndDropDB args (Just syncNodeConfig) cfgDir testLabel action ioManager metadata
8181
where
@@ -95,11 +95,16 @@ configJsonbInSchemaShouldError ioManager metadata = do
9595
}
9696
startDBSync newDbSyncEnv
9797
threadDelay 7_000_000
98+
assertEqQuery
99+
dbSync
100+
DB.queryJsonbInSchemaExists
101+
False
102+
"There should be no jsonb types in database if option has been set to False"
98103
-- Expected to fail
99104
checkStillRuns dbSync
100105

101106
args = initCommandLineArgs {claFullMode = False}
102-
testLabel = "conwayConfigJsonbInSchemaShouldError"
107+
testLabel = "configJsonbInSchemaShouldAddThenRemove"
103108

104109
cfgDir = conwayConfigDir
105110

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]

0 commit comments

Comments
 (0)