k8s_test_framework/interface.rs
1//! An interface into the system.
2
3use std::env;
4
5/// An interface between the test framework and external CLI commands and test
6/// utilities.
7#[derive(Debug)]
8pub struct Interface {
9 /// A command used to deploy a Helm chart into the kubernetes cluster and
10 /// delete if from there.
11 pub deploy_chart_command: String,
12
13 /// A `kubectl` command used for generic cluster interaction.
14 pub kubectl_command: String,
15}
16
17impl Interface {
18 /// Create a new [`Interface`] instance with the parameters obtained from
19 /// the process environment.
20 pub fn from_env() -> Option<Self> {
21 Some(Self {
22 deploy_chart_command: env::var("KUBE_TEST_DEPLOY_COMMAND").ok()?,
23 kubectl_command: env::var("VECTOR_TEST_KUBECTL")
24 .unwrap_or_else(|_| "kubectl".to_owned()),
25 })
26 }
27}