dda-build/test/dda/build/terragrunt/domain_test.clj

71 lines
3.5 KiB
Clojure

(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)
(st/instrument `cut/terragrunt-plan-command)
(st/instrument `cut/terragrunt-apply-command)
(st/instrument `cut/terragrunt-destroy-command)
(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
(is (= [["bash" "-c" "cp *.hcl ../../target/test"]
["cp" "-r" "statistics" "../../target/test"]]
(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}))))
(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}))))
(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}))))