<commit_before>// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0

#![forbid(unsafe_code)]
use std::cmp::min;

use crate::experiments::ExperimentParam;
use crate::{
    cluster::Cluster,
    experiments::{
        Experiment, PerformanceBenchmarkNodesDownParams,
        PerformanceBenchmarkThreeRegionSimulationParams, RebootRandomValidatorsParams,
        RecoveryTimeParams,
    },
};

pub struct ExperimentSuite {
    pub experiments: Vec<Box<dyn Experiment>>,
}

impl ExperimentSuite {
    pub fn new_pre_release(cluster: &Cluster) -> Self {
        let mut experiments: Vec<Box<dyn Experiment>> = vec![];
        experiments.push(Box::new(
            RecoveryTimeParams {
                num_accounts_to_mint: 100_000,
            }
            .build(cluster),
        ));
        let count = min(3, cluster.instances().len() / 3);
        // Reboot different sets of 3 validators *100 times
        for _ in 0..10 {
            let b = Box::new(RebootRandomValidatorsParams { count }.build(cluster));
            experiments.push(b);
        }
        experiments.push(Box::new(
            PerformanceBenchmarkNodesDownParams { num_nodes_down: 0 }.build(cluster),
        ));
        experiments.push(Box::new(<commit_msg>[cluster-test] Disable recovery experiment by default<commit_after>// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0

#![forbid(unsafe_code)]
use std::cmp::min;
use std::env;

use crate::experiments::ExperimentParam;
use crate::{
    cluster::Cluster,
    experiments::{
        Experiment, PerformanceBenchmarkNodesDownParams,
        PerformanceBenchmarkThreeRegionSimulationParams, RebootRandomValidatorsParams,
        RecoveryTimeParams,
    },
};

pub struct ExperimentSuite {
    pub experiments: Vec<Box<dyn Experiment>>,
}

impl ExperimentSuite {
    pub fn new_pre_release(cluster: &Cluster) -> Self {
        let mut experiments: Vec<Box<dyn Experiment>> = vec![];
        if env::var("RECOVERY_EXP").is_ok() {
            experiments.push(Box::new(
                RecoveryTimeParams {
                    num_accounts_to_mint: 100_000,
                }
                .build(cluster),
            ));
        }
        let count = min(3, cluster.instances().len() / 3);
        // Reboot different sets of 3 validators *100 times
        for _ in 0..10 {
            let b = Box::new(RebootRandomValidatorsParams { count }.build(cluster));
            experiments.push(b);
        }
        experiments.push(Box::new(
            PerformanceBenchmarkNodesDownParams { num_nodes_down: 0 }.build(cluster),
        ));
        experiments.push(Box::new(
{'fraction_non_alphanumeric': 0.11448948948948949, 'fraction_numerical': 0.013513513513513514, 'mean_word_length': 2.6707988980716255, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5546273', 'n_tokens_mistral': 783, 'n_tokens_neox': 755, 'n_words': 160}