Crate seppo

Crate seppo 

Source
Expand description

Seppo - Kubernetes SDK

A native Rust library for Kubernetes operations. No config files, just code.

§Example

use seppo::{ClusterConfig, EnvironmentConfig, WaitCondition, Config, setup};

#[tokio::test]
async fn integration_test() -> Result<(), Box<dyn std::error::Error>> {
    // Define cluster
    let cluster = ClusterConfig::kind("my-test")
        .workers(2);

    // Define environment
    let env = EnvironmentConfig::new()
        .image("myapp:test")
        .manifest("./k8s/deployment.yaml")
        .wait(WaitCondition::available("deployment/myapp"));

    // Setup and run
    let config = Config::new(cluster).environment(env);
    setup(&config).await?;

    // Your tests here...

    Ok(())
}

§Quick Start

use seppo::cluster;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create Kind cluster
    cluster::create("test").await?;

    // Load image
    cluster::load_image("test", "myapp:v1").await?;

    // Run your tests...

    // Cleanup
    cluster::delete("test").await?;

    Ok(())
}

§Providers

  • Kind (default): Local Docker-based clusters
  • Minikube: Local VM-based clusters
  • Existing: Use pre-existing clusters

Re-exports§

pub use assertions::AssertionError;
pub use assertions::DeploymentAssertion;
pub use assertions::PodAssertion;
pub use assertions::PvcAssertion;
pub use assertions::ServiceAssertion;
pub use cluster::create;
pub use cluster::delete;
pub use cluster::load_image;
pub use config::ClusterConfig;
pub use config::ClusterProviderType;
pub use config::Config;
pub use config::EnvironmentConfig;
pub use config::WaitCondition;
pub use context::parse_forward_target;
pub use context::parse_resource_ref;
pub use context::Context;
pub use context::ContextError;
pub use context::ForwardTarget;
pub use context::ResourceKind;
pub use context::TestContext;Deprecated
pub use diagnostics::Diagnostics;
pub use environment::setup;
pub use environment::EnvironmentError;
pub use environment::SetupResult;
pub use eventually::consistently;
pub use eventually::eventually;
pub use eventually::ConditionError;
pub use eventually::Consistently;
pub use eventually::Eventually;
pub use fixtures::deployment;
pub use fixtures::pod;
pub use fixtures::service;
pub use fixtures::DeploymentFixture;
pub use fixtures::PodFixture;
pub use fixtures::ServiceFixture;
pub use metrics::MetricsError;
pub use metrics::PodMetrics;
pub use portforward::PortForward;
pub use portforward::PortForwardError;
pub use provider::get_provider;
pub use provider::ClusterProvider;
pub use provider::ExistingProvider;
pub use provider::KindProvider;
pub use provider::MinikubeProvider;
pub use provider::ProviderError;
pub use runner::run;
pub use runner::run_with_env;
pub use runner::RunResult;
pub use runner::RunnerError;
pub use stack::stack;
pub use stack::ServiceBuilder;
pub use stack::Stack;
pub use stack::StackError;
pub use telemetry::init_logging;
pub use traffic::HttpAssert;
pub use traffic::RequestRecord;
pub use traffic::TrafficError;
pub use traffic::TrafficRecorder;
pub use wait::ResourceState;
pub use wait::WaitError;
pub use wait::WaitEvent;

Modules§

assertions
Semantic assertions for Kubernetes resources
cluster
Kind cluster management for integration testing
config
Configuration types for Seppo
context
Kubernetes SDK context
diagnostics
Failure diagnostics for test debugging
environment
Environment setup for test infrastructure
eventually
Async condition helpers for testing
fixtures
Fixture builders for Kubernetes resources
metrics
Metrics collection for Kubernetes resources
portforward
Port forwarding for Kubernetes pods
provider
Cluster providers for different Kubernetes environments
runner
Test runner for executing test commands
stack
Stack builder for multi-service deployments
telemetry
Logging configuration for Seppo
traffic
Traffic testing helpers for HTTP validation
wait
Rich wait errors with debugging context

Enums§

WatchEvent
Watch events returned from the watcher
WatcherError

Attribute Macros§

test
Attribute macro for Kubernetes integration tests.