You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: test_basic_write.rs
    path of file: ./repos/tikv/components/raftstore-v2/tests/failpoints
    
    the code of the file until where you have to start completion: // Copyright 2022 TiKV Project Authors. Licensed under Apache-2.0.

use std::{assert_matches::assert_matches, time::Duration};

use engine_
    
fn test_delete_range() {
    let mut cluster = Cluster::default();
    let mut cached = cluster.node(0).tablet_registry().get(2).unwrap();
    let router = &mut cluster.routers[0];
    router.wait_applied_to_current_term(2, Duration::from_secs(3));

    {
        let snap = router.stale_snapshot(2);
        assert!(snap.get_value(b"key1").unwrap().is_none());
    }
    // write to default and write cf.
    for i in 0..10 {
        let header = Box::new(router.new_request_for(2).take_header());
        let mut put = SimpleWriteEncoder::with_capacity(64);
        put.put(CF_DEFAULT, format!("k{i}").as_bytes(), b"value");
        put.put(CF_WRITE, format!("k{i}").as_bytes(), b"value");
        let (msg, mut sub) = PeerMsg::simple_write(header.clone(), put.encode());
        router.send(2, msg).unwrap();
        assert!(block_on(sub.wait_proposed()));
        assert!(block_on(sub.wait_committed()));
        let resp = block_on(sub.result()).unwrap();
        assert!(!resp.get_header().has_error(), "{:?}", resp);
        let snap = router.stale_snapshot(2);
        assert_eq!(
            snap.get_value(format!("k{i}").as_bytes()).unwrap().unwrap(),
            b"value"
        );
        assert_eq!(
            snap.get_value_cf(CF_WRITE, format!("k{i}").as_bytes())
                .unwrap()
                .unwrap(),
            b"value"
        );
    }
    // flush all data.
    cached.latest().unwrap().flush_cfs(&[], true).unwrap();
    // delete some in default cf.
    let fp = fail::FailGuard::new("should_persist_apply_trace", "return");
    let header = Box::new(router.new_request_for(2).take_header());
    let mut put = SimpleWriteEncoder::with_capacity(64);
    // it will write some tombstones.
    put.delete_range(CF_DEFAULT, b"k3", b"k6", false);
    let (msg, mut sub) = PeerMsg::simple_write(header, put.encode());
    router.send(2, msg).unwrap();
    assert!(block_on(sub.wait_proposed()));
    assert!(block_on(sub.wait_committed()));
    let resp = block_on(sub.result()).unwrap();
    assert!(!resp.get_header().has_error(), "{:?}", resp);
    {
        let snap = router.stale_snapshot(2);
        assert!(snap.get_value(b"k4").unwrap().is_none());
    }
    drop(fp);
    cached
        .latest()
        .unwrap()
        .set_db_options(&[("avoid_flush_during_shutdown", "true")])
        .unwrap();
    cached.release();
    drop(cached);
    cluster.node(0).tablet_registry().remove(2);
    // restart and check delete is re-applied.
    cluster.restart(0);
    cluster.routers[0].wait_applied_to_current_term(2, Duration::from_secs(3));
    let snap = cluster.routers[0].stale_snapshot(2);
    assert_eq!(snap.get_value(b"k2").unwrap().unwrap(), b"value");
    assert!(snap.get_value(b"k3").unwrap().is_none());
    assert!(snap.get_value(b"k4").unwrap().is_none());
    assert!(snap.get_value(b"k4").unwrap().is_none());
    assert_eq!(snap.get_value(b"k6").unwrap().unwrap(), b"value");
}