mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2025-12-22 22:20:02 +00:00
fix(fuzz): generate valid string (#4281)
* fix: generate valid string * refactor(fuzz): wait for procedure finish at first
This commit is contained in:
@@ -40,6 +40,7 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
use self::insert_expr::{RowValue, RowValues};
|
||||
use crate::context::TableContextRef;
|
||||
use crate::fake::WordGenerator;
|
||||
use crate::generator::{Random, TsValueGenerator};
|
||||
use crate::impl_random;
|
||||
use crate::ir::create_expr::ColumnOption;
|
||||
@@ -450,7 +451,11 @@ pub fn partible_column_options_generator<R: Rng + 'static>(
|
||||
1 => vec![ColumnOption::PrimaryKey, ColumnOption::NotNull],
|
||||
2 => vec![
|
||||
ColumnOption::PrimaryKey,
|
||||
ColumnOption::DefaultValue(generate_random_value(rng, column_type, None)),
|
||||
ColumnOption::DefaultValue(generate_random_value(
|
||||
rng,
|
||||
column_type,
|
||||
Some(&WordGenerator),
|
||||
)),
|
||||
],
|
||||
3 => vec![ColumnOption::PrimaryKey],
|
||||
_ => unreachable!(),
|
||||
|
||||
@@ -69,7 +69,7 @@ pub async fn wait_for_region_distribution(
|
||||
})
|
||||
},
|
||||
move |region_distribution| {
|
||||
info!("Region Distribution: {:?}", region_distribution);
|
||||
info!("region distribution: {:?}", region_distribution);
|
||||
if expected_region_distribution.keys().len() != region_distribution.keys().len() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -222,19 +222,19 @@ async fn execute_region_migration(ctx: FuzzContext, input: FuzzInput) -> Result<
|
||||
}
|
||||
info!("Excepted new region distribution: {new_distribution:?}");
|
||||
|
||||
for procedure_id in procedure_ids {
|
||||
wait_for_procedure_finish(&ctx.greptime, Duration::from_secs(120), procedure_id).await;
|
||||
}
|
||||
|
||||
// Waits for all region migrated
|
||||
wait_for_region_distribution(
|
||||
&ctx.greptime,
|
||||
Duration::from_secs(120),
|
||||
Duration::from_secs(60),
|
||||
table_ctx.name.clone(),
|
||||
new_distribution,
|
||||
)
|
||||
.await;
|
||||
|
||||
for procedure_id in procedure_ids {
|
||||
wait_for_procedure_finish(&ctx.greptime, Duration::from_secs(120), procedure_id).await;
|
||||
}
|
||||
|
||||
// Values validation
|
||||
info!("Validating rows");
|
||||
let ts_column = table_ctx.timestamp_column().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user