@@ -72,32 +72,27 @@ impl Command {
7272 Self :: ScenariosGenerate ( cmd) => {
7373 #[ cfg( feature = "scenario-generators" ) ]
7474 {
75- let config = ClusterConfig :: new ( None ) . map_err ( |err| {
76- anyhow:: anyhow!( "failed to create cluster configuration: {err}" )
77- } ) ?;
78- let config = if cmd. use_debugger {
79- config. use_debugger ( )
80- } else {
81- config
75+ let run_scenario = |scenario : Scenarios | -> Result < _ , anyhow:: Error > {
76+ let mut config = scenario. default_cluster_config ( ) ?;
77+ if cmd. use_debugger {
78+ config. use_debugger ( ) ;
79+ }
80+ Ok ( scenario. run_only_from_scratch ( config) )
8281 } ;
83-
8482 let fut = async move {
8583 if let Some ( name) = cmd. name {
8684 if let Some ( scenario) = Scenarios :: find_by_name ( & name) {
87- scenario. run_only_from_scratch ( config) . await ;
88- // scenario.run_and_save_from_scratch(config).await;
85+ run_scenario ( scenario) ?. await ;
8986 } else {
9087 anyhow:: bail!( "no such scenario: \" {name}\" " ) ;
9188 }
9289 } else {
9390 for scenario in Scenarios :: iter ( ) {
94- scenario. run_only_from_scratch ( config. clone ( ) ) . await ;
95- // scenario.run_and_save_from_scratch(config.clone()).await;
91+ run_scenario ( scenario) ?. await ;
9692 }
9793 }
9894 Ok ( ( ) )
9995 } ;
100-
10196 rt. block_on ( async {
10297 tokio:: select! {
10398 res = fut => res,
@@ -113,10 +108,10 @@ impl Command {
113108 . into ( ) )
114109 }
115110 Self :: ScenariosRun ( cmd) => {
116- let config = ClusterConfig :: new ( None ) . map_err ( |err| {
111+ let mut config = ClusterConfig :: new ( None ) . map_err ( |err| {
117112 anyhow:: anyhow!( "failed to create cluster configuration: {err}" )
118113 } ) ?;
119- let config = config. set_replay ( ) ;
114+ config. set_replay ( ) ;
120115
121116 let id = cmd. name . parse ( ) ?;
122117 let fut = async move {
0 commit comments