pub struct IntegrationTestInput {
pub id: NodeId,
pub name: Option<String>,
pub description: Option<String>,
pub args: Option<String>,
pub env: Option<BTreeMap<String, EnvValue>>,
pub outputs: BTreeSet<DataId>,
pub inputs: BTreeMap<DataId, Input>,
pub send_stdout_as: Option<String>,
pub events: Vec<TimedIncomingEvent>,
}Expand description
Defines the input data and events for integration testing a node.
Most of the fields are similar to the fields defined in the Node
struct, which is used to define nodes in a dataflow YAML file.
For integration testing, the most important field is the events field, which
specifies the events that should be sent to the node during the test.
Fields§
§id: NodeIdUnique node identifier. Must not contain / characters.
Node IDs can be arbitrary strings with the following limitations:
- They must not contain any
/characters (slashes). - We do not recommend using whitespace characters (e.g. spaces) in IDs
Each node must have an ID field.
§Example
nodes:
- id: camera_node
- id: some_other_nodename: Option<String>Human-readable node name for documentation.
This optional field can be used to define a more descriptive name in addition to a short
id.
§Example
nodes:
- id: camera_node
name: "Camera Input Handler"description: Option<String>Detailed description of the node’s functionality.
§Example
nodes:
- id: camera_node
description: "Captures video frames from webcam"args: Option<String>Command-line arguments passed to the executable.
The command-line arguments that should be passed to the executable/script specified in path.
The arguments should be separated by space.
This field is optional and defaults to an empty argument list.
§Example
nodes:
- id: example
path: example-node
args: -v --some-flag fooenv: Option<BTreeMap<String, EnvValue>>Environment variables for node builds and execution.
Key-value map of environment variables that should be set for both the
build operation and the node execution (i.e. when the node is spawned
through path).
Supports strings, numbers, and booleans.
§Example
nodes:
- id: example-node
path: path/to/node
env:
DEBUG: true
PORT: 8080
API_KEY: "secret-key"outputs: BTreeSet<DataId>Output data identifiers produced by this node.
List of output identifiers that the node sends.
Must contain all output_id values that the node uses when sending output, e.g. through the
send_output
function.
§Example
nodes:
- id: example-node
outputs:
- processed_image
- metadatainputs: BTreeMap<DataId, Input>Input data connections from other nodes.
Defines the inputs that this node is subscribing to.
The inputs field should be a key-value map of the following format:
input_id: source_node_id/source_node_output_id
The components are defined as follows:
-
input_idis the local identifier that should be used for this input.This will map to the
idfield ofEvent::Inputevents sent to the node event loop. -
source_node_idshould be theidfield of the node that sends the output that we want to subscribe to -
source_node_output_idshould be the identifier of the output that that we want to subscribe to
§Example
nodes:
- id: example-node
outputs:
- one
- two
- id: receiver
inputs:
my_input: example-node/twosend_stdout_as: Option<String>Redirect stdout/stderr to a data output.
This field can be used to send all stdout and stderr output of the node as a Dora output. Each output line is sent as a separate message.
§Example
nodes:
- id: example
send_stdout_as: stdout_output
- id: logger
inputs:
example_output: example/stdout_outputevents: Vec<TimedIncomingEvent>List of incoming events for the integration test.
The node event stream will yield these events during the test. Once the list is exhausted, the event stream will close itself.
Implementations§
Source§impl IntegrationTestInput
impl IntegrationTestInput
pub fn new(id: NodeId, events: Vec<TimedIncomingEvent>) -> IntegrationTestInput
Trait Implementations§
Source§impl Debug for IntegrationTestInput
impl Debug for IntegrationTestInput
Source§impl<'de> Deserialize<'de> for IntegrationTestInput
impl<'de> Deserialize<'de> for IntegrationTestInput
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<IntegrationTestInput, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<IntegrationTestInput, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for IntegrationTestInput
impl PartialEq for IntegrationTestInput
Source§impl Serialize for IntegrationTestInput
impl Serialize for IntegrationTestInput
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for IntegrationTestInput
Auto Trait Implementations§
impl Freeze for IntegrationTestInput
impl RefUnwindSafe for IntegrationTestInput
impl Send for IntegrationTestInput
impl Sync for IntegrationTestInput
impl Unpin for IntegrationTestInput
impl UnwindSafe for IntegrationTestInput
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request