feat: 서버는 기초의 테스트 더함
All checks were successful
build / build (push) Successful in 1m35s

This commit is contained in:
2026-03-24 14:58:31 -06:00
parent 79735cc0ba
commit e73148ef3d
7 changed files with 57 additions and 35 deletions

View File

@@ -371,14 +371,14 @@
"hash": "sha256-OaawIvv0GgkuZwK6MAFtmuyw3zNcYiZVd66K/IipB2A=" "hash": "sha256-OaawIvv0GgkuZwK6MAFtmuyw3zNcYiZVd66K/IipB2A="
}, },
{ {
"mvn-path": "fipp/fipp/0.6.27/fipp-0.6.27.jar", "mvn-path": "fipp/fipp/0.6.26/fipp-0.6.26.jar",
"mvn-repo": "https://repo.clojars.org/", "mvn-repo": "https://repo.clojars.org/",
"hash": "sha256-qK1dAlan2r+90UOm6QvnZXURhA/is4MMp9tnK20RDPc=" "hash": "sha256-98tpbM5Vr9dMg41UQUGcfl9tSRrxhajlY9+nl5aFcoM="
}, },
{ {
"mvn-path": "fipp/fipp/0.6.27/fipp-0.6.27.pom", "mvn-path": "fipp/fipp/0.6.26/fipp-0.6.26.pom",
"mvn-repo": "https://repo.clojars.org/", "mvn-repo": "https://repo.clojars.org/",
"hash": "sha256-ugagpDW5XBNQMTr+1z3s6r5TXwbF/pw6Ffrcc4Tzlvk=" "hash": "sha256-p+xjV7gTIRMv0HwvV+/rAhFEFVlDY9g6FDE6GU9fVTU="
}, },
{ {
"mvn-path": "fipp/fipp/0.6.29/fipp-0.6.29.jar", "mvn-path": "fipp/fipp/0.6.29/fipp-0.6.29.jar",
@@ -486,14 +486,14 @@
"hash": "sha256-1PXzUUHstr5hI/+oPIQUGogO744bynAw2Zoo5HSjTbE=" "hash": "sha256-1PXzUUHstr5hI/+oPIQUGogO744bynAw2Zoo5HSjTbE="
}, },
{ {
"mvn-path": "lambdaisland/deep-diff2/2.12.219/deep-diff2-2.12.219.jar", "mvn-path": "lambdaisland/deep-diff2/2.11.216/deep-diff2-2.11.216.jar",
"mvn-repo": "https://repo.clojars.org/", "mvn-repo": "https://repo.clojars.org/",
"hash": "sha256-BkOq5C/7omo09wyTTg7nkBi6GWBmlayVsPa9mrDvCyU=" "hash": "sha256-U2zJZmPIO66EtkgwwfyY41uRyu2DRmXH0ogNfluw5Rg="
}, },
{ {
"mvn-path": "lambdaisland/deep-diff2/2.12.219/deep-diff2-2.12.219.pom", "mvn-path": "lambdaisland/deep-diff2/2.11.216/deep-diff2-2.11.216.pom",
"mvn-repo": "https://repo.clojars.org/", "mvn-repo": "https://repo.clojars.org/",
"hash": "sha256-rW/85js2hSWVc36e2BcTRmkahJHc2TjGIEfvForuToY=" "hash": "sha256-ok3nYS+8XCcCTPJIkqaO1SQH6v2ENwK2GZJdH0c4D20="
}, },
{ {
"mvn-path": "lambdaisland/kaocha/1.91.1392/kaocha-1.91.1392.jar", "mvn-path": "lambdaisland/kaocha/1.91.1392/kaocha-1.91.1392.jar",
@@ -971,14 +971,14 @@
"hash": "sha256-NnHYN2UlIwq6Ah8fYmx54g86ELYrXfgXIiWJDsSv4EU=" "hash": "sha256-NnHYN2UlIwq6Ah8fYmx54g86ELYrXfgXIiWJDsSv4EU="
}, },
{ {
"mvn-path": "org/clojure/core.rrb-vector/0.2.0/core.rrb-vector-0.2.0.jar", "mvn-path": "org/clojure/core.rrb-vector/0.1.2/core.rrb-vector-0.1.2.jar",
"mvn-repo": "https://repo1.maven.org/maven2/", "mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-ftqNXGlaxVNp3NTHN4YUMhdXuBAoG//KMMss02PRZZQ=" "hash": "sha256-UfmOunss1C7jDzgmkl3N6HkRZ/dvcSMprlG4gkToE44="
}, },
{ {
"mvn-path": "org/clojure/core.rrb-vector/0.2.0/core.rrb-vector-0.2.0.pom", "mvn-path": "org/clojure/core.rrb-vector/0.1.2/core.rrb-vector-0.1.2.pom",
"mvn-repo": "https://repo1.maven.org/maven2/", "mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-t+0/8ZfxrdZOHvJS2zRY8wlhPcZXdejY4OkTlx4CRY4=" "hash": "sha256-juK6yvw4QzWMznZRDXMyQhK7NRn61XgE7Oq9w3rFCR8="
}, },
{ {
"mvn-path": "org/clojure/core.rrb-vector/0.2.1/core.rrb-vector-0.2.1.jar", "mvn-path": "org/clojure/core.rrb-vector/0.2.1/core.rrb-vector-0.2.1.jar",
@@ -1060,11 +1060,6 @@
"mvn-repo": "https://repo1.maven.org/maven2/", "mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-CRbXpBVYuVAKQnyIb6KYJ6zlJZIGvjrTPmTilvwaYRE=" "hash": "sha256-CRbXpBVYuVAKQnyIb6KYJ6zlJZIGvjrTPmTilvwaYRE="
}, },
{
"mvn-path": "org/clojure/pom.contrib/1.3.0/pom.contrib-1.3.0.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-g5qUXfrO6lvVB5+CSPM0bdIULesJFGyj9dG/riYxCWc="
},
{ {
"mvn-path": "org/clojure/pom.contrib/1.4.0/pom.contrib-1.4.0.pom", "mvn-path": "org/clojure/pom.contrib/1.4.0/pom.contrib-1.4.0.pom",
"mvn-repo": "https://repo1.maven.org/maven2/", "mvn-repo": "https://repo1.maven.org/maven2/",
@@ -1100,16 +1095,6 @@
"mvn-repo": "https://repo1.maven.org/maven2/", "mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-PLp+DcwIXEzpLd3/6iJhJP+sF4vnm9A3m1suMKlpy+o=" "hash": "sha256-PLp+DcwIXEzpLd3/6iJhJP+sF4vnm9A3m1suMKlpy+o="
}, },
{
"mvn-path": "org/clojure/test.check/1.1.2/test.check-1.1.2.jar",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-93r5qZJ67LZqNoa282s1Al8kvOZr8/AF3UTcQEvIdgE="
},
{
"mvn-path": "org/clojure/test.check/1.1.2/test.check-1.1.2.pom",
"mvn-repo": "https://repo1.maven.org/maven2/",
"hash": "sha256-UZ45jnJMYvCsnWsZ15+P8QAdqYWD/eAb1wUrB+Ga1ow="
},
{ {
"mvn-path": "org/clojure/test.check/1.1.3/test.check-1.1.3.jar", "mvn-path": "org/clojure/test.check/1.1.3/test.check-1.1.3.jar",
"mvn-repo": "https://repo1.maven.org/maven2/", "mvn-repo": "https://repo1.maven.org/maven2/",

View File

@@ -7,12 +7,12 @@
{:git/sha "531d629b7f05f37232261cf9e8927a4b5915714f"} {:git/sha "531d629b7f05f37232261cf9e8927a4b5915714f"}
hiccup/hiccup {:mvn/version "2.0.0-RC4"} hiccup/hiccup {:mvn/version "2.0.0-RC4"}
com.rpl/specter {:mvn/version "1.1.6"} com.rpl/specter {:mvn/version "1.1.6"}
lambdaisland/deep-diff2 {:mvn/version "2.12.219"}
mvxcvi/clj-cbor {:mvn/version "1.1.1"} mvxcvi/clj-cbor {:mvn/version "1.1.1"}
ch.qos.logback/logback-classic {:mvn/version "1.1.3"} ch.qos.logback/logback-classic {:mvn/version "1.1.3"}
org.clojure/test.check {:mvn/version "1.1.3"} org.clojure/test.check {:mvn/version "1.1.3"}
aero/aero {:mvn/version "1.1.6"}} aero/aero {:mvn/version "1.1.6"}}
:paths ["src" "resources" "test"] :paths ["src" "resources"]
:aliases :aliases
{:test {:extra-deps {lambdaisland/kaocha {:mvn/version "1.91.1392"}} {:test {:extra-deps {lambdaisland/kaocha {:mvn/version "1.91.1392"}}
:extra-paths ["test"]
:main-opts ["-m" "kaocha.runner"]}}} :main-opts ["-m" "kaocha.runner"]}}}

View File

@@ -20,4 +20,8 @@ mkCljBin {
bb -cp . -m override-deps < deps.edn.old > deps.edn \ bb -cp . -m override-deps < deps.edn.old > deps.edn \
net.deertopia/doerg '{:local/root "${doerg.lib}/${doerg.name}.jar"}' net.deertopia/doerg '{:local/root "${doerg.lib}/${doerg.name}.jar"}'
''; '';
doCheck = true;
checkPhase = ''
clojure -M:test
'';
} }

View File

@@ -7,10 +7,14 @@
com.github.seancorfield/next.jdbc {:mvn/version "1.3.1070"} com.github.seancorfield/next.jdbc {:mvn/version "1.3.1070"}
org.xerial/sqlite-jdbc {:mvn/version "3.47.1.0"} org.xerial/sqlite-jdbc {:mvn/version "3.47.1.0"}
cheshire/cheshire {:mvn/version "6.1.0"} cheshire/cheshire {:mvn/version "6.1.0"}
org.clojure/test.check {:mvn/version "1.1.2"} org.clojure/test.check {:mvn/version "1.1.3"}
net.deertopia/doerg {:local/root "../doerg"} net.deertopia/doerg {:local/root "../doerg"}
metosin/reitit {:mvn/version "0.10.1"} metosin/reitit {:mvn/version "0.10.1"}
http-kit/http-kit {:mvn/version "2.8.0"} http-kit/http-kit {:mvn/version "2.8.0"}
instaparse/instaparse {:mvn/version "1.5.0"} instaparse/instaparse {:mvn/version "1.5.0"}
aero/aero {:mvn/version "1.1.6"}} aero/aero {:mvn/version "1.1.6"}}
:paths ["src" "resources" "test"]} :paths ["src" "resources"]
:aliases
{:test {:extra-deps {lambdaisland/kaocha {:mvn/version "1.91.1392"}}
:extra-paths ["test"]
:main-opts ["-m" "kaocha.runner"]}}}

View File

@@ -98,8 +98,7 @@
(defn start! [] (defn start! []
(if @server (if @server
(let [msg "Server already started"] (throw (IllegalStateException. "Server already started"))
(throw (ex-info msg {})))
(do (reset! server (do (reset! server
(http/run-server (bound-fn* #'app) (http/run-server (bound-fn* #'app)
{:port (-> cfg/*cfg* ::publisher/port) {:port (-> cfg/*cfg* ::publisher/port)
@@ -107,8 +106,13 @@
;; For some reason, the log messages are not flushed before ;; For some reason, the log messages are not flushed before
;; the JVM shuts dowm. Nevertheless, the server /does/ come ;; the JVM shuts dowm. Nevertheless, the server /does/ come
;; to a graceful halt. ;; to a graceful halt.
(.addShutdownHook (Runtime/getRuntime) shutdown-hook) (try (.addShutdownHook (Runtime/getRuntime) shutdown-hook)
(l/info "Server started on port 8080")))) (catch IllegalArgumentException e
(when (not= "Hook previously registered"
(ex-message e))
(throw e))))
(l/infof "Server started on port %d"
(-> cfg/*cfg* ::publisher/port)))))
(defn status [] (defn status []
(if @server (if @server

View File

@@ -0,0 +1,24 @@
(ns net.deertopia.publisher.server-test
(:require [net.deertopia.publisher.server :as sut]
[reitit.ring]
[clojure.test :as t]
[clojure.set :as set]
[net.deertopia.publisher.server :as server]
[net.deertopia.publisher.config :as cfg]
[net.deertopia.publisher :as-alias publisher]))
(t/deftest server-is-running
;; 서버는 시작 전에 이 테스트 하면 잘못됩니다.
(assert (not= :running (server/status)))
(server/start!)
(t/is (= :running (server/status)))
(server/stop!))
(t/deftest can-get-real-server-root
;; 서버는 시작 전에 이 테스트 하면 잘못됩니다.
(assert (not= :running (server/status)))
(server/start!)
(t/is (->> (format "http://localhost:%d" (::publisher/port cfg/*cfg*))
slurp
string?))
(server/stop!))

1
publisher/tests.edn Normal file
View File

@@ -0,0 +1 @@
#kaocha/v1 {}