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

Runner can freeze and restore openbazaar-go configuration #2

Open
placer14 opened this issue Apr 9, 2019 · 1 comment
Open

Runner can freeze and restore openbazaar-go configuration #2

placer14 opened this issue Apr 9, 2019 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@placer14
Copy link
Member

placer14 commented Apr 9, 2019

Some test scenarios will require the configuration state to be recoverable from a previous point of execution (for example: when providing a copy of the data directory to a running node instead of allowing the original to be manipulated, giving each test instance its own copy of dependent data to work on). Update samulator (cmd/main) to accept an optional flag to allow the buyer, vendor and/or moderator configuration to be rolled back to their original state before exiting.

Implementation details:

  • Runner should be responsible for duplicating and restoring configurations (as this is an ob-go runtime concern and only the runner is aware of configuration paths at this point).
  • When using duplicated configuration data, the data used by the runner during operation should not be the originally provided data path but should be the duplicated data path. If the framework (or consuming script) fails/panics, at least it would leave the original data intact. All efforts should be made to ensure duplicate data is cleaned up.
  • Default samulator data path should be used for duplicate data and sufficiently isolated
@placer14 placer14 added the enhancement New feature or request label Apr 9, 2019
@placer14 placer14 self-assigned this Apr 9, 2019
@placer14
Copy link
Member Author

Thinking that this will follow a database transaction pattern, where you can do the following:

r := &OpenBazaarRunner{}
r.SetNodeStatePath(path)
err := r.NodeState().BeginTransaction() // create a copy of the state, and silently use the copy instead
...do some things with the runner...then later...
err := r.NodeState().RollbackTransaction() // throw away the copy, and make a new one based on the source
...or you can...
err := r.NodeState().CommitTransaction() // throw away the source and replace with the current copy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant