Skip to content

Commit 59f3abd

Browse files
committed
Rename test helper to not be confusable with a test
1 parent 90d7501 commit 59f3abd

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

test/aleph/http_test.clj

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@
13131313
(is (= "" (bs/to-string (:body resp)))))))))
13141314

13151315

1316-
(defn test-start-server-options [options]
1316+
(defn try-start-server [options]
13171317
(try
13181318
(with-server (http/start-server identity (merge http-server-options options))
13191319
:started)
@@ -1323,44 +1323,44 @@
13231323
(deftest test-http-versions-config
13241324
(testing "ssl-context as options map"
13251325
(testing "with different HTTP versions in ALPN config"
1326-
(let [result (test-start-server-options
1326+
(let [result (try-start-server
13271327
{:http-versions [:http2]
13281328
:ssl-context (assoc test-ssl/server-ssl-context-opts
13291329
:application-protocol-config
13301330
(netty/application-protocol-config [:http1]))})]
13311331
(is (instance? ExceptionInfo result))
13321332
(is (= "Some desired HTTP versions are not part of ALPN config." (ex-message result)))))
13331333
(testing "with different preference order in ALPN config"
1334-
(let [result (test-start-server-options
1334+
(let [result (try-start-server
13351335
{:http-versions [:http2 :http1]
13361336
:ssl-context (assoc test-ssl/server-ssl-context-opts
13371337
:application-protocol-config
13381338
(netty/application-protocol-config [:http1 :http2]))})]
13391339
(is (instance? ExceptionInfo result))
13401340
(is (= "Desired HTTP version preference order differs from ALPN config." (ex-message result)))))
13411341
(testing "with extra HTTP versions in the ALPN config"
1342-
(let [result (test-start-server-options
1342+
(let [result (try-start-server
13431343
{:http-versions [:http1]
13441344
:ssl-context (assoc test-ssl/server-ssl-context-opts
13451345
:application-protocol-config
13461346
(netty/application-protocol-config [:http1 :http2]))})]
13471347
(is (instance? ExceptionInfo result))
13481348
(is (= "ALPN config contains more HTTP versions than desired." (ex-message result)))))
13491349
(testing "with matching ALPN config"
1350-
(let [result (test-start-server-options
1350+
(let [result (try-start-server
13511351
{:http-versions [:http2 :http1]
13521352
:ssl-context (assoc test-ssl/server-ssl-context-opts
13531353
:application-protocol-config
13541354
(netty/application-protocol-config [:http2 :http1]))})]
13551355
(is (= :started result))))
13561356
(testing "with no ALPN config"
1357-
(let [result (test-start-server-options
1357+
(let [result (try-start-server
13581358
{:http-versions [:http2 :http1]
13591359
:ssl-context test-ssl/server-ssl-context-opts})]
13601360
(is (= :started result)))))
13611361
(testing "ssl-context as SslContext instance"
13621362
(testing "with different HTTP versions in ALPN config"
1363-
(let [result (test-start-server-options
1363+
(let [result (try-start-server
13641364
{:http-versions [:http2]
13651365
:ssl-context (netty/coerce-ssl-server-context
13661366
(assoc test-ssl/server-ssl-context-opts
@@ -1369,7 +1369,7 @@
13691369
(is (instance? ExceptionInfo result))
13701370
(is (= "Some desired HTTP versions are not part of ALPN config." (ex-message result)))))
13711371
(testing "with different preference order in ALPN config"
1372-
(let [result (test-start-server-options
1372+
(let [result (try-start-server
13731373
{:http-versions [:http2 :http1]
13741374
:ssl-context (netty/coerce-ssl-server-context
13751375
(assoc test-ssl/server-ssl-context-opts
@@ -1378,40 +1378,40 @@
13781378
(is (instance? ExceptionInfo result))
13791379
(is (= "Desired HTTP version preference order differs from ALPN config." (ex-message result)))))
13801380
(testing "with extra HTTP versions in the ALPN config"
1381-
(let [result (test-start-server-options
1381+
(let [result (try-start-server
13821382
{:http-versions [:http1]
1383-
:ssl-context (netty/coerce-ssl-server-context
1383+
:ssl-context (netty/ssl-server-context
13841384
(assoc test-ssl/server-ssl-context-opts
13851385
:application-protocol-config
13861386
(netty/application-protocol-config [:http1 :http2])))})]
13871387
(is (instance? ExceptionInfo result))
13881388
(is (= "ALPN config contains more HTTP versions than desired." (ex-message result)))))
13891389
(testing "with matching ALPN config"
1390-
(let [result (test-start-server-options
1390+
(let [result (try-start-server
13911391
{:http-versions [:http2 :http1]
13921392
:ssl-context (netty/coerce-ssl-server-context
13931393
(assoc test-ssl/server-ssl-context-opts
13941394
:application-protocol-config
13951395
(netty/application-protocol-config [:http2 :http1])))})]
13961396
(is (= :started result))))
13971397
(testing "with no ALPN config"
1398-
(let [result (test-start-server-options
1398+
(let [result (try-start-server
13991399
{:http-versions [:http2 :http1]
14001400
:ssl-context test-ssl/server-ssl-context})]
14011401
(is (instance? ExceptionInfo result))
14021402
(is (= "Some desired HTTP versions are not part of ALPN config." (ex-message result))))))
14031403
(testing "HTTP/2 without ssl-context"
1404-
(let [result (test-start-server-options
1404+
(let [result (try-start-server
14051405
{:http-versions [:http2]})]
14061406
;; TODO: Shouldn't this fail?
14071407
(is (= :started result))))
14081408
(testing "HTTP/2 without ssl-context but with h2c"
1409-
(let [result (test-start-server-options
1409+
(let [result (try-start-server
14101410
{:use-h2c? true
14111411
:http-versions [:http2]})]
14121412
(is (= :started result))))
14131413
(testing "HTTP/2 with ssl-context *and* with h2c (which has no effect then)"
1414-
(let [result (test-start-server-options
1414+
(let [result (try-start-server
14151415
{:use-h2c? true
14161416
:http-versions [:http2]
14171417
:ssl-context test-ssl/server-ssl-context-opts})]

0 commit comments

Comments
 (0)