-
Notifications
You must be signed in to change notification settings - Fork 632
[CO-436] Change integration tests way of confirming transactions #3791
[CO-436] Change integration tests way of confirming transactions #3791
Conversation
wallet-new/integration/Util.hs
Outdated
confirmTransaction transactions txn = do | ||
let txnEntry: _ = filter ( \x -> (txId x) == (txId txn)) transactions | ||
log $ "Resp : " <> ppShowT txnEntry | ||
liftIO $ [txStatus txnEntry] `shouldContain` [InNewestBlocks, Persisted] |
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 read it the other way around. Isn't [InNewestBlocks, Persisted]
which should contain [txStatus txnEntry]
?
log $ "Resp : " <> ppShowT txnEntry | ||
liftIO $ txConfirmations txnEntry `shouldNotBe` 0 | ||
|
||
confirmTransaction resp txn |
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'd rather have a naming that matches HSpec's style here. Something like:
txn `shouldBeConfirmed` resp
log = putStrLn . mappend "[TEST-LOG] " | ||
|
||
ppShowT :: Show a => a -> Text | ||
ppShowT = fromString . ppShow |
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 those are only used in the above function, let's make them part of a where
clause. There's no reason why they should be available for the rest.
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.
Made changes as suggested, commits squashed. log
, ppShowT
are also used in wallet-new/integration/RandomStateWalk.hs
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.
Okay, we gotta remove this file at some point :| ... But not part of this PR.
Thanks @paweljakubas waiting for the CI and merging if everything's okay.
de4058e
to
e003b10
Compare
[CO-436] Comply with review suggestions [CO-436] Applying shouldNotBeConfirmed when sending from locked addresses
Integration tests now fixed. Good job 👍 |
Description
Here we are switching in a enterprise of confirming the transaction into looking at the status of the transaction. The current tests rely on the confirmation number, which is not correct. The only reason those tests don't fail entirely at this moment is because there is an implicit ordering at the creation_time of the tx. So when the tests take the first tx of the list and check on it, this happens to be the correct tx. But this is very unreliable.
In a nutshell we demand that the transaction's status is either
InNewestBlocks
orPersisted
Linked issue
https://iohk.myjetbrains.com/youtrack/issue/CO-436
Type of change
Developer checklist
Testing checklist
QA Steps
Screenshots (if available)