Skip to content

Commit

Permalink
Add temp error for failing boost_manager test
Browse files Browse the repository at this point in the history
When the rest of this code starts to use helium-lib proper, this error type will be removed in lieu of mocking a tonic::Status error
  • Loading branch information
michaeldjeffrey committed Dec 20, 2024
1 parent c68e017 commit f1b1433
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
10 changes: 3 additions & 7 deletions boost_manager/tests/integrations/updater_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct MockTransaction {

pub struct MockSolanaConnection {
submitted: Mutex<Vec<MockTransaction>>,
error: Option<tonic::Status>,
error: Option<String>,
}

impl MockSolanaConnection {
Expand All @@ -34,7 +34,7 @@ impl MockSolanaConnection {
fn with_error(error: String) -> Self {
Self {
submitted: Mutex::new(vec![]),
error: Some(tonic::Status::internal(error)),
error: Some(error),
}
}
}
Expand All @@ -58,11 +58,7 @@ impl SolanaNetwork for MockSolanaConnection {

self.error
.as_ref()
.map(|err| {
Err(SolanaRpcError::HeliumLib(solana::error::Error::Grpc(
err.to_owned(),
)))
})
.map(|err| Err(SolanaRpcError::Test(err.to_owned())))
.unwrap_or(Ok(()))
}

Expand Down
3 changes: 3 additions & 0 deletions solana/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ pub enum SolanaRpcError {
FailedToReadKeypairError(String),
#[error("crypto error: {0}")]
Crypto(#[from] helium_crypto::Error),
// TODO: Remove when fully integrated with helium-lib
#[error("Test Error")]
Test(String),
}

impl From<helium_anchor_gen::anchor_lang::error::Error> for SolanaRpcError {
Expand Down

0 comments on commit f1b1433

Please sign in to comment.