-
Notifications
You must be signed in to change notification settings - Fork 632
[CBR-398] Adding integration test for redeemADA functionality #3525
[CBR-398] Adding integration test for redeemADA functionality #3525
Conversation
I checked logs in integrationTests and the error comes from Transactions test suites (meaning test added in this PR come through):
|
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.
Good job @paweljakubas ! This looks good apart from one minor thing which could inflate CI times a bit, and we definitely want to keep that under control 😉
After you amend, that's good to go on my and @edsko 's sides (we co-reviewed together).
@@ -98,6 +98,67 @@ accountSpecs wRef wc = | |||
|
|||
map (AccountBalance . accAmount) accsUpdated `shouldBe` balancesPartialUpdated | |||
|
|||
|
|||
|
|||
it "redeeming avvv key gives rise to the corresponding increase of balance of wallet'account - mnemonic not used" $ do |
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.
Little typo, it's "avvm".
Wallet{..} <- createWalletCheck wc newWallet | ||
|
||
--adding new account | ||
rAcc <- generate arbitrary :: IO NewAccount |
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.
For now this is OK -- but remember to fix it as part of CBR-408! 😉
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 will :-)
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.
we have a new input - actually doing generate arbitrary
in the body of property test is not what we want (long term). But I guess this is not place to do the refactorings. @KtorZ will probably organize a call this week to talk about this
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 already removed all generate/etc from integration tests here: https://github.com/input-output-hk/cardano-sl/compare/paweljakubas/CBR-408/improve-integration-tests and hope this one will be merged soon (after adding proper instances). And then return to this ticket, rebase and adopt pick instead of generate
-- state-demo/genesis-keys/keys-fakeavvm/fake-9.seed | ||
let avvmKey = "QBYOctbb6fJT/dBDLwg4je+SAvEzEhRxA7wpLdEFhnY=" | ||
--password is set to Nothing | ||
passPhrase <- generate (pure mempty) :: IO SpendingPassword |
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.
Another 👿 generate
call 😉
|
||
txn <- fmap wrData etxn `shouldPrism` _Right | ||
|
||
threadDelay 180000000 |
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 would suggest to reduce the number of seconds you wait here -- this is inflating the CI running time of 3 minutes 😉
What about ~30/60 seconds? That should be plenty for the node to accept the block with the new transaction.
27cd8e8
to
0c9a291
Compare
Changes adopted: rebased
|
walletIntegration error come from TransactionsSpecs.hs:
|
@paweljakubas The reason why you had to change your generator for
And the occasion failures you saw were probably the ones where I think what you did here is fine, but you should document the above in your code, to make sure the reader understands why you are passing an empty spending password. Of course there is the open question whether or not |
0c9a291
to
33c3970
Compare
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.
The wallet integration tests are failing on this, but its not the know flakey test that failing but the determinisic test. Specifically in https://hydra.iohk.io/build/228408/log
integration/TransactionSpecs.hs:103:13:
1) Transactions asset-locked wallets can receive funds and transactions are confirmed in index
not expected: 0
integration/TransactionSpecs.hs:133:17:
2) Transactions sending from asset-locked address in wallet with no ther addresses gets 0 confirmations from core nodes
uncaught exception: PatternMatchFail
integration/TransactionSpecs.hs:133:17-74: Irrefutable pattern failed for pattern txnEntry : _
The flakey parts of that test are being disabled which will make it easier to see this problem.
The flakey test has been removed from the wallet integration test. Please rebase against current develop. If you still have a failing test, then something got inadvertently broken. |
33c3970
to
685aaf8
Compare
I rebased and it seems now integration tests with redeemADA test added have passed |
685aaf8
to
65cf63b
Compare
Rebased once again against develop |
|
The test I added passed (it is in Accounts spec last position). Unfortunately, at present the more tests we have, the more fragmented the coins distribution becomes, and thus, the more likely overall the tests are to fail. |
@paweljakubas That suggests we need to split the tests up so that every test begins in a state such that the test will only fail if there actually is something wrong. |
…t ever use it in the future
65cf63b
to
0dc9013
Compare
rebased, and used prop/withSuccesses/pick/monadicIO - removed generate occurences (only for redeemADA 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.
A few comments, mostly cosmetic.
I'll have that merged however because it works fine, but please @paweljakubas have a look at them for the record 😄
balancePartialRespB <- run $ getAccountBalance wc walId (accIndex newAcct) | ||
balancesPartialB <- run $ wrData <$> balancePartialRespB `shouldPrism` _Right | ||
let zeroBalance = AccountBalance $ V1 (Core.mkCoin 0) | ||
liftIO $ balancesPartialB `shouldBe` zeroBalance |
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.
This is unnecessary. Since newAcct
has already been fetched, you can check the balance of this one should you have to.
|
||
--password is set to Nothing in the current implementation of randomWallet | ||
--when it changes redemptionSpendingPassword handles it, otherwise passPhare addresses it | ||
passPhrase <- pure mempty :: PropertyM IO SpendingPassword |
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.
Minor note:
You can use TypeApplication
or apply the type annotation to the mempty
directly to avoid mentioning all the context around pure (mempty @SpendingPassword)
or pure (mempty :: SpendingPassword)
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.
Actually, see note below.
, redemptionMnemonic = Nothing | ||
, redemptionSpendingPassword = case newwalSpendingPassword newWallet of | ||
Just spPassw -> spPassw | ||
Nothing -> passPhrase |
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.
Minor note:
Reads better as:
let redemption = Redemption
{ redemptionRedemptionCode = ShieldedRedemptionCode avvmKey
, redemptionMnemonic = Nothing
, redemptionSpendingPassword = fromMaybe mempty (newwalSpendingPassword newWallet)
liftIO $ balancesPartial `shouldBe` nonzeroBalance | ||
|
||
--redeemAda for the same redeem address should result in error | ||
etxnAgain <- run $ redeemAda wc redemption |
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.
Would have been nice to have a separated test for that as we're testing a different requirement with this 👍
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.
LGTM, I think at this stage get going with the integration tests is more important than getting trapped into the details. We can give this one a second look once we start overhauling the integration tests for good.
Description
integration test for redeemADA. The tests do the following:
redeemAda
is calledredeemAda
is tried again with the same redemption value and it is expected to end up with errorRequest error (Cannot send redemption transaction: Redemption address balance is 0)"
Remark: checking redeemADA with the same redemption value - I expect error here and at this moment the below works:
ClientWalletError (UnknownError "Request error (Cannot send redemption transaction: Redemption address balance is 0)")
When new data layer is switched on: catching
RedeemAdaNotAvailable Address
should be enforcedLinked issue
https://iohk.myjetbrains.com/youtrack/issue/CBR-398
Type of change
Developer checklist
Testing checklist
QA Steps
nix-build release.nix -A tests.walletIntegration
Screenshots (if available)