Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Conversation

@akegalj
Copy link
Contributor

@akegalj akegalj commented Oct 26, 2018

Description

have a look at https://github.com/input-output-hk/cardano-sl/compare/akegalj/CO-414/test-sm-reset-state...akegalj/co-412/sqlite-error?expand=1#diff-3b681d025c5691ef4161a3e2d29ebea3R260

-- forAllCommands is using shrinking. When test fail with `postcondition _ GetWalletsA _ = Bot`
-- shrinking is going to start doing its job and I will get the report:
--
--        uncaught exception: SQLError
--        SQLite3 returned ErrorMisuse while attempting to perform prepare "BEGIN TRANSACTION": bad parameter or other API misuse
--        (after 7 tests and 1 shrink)
--          Commands { unCommands = [ Command ResetWalletA (fromList []) ] }
--
-- where I would expect the report similar to the one from prop_fail which looks like:
--
--        Falsifiable (after 1 test):
--          PostconditionFailed "BotC" /= Ok
--
-- is this problem in forAllCommands ? Or is it a problem in wallet backend?
-- or is it a problem with hunit, where we are doing all actions within the bracket
-- `around (withWalletLayer . curry)` (see Spec.hs)? Maybe hunit closed the db handle
-- before forAllCommands finished (if it forked into different thread)?
--
-- note that I have isolated wallet within binary wallet-reset-error (in wallet-new/cardano-sl-wallet-new.cabal)
-- and this binary works well (showcasing that reset wallet is actually working correctly).
-- So my primary suspect is `forAllCommands` (from quickcheck-state-machine) and/or `around` (from hspec)

you can compile it with

stack build --ghc-options="-Wwarn +RTS -A256m -n2m -RTS" --jobs=2 --no-run-tests --no-run-benchmarks --fast  cardano-sl-wallet-new:wallet-sm-tests

and run it with

stack exec -- wallet-sm-tests

Linked issue

Type of change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • 🛠 New feature (non-breaking change which adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)
  • 🏭 Refactoring that does not change existing functionality but does improve things like code readability, structure etc
  • 🔨 New or improved tests for existing code
  • ⛑ git-flow chore (backport, hotfix, etc)

Developer checklist

  • I have read the style guide document, and my code follows the code style of this project.
  • If my code deals with exceptions, it follows the guidelines.
  • I have updated any documentation accordingly, if needed. Documentation changes can be reflected in opening a PR on cardanodocs.com, amending the inline Haddock comments, any relevant README file or one of the document listed in the docs directory.
  • CHANGELOG entry has been added and is linked to the correct PR on GitHub.

Testing checklist

  • I have added tests to cover my changes.
  • All new and existing tests passed.

QA Steps

Screenshots (if available)

@akegalj akegalj force-pushed the akegalj/CO-414/test-sm-reset-state branch from 3979b20 to ffe3e15 Compare November 22, 2018 05:49
@KtorZ
Copy link
Contributor

KtorZ commented Dec 11, 2018

@akegalj Is this still relevant or was this covered by #3870 ?

@akegalj
Copy link
Contributor Author

akegalj commented Dec 11, 2018

@KtorZ We can close this. I used this PR so that I can discuss the issue with the maintainer of the library. In the meantime I have found workaround not to trigger sqlite issue.

Was not aware of #3870 - will have a look. ty

closing

@akegalj akegalj closed this Dec 11, 2018
@akegalj
Copy link
Contributor Author

akegalj commented Dec 11, 2018

Hm, by reading PR - I think this might also fix the problem I had. Will try it eventually TM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants