diff --git a/crates/cuddle-clusters/src/process.rs b/crates/cuddle-clusters/src/process.rs index 76ed261..4b113b7 100644 --- a/crates/cuddle-clusters/src/process.rs +++ b/crates/cuddle-clusters/src/process.rs @@ -98,7 +98,7 @@ async fn load_template_files(path: &Path) -> anyhow::Result { templates: read_dir(path) .await? .into_iter() - .filter(|i| !i.ends_with(".jinja2")) + .filter(|i| i.extension().and_then(|e| e.to_str()) == Some("jinja2")) .collect(), raw: read_dir(&path.join("raw")).await.unwrap_or_default(), }) @@ -149,7 +149,7 @@ async fn process_cluster( } async fn process_template_file( - cluster_name: &str, + _cluster_name: &str, template_file: &PathBuf, dest: &Path, ) -> anyhow::Result<()> { diff --git a/crates/cuddle-clusters/tests/both/cuddle.yaml b/crates/cuddle-clusters/tests/both/cuddle.yaml new file mode 100644 index 0000000..b81909a --- /dev/null +++ b/crates/cuddle-clusters/tests/both/cuddle.yaml @@ -0,0 +1,2 @@ +cuddle/clusters: + dev: diff --git a/crates/cuddle-clusters/tests/both/expected/dev/some-file.yaml b/crates/cuddle-clusters/tests/both/expected/dev/some-file.yaml new file mode 100644 index 0000000..e69de29 diff --git a/crates/cuddle-clusters/tests/both/expected/dev/some-other.yaml b/crates/cuddle-clusters/tests/both/expected/dev/some-other.yaml new file mode 100644 index 0000000..e69de29 diff --git a/crates/cuddle-clusters/tests/both/expected/dev/some.yaml b/crates/cuddle-clusters/tests/both/expected/dev/some.yaml new file mode 100644 index 0000000..e69de29 diff --git a/crates/cuddle-clusters/tests/both/templates/clusters/raw/some-file.yaml b/crates/cuddle-clusters/tests/both/templates/clusters/raw/some-file.yaml new file mode 100644 index 0000000..e69de29 diff --git a/crates/cuddle-clusters/tests/both/templates/clusters/some-other.yaml.jinja2 b/crates/cuddle-clusters/tests/both/templates/clusters/some-other.yaml.jinja2 new file mode 100644 index 0000000..e69de29 diff --git a/crates/cuddle-clusters/tests/both/templates/clusters/some.yaml.jinja2 b/crates/cuddle-clusters/tests/both/templates/clusters/some.yaml.jinja2 new file mode 100644 index 0000000..e69de29 diff --git a/crates/cuddle-clusters/tests/template_files/cuddle.yaml b/crates/cuddle-clusters/tests/template_files/cuddle.yaml new file mode 100644 index 0000000..b81909a --- /dev/null +++ b/crates/cuddle-clusters/tests/template_files/cuddle.yaml @@ -0,0 +1,2 @@ +cuddle/clusters: + dev: diff --git a/crates/cuddle-clusters/tests/template_files/expected/dev/some-other.yaml b/crates/cuddle-clusters/tests/template_files/expected/dev/some-other.yaml new file mode 100644 index 0000000..e69de29 diff --git a/crates/cuddle-clusters/tests/template_files/expected/dev/some.yaml b/crates/cuddle-clusters/tests/template_files/expected/dev/some.yaml new file mode 100644 index 0000000..e69de29 diff --git a/crates/cuddle-clusters/tests/template_files/templates/clusters/ignored.yaml b/crates/cuddle-clusters/tests/template_files/templates/clusters/ignored.yaml new file mode 100644 index 0000000..e69de29 diff --git a/crates/cuddle-clusters/tests/template_files/templates/clusters/some-other.yaml.jinja2 b/crates/cuddle-clusters/tests/template_files/templates/clusters/some-other.yaml.jinja2 new file mode 100644 index 0000000..e69de29 diff --git a/crates/cuddle-clusters/tests/template_files/templates/clusters/some.yaml.jinja2 b/crates/cuddle-clusters/tests/template_files/templates/clusters/some.yaml.jinja2 new file mode 100644 index 0000000..e69de29 diff --git a/crates/cuddle-clusters/tests/tests.rs b/crates/cuddle-clusters/tests/tests.rs index b4664e8..16fb18f 100644 --- a/crates/cuddle-clusters/tests/tests.rs +++ b/crates/cuddle-clusters/tests/tests.rs @@ -10,3 +10,16 @@ async fn raw_files() -> anyhow::Result<()> { 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(()) +}