-
Notifications
You must be signed in to change notification settings - Fork 36
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
[Feat] Introduce a test storage mode #12
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: ljedrz <[email protected]>
Signed-off-by: ljedrz <[email protected]>
Signed-off-by: ljedrz <[email protected]>
Signed-off-by: ljedrz <[email protected]>
Note: semver-wise, the new |
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.
LGTM
… function Signed-off-by: ljedrz <[email protected]>
pub enum StorageMode { | ||
/// The production mode is used for running a node on the Aleo mainnet. | ||
Production, | ||
/// The development mode is used for running a node on a local network. | ||
Development(u16), | ||
/// The custom mode is used for running a node on custom configurations. | ||
Custom(PathBuf), | ||
/// Test-only ephemeral storage which self-destructs afterwards. | ||
Test(Option<Arc<TempDir>>), |
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.
Nit: why is it wrapped in an Option?
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.
while I don't recall this being used, we might want to reuse an instance of storage in some fine-grained tests, which this would allow
This PR proposes a new
StorageMode::Test
variant which may contain aTempDir
(withfeature = "rocks"
in snarkOS/VM tests). It is intended to replace all current uses ofimpl From<Option<u16>> for StorageMode
, which returnsStorageMode::Production
even in tests (which, without additional setup, would cause the dev's production database to be overwritten), which complicates their setup.With these changes, we could simplify and unify the test storage setup in snarkOS, reducing the LoC related to storage by over 200.