Skip to content
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

Add quickcheck state machine tests #1269

Merged
merged 3 commits into from
Sep 29, 2022
Merged

Add quickcheck state machine tests #1269

merged 3 commits into from
Sep 29, 2022

Conversation

kderme
Copy link
Contributor

@kderme kderme commented Sep 22, 2022

This is a follow up pr to test #1266

These tests generate a list of symbolic commands like these

data Command r
    = RollForward Int
    | RollBack (Maybe BlockNo)
    | StopDBSync
    | StartDBSync
    | AssertBlockNo (Maybe BlockNo)

The commands are translated into real commands. For example RollForward Int will forge a new block that fits on the current chain. These real commands are executed against db-sync using the mock chain-sync server. The symbolic commands are exxecuted against a vesy simplistic Model of db-sync which looks like this:

data Model r = Model
    { serverTip :: Maybe BlockNo
    , dbSyncTip :: Maybe BlockNo
    , dbSynsIsOn :: Bool
    }
    deriving stock (Generic, Show)

Finally a number of postconditions are checked.

@kderme kderme force-pushed the kderme/qsm-tests branch 2 times, most recently from c246b5e to cdcd0a5 Compare September 29, 2022 09:55
@kderme kderme marked this pull request as ready for review September 29, 2022 09:57
@kderme kderme merged commit e5059de into master Sep 29, 2022
@iohk-bors iohk-bors bot deleted the kderme/qsm-tests branch September 29, 2022 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant