mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 12:05:05 +08:00
fix the fuzzer
This commit is contained in:
parent
22213dc604
commit
002f42875f
@ -50,34 +50,27 @@ enum Operation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Arbitrary)]
|
#[derive(Debug, Arbitrary)]
|
||||||
struct Batch([Operation; 2]);
|
struct Batch([Operation; 5]);
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut options = EnvOpenOptions::new();
|
let mut options = EnvOpenOptions::new();
|
||||||
options.map_size(1024 * 1024 * 1024 * 1024);
|
options.map_size(1024 * 1024 * 1024 * 1024);
|
||||||
let _tempdir = TempDir::new_in("ramdisk").unwrap();
|
let _tempdir = TempDir::new().unwrap();
|
||||||
let index = Index::new(options, _tempdir.path()).unwrap();
|
let index = Index::new(options, _tempdir.path()).unwrap();
|
||||||
let indexer_config = IndexerConfig::default();
|
let indexer_config = IndexerConfig::default();
|
||||||
let index_documents_config = IndexDocumentsConfig::default();
|
let index_documents_config = IndexDocumentsConfig::default();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
// let v: Vec<u8> = std::iter::repeat_with(|| fastrand::u8(..)).take(1000).collect();
|
let v: Vec<u8> = std::iter::repeat_with(|| fastrand::u8(..)).take(1000).collect();
|
||||||
|
|
||||||
// let data = Unstructured::new(&v);
|
let mut data = Unstructured::new(&v);
|
||||||
// let batches = <[Batch; 3]>::arbitrary(&mut data).unwrap();
|
let batches = <[Batch; 5]>::arbitrary(&mut data).unwrap();
|
||||||
let batches = [
|
|
||||||
Batch([Operation::AddDoc(Document::Five), Operation::AddDoc(Document::Three)]),
|
|
||||||
Batch([Operation::DeleteDoc(DocId::One), Operation::AddDoc(Document::Two)]),
|
|
||||||
Batch([Operation::DeleteDoc(DocId::Zero), Operation::AddDoc(Document::Five)]),
|
|
||||||
];
|
|
||||||
|
|
||||||
dbg!(&batches);
|
dbg!(&batches);
|
||||||
|
|
||||||
let mut wtxn = index.write_txn().unwrap();
|
let mut wtxn = index.write_txn().unwrap();
|
||||||
|
|
||||||
for batch in batches {
|
for batch in batches {
|
||||||
dbg!(&batch);
|
|
||||||
|
|
||||||
let mut builder = IndexDocuments::new(
|
let mut builder = IndexDocuments::new(
|
||||||
&mut wtxn,
|
&mut wtxn,
|
||||||
&index,
|
&index,
|
||||||
|
Loading…
Reference in New Issue
Block a user