Struct solana_program_test::ProgramTestContext
source · [−]pub struct ProgramTestContext {
pub banks_client: BanksClient,
pub last_blockhash: Hash,
pub payer: Keypair,
/* private fields */
}
Fields
banks_client: BanksClient
last_blockhash: Hash
payer: Keypair
Implementations
sourceimpl ProgramTestContext
impl ProgramTestContext
pub fn genesis_config(&self) -> &GenesisConfig
sourcepub fn increment_vote_account_credits(
&mut self,
vote_account_address: &Pubkey,
number_of_credits: u64
)
pub fn increment_vote_account_credits(
&mut self,
vote_account_address: &Pubkey,
number_of_credits: u64
)
Manually increment vote credits for the current epoch in the specified vote account to simulate validator voting activity
sourcepub fn set_account(&mut self, address: &Pubkey, account: &AccountSharedData)
pub fn set_account(&mut self, address: &Pubkey, account: &AccountSharedData)
Create or overwrite an account, subverting normal runtime checks.
This method exists to make it easier to set up artificial situations that would be difficult to replicate by sending individual transactions. Beware that it can be used to create states that would not be reachable by sending transactions!
sourcepub fn set_sysvar<T: SysvarId + Sysvar>(&self, sysvar: &T)
pub fn set_sysvar<T: SysvarId + Sysvar>(&self, sysvar: &T)
Create or overwrite a sysvar, subverting normal runtime checks.
This method exists to make it easier to set up artificial situations that would be difficult to replicate on a new test cluster. Beware that it can be used to create states that would not be reachable under normal conditions!
sourcepub fn warp_to_slot(&mut self, warp_slot: Slot) -> Result<(), ProgramTestError>
pub fn warp_to_slot(&mut self, warp_slot: Slot) -> Result<(), ProgramTestError>
Force the working bank ahead to a new slot
Auto Trait Implementations
impl !RefUnwindSafe for ProgramTestContext
impl Send for ProgramTestContext
impl Sync for ProgramTestContext
impl Unpin for ProgramTestContext
impl !UnwindSafe for ProgramTestContext
Blanket Implementations
impl<T> AbiExample for T
impl<T> AbiExample for T
default fn example() -> T
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> FutureExt for T
impl<T> FutureExt for T
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more