[−][src]Struct exonum_testkit::TestKitBuilder
Builder for TestKit
.
Example
let service = Spec::new(ExampleService).with_instance(SERVICE_ID, "example", ()); let mut testkit = TestKitBuilder::validator() .with(service) .with_validators(4) .build(); testkit.create_block(); // Other test code
Methods
impl TestKitBuilder
[src]
pub fn validator() -> Self
[src]
Creates testkit for the validator node.
pub fn auditor() -> Self
[src]
Creates testkit for the auditor node.
pub fn with_keys(self, keys: impl IntoIterator<Item = Keys>) -> Self
[src]
Creates the validator nodes from the specified keys.
pub fn with_validators(self, validator_count: u16) -> Self
[src]
Sets the number of validator nodes in the test network.
pub fn with(self, spec: impl Deploy) -> Self
[src]
Adds a deploy spec to this builder. The spec may contain artifacts and service instances to deploy at the blockchain start.
pub fn with_plugin(self, plugin: impl NodePlugin + 'static) -> Self
[src]
Adds a node plugin to the testkit.
This method is only available if the crate is compiled with the exonum-node
feature,
which is off by default.
pub fn with_logger(self) -> Self
[src]
Enables a logger inside the testkit.
pub fn with_additional_runtime(self, runtime: impl WellKnownRuntime) -> Self
[src]
Adds a runtime to the testkit in addition to the default Rust runtime.
Panics
- Panics if the builder already contains specified runtime.
pub fn build(self) -> TestKit
[src]
Creates the testkit.
pub async fn serve(
self,
public_api_address: SocketAddr,
private_api_address: SocketAddr
)
[src]
self,
public_api_address: SocketAddr,
private_api_address: SocketAddr
)
Starts a testkit web server, which listens to public and private APIs exposed by
the testkit, on the respective addresses. The private address also exposes the testkit
APIs with the /api/testkit
URL prefix.
Unlike real Exonum nodes, the testkit web server does not create peer-to-peer connections with other nodes, and does not create blocks automatically. The only way to commit transactions is thus to use the testkit API.
See server
module for the description of testkit server API.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for TestKitBuilder
impl Send for TestKitBuilder
impl !Sync for TestKitBuilder
impl Unpin for TestKitBuilder
impl !UnwindSafe for TestKitBuilder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,