helm-rs 0.1.2

Typed Rust API for Helm 4: swappable backends, native chart, values and release reading
Documentation
//! Integration tests that need a Kubernetes cluster (run with `--run-ignored only`). They only
//! run against a kind cluster: every test starts with [`require_kind`].
#![cfg(feature = "kube")]

mod cluster {
    mod release;
    mod store;

    use std::path::PathBuf;

    use kube::config::Kubeconfig;

    /// Panics unless the current kubeconfig context (honouring `KUBECONFIG`) is a kind cluster
    /// (`kind-*`); returns the kubeconfig file so tests can hand it to Helm explicitly.
    pub(crate) fn require_kind() -> PathBuf {
        let path = std::env::var_os("KUBECONFIG")
            .and_then(|paths| std::env::split_paths(&paths).next())
            .expect("KUBECONFIG must point at the kind cluster's kubeconfig");
        let context = Kubeconfig::read()
            .expect("kubeconfig")
            .current_context
            .unwrap_or_default();

        assert!(
            context.starts_with("kind-"),
            "the cluster tests only run against kind, but the current context is {context:?}"
        );

        path
    }
}