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

130 lines
6.1 KiB
Clojure
Raw Normal View History

2024-10-04 14:17:19 +00:00
(ns dda.build.c4k.domain-test
(:require
[clojure.test :refer [deftest is]]
[clojure.spec.test.alpha :as st]
[dda.build.c4k.domain :as cut]))
2024-10-04 14:21:02 +00:00
(st/instrument `cut/config-path)
(st/instrument `cut/auth-path)
(st/instrument `cut/output-path)
(st/instrument `cut/clean-build-dir-command)
(st/instrument `cut/c4k-uberjar-command)
(st/instrument `cut/c4k-graalvm-command)
(st/instrument `cut/create-c4k-config)
2024-10-04 14:17:19 +00:00
(deftest should-calculate-config-path
(is (= "../../target/dda-backup/config.yaml"
(cut/config-path {:name "dda-backup"
:project-root-path "../.."
:build-dir-name "target"
:version "4.11.8-dev"
:stage "dev"
:debug false
:dry-run false
2024-10-04 14:21:02 +00:00
:c4k-config-filename "config.yaml"
:c4k-auth-filename "auth.yaml"
:c4k-output-filename "out.yaml"})))
2024-10-04 14:17:19 +00:00
(is (= "../../target/dda/backup/config.yaml"
(cut/config-path {:name "dda"
:module "backup"
:project-root-path "../.."
:build-dir-name "target"
:version "4.11.8-dev"
:stage "dev"
:debug false
:dry-run false
2024-10-04 14:21:02 +00:00
:c4k-config-filename "config.yaml"
:c4k-auth-filename "auth.yaml"
:c4k-output-filename "out.yaml"}))))
2024-10-04 14:17:19 +00:00
(deftest should-calculate-auth-path
(is (= "../../target/dda-backup/auth.yaml"
(cut/auth-path {:name "dda-backup"
:project-root-path "../.."
:build-dir-name "target"
:version "4.11.8-dev"
:stage "dev"
:debug false
:dry-run false
2024-10-04 14:21:02 +00:00
:c4k-config-filename "config.yaml"
:c4k-auth-filename "auth.yaml"
:c4k-output-filename "out.yaml"})))
2024-10-04 14:17:19 +00:00
(is (= "../../target/dda/backup/auth.yaml"
(cut/auth-path {:name "dda"
:module "backup"
:project-root-path "../.."
:build-dir-name "target"
:version "4.11.8-dev"
:stage "dev"
:debug false
:dry-run false
2024-10-04 14:21:02 +00:00
:c4k-config-filename "config.yaml"
:c4k-auth-filename "auth.yaml"
:c4k-output-filename "out.yaml"}))))
2024-10-04 14:17:19 +00:00
(deftest should-calculate-output-path
(is (= "../../target/dda-backup/out.yaml"
(cut/output-path {:name "dda-backup"
:project-root-path "../.."
:build-dir-name "target"
:version "4.11.8-dev"
:stage "dev"
:debug false
:dry-run false
2024-10-04 14:21:02 +00:00
:c4k-config-filename "config.yaml"
:c4k-auth-filename "auth.yaml"
2024-10-04 14:17:19 +00:00
:c4k-output-filename "out.yaml"})))
(is (= "../../target/dda/backup/out.yaml"
(cut/output-path {:name "dda"
:module "backup"
:project-root-path "../.."
:build-dir-name "target"
:version "4.11.8-dev"
:stage "dev"
:debug false
:dry-run false
2024-10-04 14:21:02 +00:00
:c4k-config-filename "config.yaml"
:c4k-auth-filename "auth.yaml"
2024-10-04 14:17:19 +00:00
:c4k-output-filename "out.yaml"}))))
(deftest should-calculate-clean-build-dir-command
(is (= ["rm" "-rf" "../../target/dda-backup"]
(cut/clean-build-dir-command {:name "dda-backup"
:project-root-path "../.."
:build-dir-name "target"
:version "4.11.8-dev"
:stage "dev"
:debug false
:dry-run false
:c4k-config-filename "config.yaml"
:c4k-auth-filename "auth.yaml"
:c4k-output-filename "out.yaml"}))))
(deftest should-calculate-c4k-uberjar-command
(is (= ["bash" "-c" "c4k-dda-backup-standalone.jar ../../target/dda-backup/config.yaml ../../target/dda-backup/auth.yaml > ../../target/dda-backup/out.yaml"]
(cut/c4k-uberjar-command {:name "dda-backup"
:project-root-path "../.."
:build-dir-name "target"
:version "4.11.8-dev"
:stage "dev"
:debug false
:dry-run false
:c4k-config-filename "config.yaml"
:c4k-auth-filename "auth.yaml"
:c4k-output-filename "out.yaml"}))))
(deftest should-calculate-c4k-graalvm-command
(is (= ["bash" "-c" "c4k-dda-backup ../../target/dda-backup/config.yaml ../../target/dda-backup/auth.yaml > ../../target/dda-backup/out.yaml"]
(cut/c4k-graalvm-command {:name "dda-backup"
:project-root-path "../.."
:build-dir-name "target"
:version "4.11.8-dev"
:stage "dev"
:debug false
:dry-run false
:c4k-config-filename "config.yaml"
:c4k-auth-filename "auth.yaml"
:c4k-output-filename "out.yaml"}))))