-
Notifications
You must be signed in to change notification settings - Fork 217
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
Relocate properties to DBSpec for further sharing #270
Conversation
, DummyTarget | ||
, DummyStateMVar (..) | ||
, dbPropertyTests | ||
, prop_readAfterPutBoundary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is that one 🤔 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, this is for SqliteSpec. There was an error when put . read
if status is Restoring Quantity 100 as this was written as Ready
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
namely, it will be used for check that Restoring . Quantity 100 upon write results in Ready upon read
test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not include it in the dbPropertyTests
, that should hold for the MVar too no ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because, it fails -
1) Cardano.Wallet.DB.MVar, put . read yields a result, check that Restoring . Quantity 100 upon write results in Ready upon read
Falsifiable (after 1 test):
(PrimaryKey (WalletId {getWalletId = 8adfe5c94630e8ae4b47d6e4c9363ef31f5fa36b}),WalletMetadata {name = WalletName {getWalletName = "bulbazaur"}, passphraseInfo = Just (WalletPassphraseInfo {lastUpdatedAt = 1864-05-09 09:25:31.730365313989 UTC}), status = Ready, delegation = NotDelegating})
expected: Just (WalletMetadata {name = WalletName {getWalletName = "bulbazaur"}, passphraseInfo = Just (WalletPassphraseInfo {lastUpdatedAt = 1864-05-09 09:25:31.730365313989 UTC}), status = Ready, delegation = NotDelegating})
but got: Just (WalletMetadata {name = WalletName {getWalletName = "bulbazaur"}, passphraseInfo = Just (WalletPassphraseInfo {lastUpdatedAt = 1864-05-09 09:25:31.730365313989 UTC}), status = Restoring (Quantity (Percentage {getPercentage = 100})), delegation = NotDelegating})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, something's wrong then 😄 ! Probably in the generator itself actually. Not sure that Restoring (Quantity 100)
should be an allowed value. I thought about that the other day and we do construct the wallet restoration state "by hand". We'd probably be better off having some clear API for manipulating this type, which enforces that the status can't be above 99
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restoring (Quantity (Percentage {getPercentage = 100})
is stored as it is, but in Sqlite (at least how we implemented it) it was represented as Ready
. This is because of how status 100 is handled in the code (maybe we will change it, and then this property is not needed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I will remove this property and reintroduce it later (if needed) !
then customedGen
will be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, customizedGen makes sense - will recover it
module Cardano.Wallet.DBSpec | ||
( spec | ||
, DummyTarget | ||
, DummyStateMVar (..) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that's MVar-specific, shouldn't it be with DB.MVarSpec ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had problems with Arbitrary instances needed in DbSpec after relocation. To avoid them I put every instances in DBSpec...Maybe it was too quick decision
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's quite minor, but yes, I think at least DummyStateMVar
could just be with the MVar specs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair argument - done
1ef0525
to
34306da
Compare
Remove one property and relocate DummyMvarState
Issue Number
#154
Overview
Comments