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_pd_client_legacy.rs
    path of file: ./repos/tikv/tests/failpoints/cases
    
    the code of the file until where you have to start completion: // Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0.

use std::{
    str::from_utf8,
    sync::{mpsc, Arc},
    thread,
    time::Duration,
};

use grpcio::EnvBuilder;
use kvproto::{metapb::*, pdpb::GlobalConfigItem};
use pd_client::{PdClient, RegionInfo, RegionStat, 
    
fn test_reconnect_limit() {
    let pd_client_reconnect_fp = "pd_client_reconnect";
    let (_server, client) = new_test_server_and_client(ReadableDuration::secs(100));

    // The default retry interval is 300ms so sleeps 400ms here.
    thread::sleep(Duration::from_millis(400));

    // The first reconnection will succeed, and the last_update will not be updated.
    fail::cfg(pd_client_reconnect_fp, "return").unwrap();
    client.reconnect().unwrap();
    // The subsequent reconnection will be cancelled.
    for _ in 0..10 {
        let ret = client.reconnect();
        assert!(format!("{:?}", ret.unwrap_err()).contains("cancel reconnection"));
    }

    fail::remove(pd_client_reconnect_fp);
}