Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

abstraction for inspecting the state history for specific actions, don't inspect history state #195

Open
thedavidmeister opened this issue Aug 9, 2018 · 3 comments

Comments

@thedavidmeister
Copy link
Contributor

thedavidmeister commented Aug 9, 2018

currently it is quite fiddly to find a specific action in the history, it looks something like this:

        while instance
            .state()
            .history
            .iter()
            .find(|aw| match aw.action().signal() {
                Signal::ReturnZomeFunctionResult(_) => true,
                _ => false,
            }) == None
        {
            println!("Waiting for ReturnZomeFunctionResult from genesis");
            sleep(Duration::from_millis(10))
        }

it seems like this could be wrapped up into some tooling, with or without the loop

the alternative is checking for unreliable properties of the state, like the length of history

the history length is being read in multiple places in the codebase making everything fragile

it is too easy for some action logic to change slightly somewhere and leave the test suite hanging with no explanation in some seemingly unrelated part of the codebase

screen shot 2018-08-07 at 11 11 59 pm

@maackle
Copy link
Member

maackle commented Dec 7, 2018

#732 is a large WIP that includes a utility function expect_action that can help clean these tests up

@thedavidmeister
Copy link
Contributor Author

@maackle would it be worth popping the history length utils out into a PR that we can get through more easily than the full signals branch?

@maackle
Copy link
Member

maackle commented Dec 8, 2018

@thedavidmeister the test util depends on the signal implementation which still needs to be tested and vetted, so it can't really be isolated at the moment

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants