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: pipeline_test.rs
    path of file: ./repos/moon/nextgen/pipeline/tests
    
    the code of the file until where you have to start completion: use async_trait::async_trait;
use moon_pipeline::*;
use rand::Rng;
use starbase_events::*;
use std::sync::Arc;
use std::time::Duration;
use tokio::sync::RwLock;
use tokio::time::sleep;

fn create_job(id: &str) -> Job<RunState> {
    create_job_with_sleep(id, 500)
}

fn create_job_with_sleep(id: &str, duration: u64) -> Job<RunState> {
    Job::new(id.
    
    async fn can_cancel_all_jobs() {
        let mut pipeline = Pipeline::<RunState>::new();
        pipeline.add_step(create_isolated_job("1"));
        pipeline.add_step(create_isolated_job("2"));
        pipeline.add_step(create_isolated_job("3"));

        let results = pipeline
            .run_with_context(|ctx| {
                ctx.cancel();
            })
            .await
            .unwrap();

        // Others never run since it was cancelled immediately
        assert_eq!(results.len(), 1);
        assert_eq!(results[0].state, RunState::Cancelled);
    }