fix: use empty pipeline and executor by default (#3845)

This commit is contained in:
Dan Cline
2023-07-19 10:44:35 -04:00
committed by GitHub
parent 4a86aae213
commit 4ed7abd1a1

View File

@@ -1821,25 +1821,33 @@ mod tests {
}
/// Represents either test pipeline outputs, or real pipeline configuration.
#[derive(Default)]
enum TestPipelineConfig {
/// Test pipeline outputs.
Test(VecDeque<Result<ExecOutput, StageError>>),
/// Real pipeline configuration.
#[default]
Real,
}
impl Default for TestPipelineConfig {
fn default() -> Self {
Self::Test(VecDeque::new())
}
}
/// Represents either test executor results, or real executor configuration.
#[derive(Default)]
enum TestExecutorConfig {
/// Test executor results.
Test(Vec<PostState>),
/// Real executor configuration.
#[default]
Real,
}
impl Default for TestExecutorConfig {
fn default() -> Self {
Self::Test(Vec::new())
}
}
/// A type that represents one of two possible executor factories.
#[derive(Debug, Clone)]
enum EitherExecutorFactory<A: ExecutorFactory, B: ExecutorFactory> {
@@ -1963,6 +1971,18 @@ mod tests {
self
}
/// Uses the real pipeline instead of a pipeline with empty exec outputs.
fn with_real_pipeline(mut self) -> Self {
self.pipeline_config = TestPipelineConfig::Real;
self
}
/// Uses the real executor instead of a executor with empty results.
fn with_real_executor(mut self) -> Self {
self.executor_config = TestExecutorConfig::Real;
self
}
/// Sets the client to use for network operations.
#[allow(dead_code)]
fn with_client(mut self, client: Client) -> Self {
@@ -2655,7 +2675,10 @@ mod tests {
);
let (consensus_engine, env) =
TestConsensusEngineBuilder::<NoopFullBlockClient>::new(chain_spec.clone()).build();
TestConsensusEngineBuilder::<NoopFullBlockClient>::new(chain_spec.clone())
.with_real_pipeline()
.with_real_executor()
.build();
let genesis =
SealedBlock { header: chain_spec.sealed_genesis_header(), ..Default::default() };