THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

🔧 Change CI configuration.

pull/807/head
Andrey Antukh 1 month ago
committed by Alonso Torres
parent
commit
351daacca0
  1. 10
      .circleci/config.yml
  2. 2
      backend/src/app/config.clj
  3. 19
      backend/tests/app/tests/helpers.clj
  4. 4
      backend/tests/app/tests/test_bounces_handling.clj
  5. 12
      backend/tests/app/tests/test_services_profile.clj

10
.circleci/config.yml

@ -13,7 +13,7 @@ jobs:
environment:
POSTGRES_USER: penpot_test
POSTGRES_PASSWORD: penpot_test
POSTGRES_DB: penpot
POSTGRES_DB: penpot_test
- image: circleci/redis:6.0.8
@ -45,10 +45,10 @@ jobs:
name: backend test
command: "clojure -M:dev:tests"
environment:
PENPOT_DATABASE_URI: "postgresql://localhost/penpot"
PENPOT_DATABASE_USERNAME: penpot_test
PENPOT_DATABASE_PASSWORD: penpot_test
PENPOT_REDIS_URI: "redis://localhost/1"
PENPOT_TEST_DATABASE_URI: "postgresql://localhost/penpot_test"
PENPOT_TEST_DATABASE_USERNAME: penpot_test
PENPOT_TEST_DATABASE_PASSWORD: penpot_test
PENPOT_TEST_REDIS_URI: "redis://localhost/1"
- run:
working_directory: "./frontend"

2
backend/src/app/config.clj

@ -32,7 +32,7 @@
{:http-server-port 6060
:host "devenv"
:tenant "dev"
:database-uri "postgresql://127.0.0.1/penpot"
:database-uri "postgresql://postgres/penpot"
:database-username "penpot"
:database-password "penpot"

19
backend/tests/app/tests/helpers.clj

@ -38,11 +38,22 @@
(def ^:dynamic *system* nil)
(def ^:dynamic *pool* nil)
(def defaults
{:database-uri "postgresql://postgres/penpot_test"
:redis-uri "redis://redis/1"})
(def config
(->> (cf/read-env "penpot-test")
(merge cf/defaults defaults)
(us/conform ::cf/config)))
(defn state-init
[next]
(let [config (-> main/system-config
(assoc-in [:app.msgbus/msgbus :redis-uri] "redis://redis/1")
(assoc-in [:app.db/pool :uri] "postgresql://postgres/penpot_test")
(assoc-in [:app.msgbus/msgbus :redis-uri] (:redis-uri config))
(assoc-in [:app.db/pool :uri] (:database-uri config))
(assoc-in [:app.db/pool :username] (:database-username config))
(assoc-in [:app.db/pool :password] (:database-password config))
(assoc-in [[:app.main/main :app.storage.fs/backend] :directory] "/tmp/app/storage")
(dissoc :app.srepl/server
:app.http/server
@ -325,9 +336,9 @@
[data]
(fn
([key]
(get data key (cf/get key)))
(get data key (get @cf/config key)))
([key default]
(get data key (cf/get key default)))))
(get data key (get @cf/config key default)))))
(defn reset-mock!
[m]

4
backend/tests/app/tests/test_bounces_handling.clj

@ -21,10 +21,6 @@
(t/use-fixtures :once th/state-init)
(t/use-fixtures :each th/database-reset)
;; (with-mocks [mock {:target 'app.tasks/submit! :return nil}]
;; Right now we have many different scenarios what can cause a
;; bounce/complain report.
(defn- decode-row
[{:keys [content] :as row}]
(cond-> row

12
backend/tests/app/tests/test_services_profile.clj

@ -132,7 +132,7 @@
(t/is (nil? result)))
;; Request profile to be deleted
(with-mocks [mock {:target 'app.tasks/submit! :return nil}]
(with-mocks [mock {:target 'app.worker/submit! :return nil}]
(let [params {::th/type :delete-profile
:profile-id (:id prof)}
out (th/mutation! params)]
@ -140,11 +140,11 @@
;; check the mock
(let [mock (deref mock)
mock-params (second (:call-args mock))]
mock-params (first (:call-args mock))]
(t/is (:called? mock))
(t/is (= 1 (:call-count mock)))
(t/is (= "delete-profile" (:name mock-params)))
(t/is (= (:id prof) (get-in mock-params [:props :profile-id]))))))
(t/is (= :delete-profile (:app.worker/task mock-params)))
(t/is (= (:id prof) (:profile-id mock-params))))))
;; query files after profile soft deletion
(let [params {::th/type :files
@ -257,8 +257,8 @@
:terms-privacy true}
out (th/mutation! data)]
;; (th/print-result! out)
(let [mock (deref mock)
[_ _ params] (:call-args mock)]
(let [mock (deref mock)
[params] (:call-args mock)]
;; (clojure.pprint/pprint params)
(t/is (:called? mock))
(t/is (= (:email data) (:to params)))

Loading…
Cancel
Save