2024-07-27 14:32:08 +00:00
|
|
|
(ns dda.build.terragrunt.domain-test
|
|
|
|
(:require
|
|
|
|
[clojure.test :refer [deftest is are testing run-tests]]
|
|
|
|
[clojure.spec.test.alpha :as st]
|
|
|
|
[dda.build.terragrunt.domain :as cut]))
|
|
|
|
|
|
|
|
(st/instrument `cut/clean-build-dir-command)
|
|
|
|
(st/instrument `cut/copy-terragrunt-command)
|
2024-08-02 12:14:34 +00:00
|
|
|
(st/instrument `cut/terragrunt-plan-command)
|
|
|
|
(st/instrument `cut/terragrunt-apply-command)
|
|
|
|
(st/instrument `cut/terragrunt-destroy-command)
|
2024-07-27 14:32:08 +00:00
|
|
|
|
|
|
|
(deftest should-calculate-clean-build-dir-command
|
|
|
|
(is (= ["rm" "-rf" "../../target/test"]
|
|
|
|
(cut/clean-build-dir-command {:name "test"
|
|
|
|
:module "statistics"
|
|
|
|
:project-root-path "../.."
|
|
|
|
:build-dir-name "target"
|
|
|
|
:version "4.11.8-dev"
|
|
|
|
:stage "dev"
|
|
|
|
:debug false
|
|
|
|
:dry-run false}))))
|
|
|
|
|
|
|
|
(deftest should-calculate-copy-terragrunt-command
|
2024-07-31 06:48:33 +00:00
|
|
|
(is (= [["bash" "-c" "cp *.hcl ../../target/test"]
|
2024-07-30 16:57:44 +00:00
|
|
|
["cp" "-r" "statistics" "../../target/test"]]
|
2024-07-27 14:32:08 +00:00
|
|
|
(cut/copy-terragrunt-command {:name "test"
|
|
|
|
:module "statistics"
|
|
|
|
:project-root-path "../.."
|
|
|
|
:build-dir-name "target"
|
|
|
|
:version "4.11.8-dev"
|
|
|
|
:stage "dev"
|
|
|
|
:debug false
|
|
|
|
:dry-run false}))))
|
|
|
|
|
2024-07-31 06:48:33 +00:00
|
|
|
(deftest should-calculate-terragrunt-plan-command
|
|
|
|
(is (= [[{:dir "../../../target/test/statistics"} "terragrunt" "init"]
|
|
|
|
[{:dir "../../../target/test/statistics"} "terragrunt" "plan"]]
|
|
|
|
(cut/terragrunt-plan-command {:name "test"
|
|
|
|
:module "statistics"
|
|
|
|
:project-root-path "../../.."
|
|
|
|
:build-dir-name "target"
|
|
|
|
:version "4.11.8-dev"
|
|
|
|
:stage "dev"
|
|
|
|
:debug false
|
|
|
|
:dry-run false}))))
|
|
|
|
|
2024-08-02 12:14:34 +00:00
|
|
|
(deftest should-calculate-terragrunt-apply-command
|
|
|
|
(is (= [[{:dir "../../../target/test/statistics"} "terragrunt" "init"]
|
|
|
|
[{:dir "../../../target/test/statistics"} "terragrunt" "apply"]]
|
|
|
|
(cut/terragrunt-apply-command {:name "test"
|
|
|
|
:module "statistics"
|
|
|
|
:project-root-path "../../.."
|
|
|
|
:build-dir-name "target"
|
|
|
|
:version "4.11.8-dev"
|
|
|
|
:stage "dev"
|
|
|
|
:debug false
|
|
|
|
:dry-run false}))))
|
|
|
|
|
|
|
|
(deftest should-calculate-terragrunt-destroy-command
|
|
|
|
(is (= [[{:dir "../../../target/test/statistics"} "terragrunt" "init"]
|
|
|
|
[{:dir "../../../target/test/statistics"} "terragrunt" "destroy"]]
|
|
|
|
(cut/terragrunt-destroy-command {:name "test"
|
|
|
|
:module "statistics"
|
|
|
|
:project-root-path "../../.."
|
|
|
|
:build-dir-name "target"
|
|
|
|
:version "4.11.8-dev"
|
|
|
|
:stage "dev"
|
|
|
|
:debug false
|
|
|
|
:dry-run false}))))
|
|
|
|
|