Files
cuddle-clusters/crates/cuddle-clusters/tests/tests.rs
kjuulh 3956366d28
All checks were successful
continuous-integration/drone/push Build is passing
feat/add-postgres-database (#20)
feat: add postgres database

Signed-off-by: kjuulh <contact@kjuulh.io>

feat: add postgres and more templates

Signed-off-by: kjuulh <contact@kjuulh.io>

Reviewed-on: https://git.front.kjuulh.io/kjuulh/cuddle-clusters/pulls/20
Co-authored-by: kjuulh <contact@kjuulh.io>
Co-committed-by: kjuulh <contact@kjuulh.io>
2024-11-29 09:05:50 +01:00

146 lines
3.3 KiB
Rust

pub mod common;
mod can_run_for_env;
mod cuddle_vars;
use cuddle_clusters::{
catalog::{
cluster_vars::ClusterVars, crdb_database::CockroachDB, cuddle_vars::CuddleVars,
ingress::Ingress, postgres_database::PostgresDatabase, vault_secret::VaultSecret,
},
IntoComponent,
};
use crate::common::{run_test, run_test_with_components};
#[tokio::test]
async fn raw_files() -> anyhow::Result<()> {
run_test("raw_files").await?;
Ok(())
}
#[tokio::test]
async fn template_files() -> anyhow::Result<()> {
run_test("template_files").await?;
Ok(())
}
#[tokio::test]
async fn both() -> anyhow::Result<()> {
run_test("both").await?;
Ok(())
}
#[tokio::test]
async fn nested() -> anyhow::Result<()> {
run_test("nested").await?;
Ok(())
}
#[tokio::test]
async fn jinja() -> anyhow::Result<()> {
run_test("jinja").await?;
Ok(())
}
#[tokio::test]
async fn environment() -> anyhow::Result<()> {
run_test("environment").await?;
Ok(())
}
#[tokio::test]
async fn with_cuddle_vars() -> anyhow::Result<()> {
let current_dir = std::env::current_dir()?.join("tests/with_cuddle_vars");
run_test_with_components(
"with_cuddle_vars",
vec![CuddleVars::new(&current_dir).await?],
)
.await?;
Ok(())
}
#[tokio::test]
async fn with_cluster_vars() -> anyhow::Result<()> {
run_test_with_components("with_cluster_vars", vec![ClusterVars::default()]).await?;
Ok(())
}
#[tokio::test]
async fn with_vault_secrets() -> anyhow::Result<()> {
let current_dir = std::env::current_dir()?.join("tests/with_vault_secrets");
run_test_with_components(
"with_vault_secrets",
vec![
CuddleVars::new(&current_dir).await?.into_component(),
ClusterVars::default().into_component(),
VaultSecret::default().into_component(),
],
)
.await?;
Ok(())
}
#[tokio::test]
async fn with_crdb() -> anyhow::Result<()> {
let current_dir = std::env::current_dir()?.join("tests/with_crdb");
run_test_with_components(
"with_crdb",
vec![
CuddleVars::new(&current_dir).await?.into_component(),
ClusterVars::default().into_component(),
VaultSecret::default().into_component(),
CockroachDB::new(&current_dir).await?.into_component(),
],
)
.await?;
Ok(())
}
#[tokio::test]
async fn with_ingress() -> anyhow::Result<()> {
let current_dir = std::env::current_dir()?.join("tests/with_ingress");
run_test_with_components(
"with_ingress",
vec![
CuddleVars::new(&current_dir).await?.into_component(),
ClusterVars::default().into_component(),
Ingress::new(&current_dir).await?.into_component(),
],
)
.await?;
Ok(())
}
#[tokio::test]
async fn with_postgres_databse() -> anyhow::Result<()> {
let current_dir = std::env::current_dir()?.join("tests/with_postgres_database");
run_test_with_components(
"with_postgres_database",
vec![
CuddleVars::new(&current_dir).await?.into_component(),
ClusterVars::default().into_component(),
VaultSecret::default().into_component(),
PostgresDatabase::new(&current_dir).await?.into_component(),
],
)
.await?;
Ok(())
}