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: retryable_writes.rs
    path of file: ./repos/mongo-rust-driver/src/test/spec
    
    the code of the file until where you have to start completion: mod test_file;

use std::{sync::Arc, time::Duration};

use bson::Bson;
use futures::stream::TryStreamExt;
use semver::VersionReq;
use tokio::sync::Mutex;

use test_file::{TestFile, TestResult};

use crate::{
    bson::{doc, Document},
    error::{ErrorKind, Result, RETRYABLE_WRITE_ERROR},
    event::{
        cmap::{CmapEvent, ConnectionCheckoutFailedReason},
        command::Comma
    
async fn retry_write_same_mongos() {
    let init_client = Client::test_builder().build().await;
    if !init_client.supports_fail_command() {
        log_uncaptured("skipping retry_write_same_mongos: requires failCommand");
        return;
    }
    if !init_client.is_sharded() {
        log_uncaptured("skipping retry_write_same_mongos: requires sharded cluster");
        return;
    }

    let mut client_options = get_client_options().await.clone();
    client_options.hosts.drain(1..);
    client_options.retry_writes = Some(true);
    let fp_guard = {
        let mut client_options = client_options.clone();
        client_options.direct_connection = Some(true);
        let client = Client::test_builder().options(client_options).build().await;
        let fail_opts = FailCommandOptions::builder()
            .error_code(6)
            .error_labels(vec!["RetryableWriteError".to_string()])
            .close_connection(true)
            .build();
        let fp = FailPoint::fail_command(&["insert"], FailPointMode::Times(1), Some(fail_opts));
        client.enable_failpoint(fp, None).await.unwrap()
    };

    let client = Client::test_builder()
        .options(client_options)
        .event_client()
        .build()
        .await;
    let result = client
        .database("test")
        .collection::<bson::Document>("retry_write_same_mongos")
        .insert_one(doc! {}, None)
        .await;
    assert!(result.is_ok(), "{:?}", result);
    let events = client.get_command_events(&["insert"]);
    assert!(
        matches!(
            &events[..],
            &[
                CommandEvent::Started(_),
                CommandEvent::Failed(_),
                CommandEvent::Started(_),
                CommandEvent::Succeeded(_),
            ]
        ),
        "unexpected events: {:#?}",
        events,
    );

    drop(fp_guard); // enforce lifetime
}