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
|
2024-08-14 18:06:47 +00:00
|
|
|
:dry-run false
|
|
|
|
:autoapply false
|
|
|
|
:tg-output-filenname "tg-out.json"}))))
|
|
|
|
|
2024-07-27 14:32:08 +00:00
|
|
|
(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
|
2024-08-14 18:06:47 +00:00
|
|
|
:dry-run false
|
|
|
|
:autoapply false
|
|
|
|
:tg-output-filenname "tg-out.json"}))))
|
2024-07-27 14:32:08 +00:00
|
|
|
|
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
|
2024-08-14 18:06:47 +00:00
|
|
|
:dry-run false
|
|
|
|
:autoapply false
|
|
|
|
:tg-output-filenname "tg-out.json"}))))
|
2024-07-31 06:48:33 +00:00
|
|
|
|
2024-08-02 12:14:34 +00:00
|
|
|
(deftest should-calculate-terragrunt-apply-command
|
|
|
|
(is (= [[{:dir "../../../target/test/statistics"} "terragrunt" "init"]
|
2024-08-07 07:11:08 +00:00
|
|
|
[{:dir "../../../target/test/statistics"} "terragrunt" "apply" "-auto-approve"]]
|
2024-08-02 12:14:34 +00:00
|
|
|
(cut/terragrunt-apply-command {:name "test"
|
|
|
|
:module "statistics"
|
|
|
|
:project-root-path "../../.."
|
|
|
|
:build-dir-name "target"
|
|
|
|
:version "4.11.8-dev"
|
|
|
|
:stage "dev"
|
|
|
|
:debug false
|
2024-08-14 18:06:47 +00:00
|
|
|
:dry-run false
|
|
|
|
:autoapply false
|
|
|
|
:tg-output-filenname "tg-out.json"}))))
|
|
|
|
|
|
|
|
(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
|
|
|
|
:autoapply false
|
|
|
|
:tg-output-filenname "tg-out.json"}))))
|
|
|
|
|
|
|
|
(deftest should-calculate-terragrunt-output-command
|
|
|
|
(is (= [[{:dir "../../../target/test/statistics"} "bash"
|
|
|
|
"-c"
|
|
|
|
"terragrunt output -json > tg-out.json"]]
|
|
|
|
(cut/terragrunt-output-command {:name "test"
|
|
|
|
:module "statistics"
|
|
|
|
:project-root-path "../../.."
|
|
|
|
:build-dir-name "target"
|
|
|
|
:version "4.11.8-dev"
|
|
|
|
:stage "dev"
|
|
|
|
:debug false
|
|
|
|
:dry-run false
|
|
|
|
:autoapply false
|
|
|
|
:tg-output-filenname "tg-out.json"}))))
|
2024-08-02 12:14:34 +00:00
|
|
|
|