Skip to content

Commit

Permalink
tests: 🔨 add mock consensus test with view server
Browse files Browse the repository at this point in the history
  • Loading branch information
cratelyn committed Mar 7, 2024
1 parent 6dfad36 commit 6e8887a
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions crates/core/app/tests/mock_consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// Note: these should eventually replace the existing test cases. mock consensus tests are placed
// here while the engine is still in development. See #3588.

use tempfile::tempdir;

mod common;

use {
Expand Down Expand Up @@ -204,3 +206,30 @@ async fn mock_consensus_can_spend_notes_and_detect_outputs() -> anyhow::Result<(

Ok(())
}

#[tokio::test]
#[ignore = "this test is not currently expected to pass"] /*TODO(kate)*/
async fn mock_consensus_view_server_test() -> anyhow::Result<()> {
use camino::Utf8PathBuf;

// Install a test logger, acquire some temporary storage, and start the test node.
let guard = common::set_tracing_subscriber();
let tempdir = tempdir()?;
let storage = TempStorage::new().await?;
let _test_node = common::start_test_node(&storage).await?;

const VIEW_FILE_NAME: &str = "pcli-view.sqlite"; /*copied from pcli*/
let url = "http:127.0.0.1:8080".parse::<url::Url>()?;
let sqlite_path = tempdir.path().join(VIEW_FILE_NAME);
let view_service = penumbra_view::ViewServer::load_or_initialize(
Some(Utf8PathBuf::from_path_buf(sqlite_path).unwrap()),
&*test_keys::FULL_VIEWING_KEY,
url,
)
.await?;

drop(view_service);
drop(tempdir);
drop(guard);
Ok(())
}

0 comments on commit 6e8887a

Please sign in to comment.