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: basic.rs
    path of file: ./repos/rivet/svc/api/route/tests
    
    the code of the file until where you have to start completion: use std::sync::Once;

use proto::backend::{self, pkg::*};
use rivet_operation::prelude::*;
use std::time::Duration;

/// How long to wait for a CDN configuration to apply.
const CDN_SLEEP_DURATION: Duration = Duration::from_secs(5);

/// How frequently to poll the CDN for the new configuration to be applied.
const CDN_POLL_INTERVAL: Duration = Duration::from_millis(500);

static GLOBAL_INIT: Once = Once::new();

const API_ROUTE_URL: &str = "http://rivet-api-route.rivet-service.svc.cluster.local";

async fn get_api_route_token() -> String {
	util::env::read_secret(&["rivet", "api_route", "token"])
		.await
		.unwrap()
}

struct Ctx {
	op_ctx: OperationContext<()>,
}

impl Ctx {
	async fn init() -> Ctx {
		GLOBAL_INIT.call_once(|| {
			tracing_subscriber::fmt()
				.pretty()
				.with_max_level(tracing::Level::INFO)
				.with_target(false)
				.init();
		});

		let pools = rivet_pools::from_env("api-auth-test").await.unwrap();
		let cache = rivet_cache::CacheInner::new(
			"api-auth-test".to_string
    
async fn cdn() {
	if !util::feature::cf_custom_hostname() {
		return;
	}

	struct Namespace {
		namespace_id: Uuid,
		domain: String,
	}

	let ctx = Ctx::init().await;

	let game_res = op!([ctx] faker_game {
		..Default::default()
	})
	.await
	.unwrap();
	// let game_id = game_res.game_id.as_ref().unwrap().as_uuid();
	let namespaces = game_res
		.namespace_ids
		.clone()
		.into_iter()
		.map(|namespace_id| Namespace {
			namespace_id: *namespace_id,
			domain: format!("{}.com", util::faker::ident()),
		})
		.collect::<Vec<_>>();

	for ns in &namespaces {
		op!([ctx] cdn_namespace_domain_create {
			namespace_id: Some(ns.namespace_id.into()),
			domain: ns.domain.clone(),
		})
		.await
		.unwrap();
	}

	tokio::time::sleep(CDN_SLEEP_DURATION).await;

	// MARK: GET /traefik/config/core
	{
		tracing::info!("fetching traefik config");

		let res = reqwest::Client::new()
			.get(&format!(
				"{API_ROUTE_URL}/traefik/config/core?token={token}",
				token = get_api_route_token().await
			))
			.send()
			.await
			.unwrap()
			.error_for_status()
			.unwrap()
			.json::<api_route::route::traefik::TraefikConfigResponseNullified>()
			.await
			.unwrap();
		let routers = res.http.as_ref().unwrap().routers.as_ref().unwrap();
		let middlewares = res
			.http
			.as_ref()
			.unwrap()
			.middlewares
			.as_ref()
			.expect("no middlewares");

		for ns in &namespaces {
			let rewrite_middleware_key = format!("ns-rewrite:{}", ns.namespace_id);
			let ns_router_insecure = routers
				.get(&format!("ns:{}-insecure", ns.namespace_id))
				.expect("missing insecure router");
			let ns_router_secure = routers
				.get(&format!("ns:{}-secure", ns.namespace_id))
				.expect("missing secure router");
			let rewrite_middleware = middlewares
				.get(&rewrite_middleware_key)
				.expect("missing rewrite middleware");

			{
				let custom_headers_key = format!("ns-custom-headers:{}-secure:", ns.namespace_id);

				routers
					.iter()
					.find(|(key, _)| key.starts_with(&custom_headers_key))
					.expect("missing custom headers routers");
				routers
					.iter()
					.find(|(key, _)| key.starts_with(&custom_headers_key))
					.expect("missing custom headers middleware");
			}

			tracing::info!(
				?ns_router_insecure,
				?ns_router_secure,
				?rewrite_middleware,
				"found namespace"
			);

			let domain_part = format!("Host(`{}`)", ns.domain);
			assert!(ns_router_insecure
				.rule
				.as_ref()
				.unwrap()
				.contains(&domain_part));
			assert!(ns_router_secure
				.rule
				.as_ref()
				.unwrap()
				.contains(&domain_part));

			assert_eq!(
				"traffic-server-traffic-server@kubernetescrd",
				ns_router_insecure.service,
			);
			assert_eq!(
				"traffic-server-traffic-server@kubernetescrd",
				ns_router_secure.service,
			);

			assert!(ns_router_insecure
				.middlewares
				.contains(&rewrite_middleware_key));
			assert!(ns_router_secure
				.middlewares
				.contains(&rewrite_middleware_key));
		}
	}
}