diff of af0b248b0ba527a73fbc574ee080d0b16e792066
af0b248b0ba527a73fbc574ee080d0b16e792066
diff --git a/.github/workflows/build_murja.yml b/.github/workflows/build_murja.yml
index 595f86f..7b7bc2a 100644
--- a/.github/workflows/build_murja.yml
+++ b/.github/workflows/build_murja.yml
@@ -24,25 +24,23 @@ jobs:
- name: Start db
run: |
- docker-compose up -d automatic-test-db
+ docker-compose up -d automatic-test-db
+ docker network ls
+
- name: Setup and run tests
uses: addnab/docker-run-action@v3
with:
image: fukamachi/sbcl:latest
- options: -v ${{ github.workspace }}:/workspace -v ${{ github.workspace }}/config:/etc/murja -e MURJA_DB_HOST=db -e MURJA_E2E=e2e -p 3010:3010 --network aggressive-murja_murja_test_network
+ options: -v ${{ github.workspace }}:/workspace -v ${{ github.workspace }}/config:/etc/murja -e MURJA_DB_HOST=automatic-test-db -e MURJA_DB_PORT=5432 -e MURJA_E2E=e2e -e GHA=true -p 3010:3010 --network aggressive-murja_murja_test_network
run: |
cd /workspace
-
+ mkdir -p ~/common-lisp
+
sbcl --load ./quicklisp.lisp --load ./install_ql.lisp
-
- current_dir=$(pwd)
- cd $HOME
-
- mkdir ~/common-lisp
- cd ~/common-lisp
- ln -s $current_dir
- cd /workspace
- sbcl --load run_tests.lisp
+ ln -s /workspace ~/common-lisp/aggressive-murja
+ ln -s /workspace ~/common-lisp/aggressive-murja-tests
+ sbcl --load run_tests.lisp
+
build:
name: "Build murja image"
needs: test-lisp
diff --git a/build_murja.sh b/build_murja.sh
index d64e44c..02ed329 100755
--- a/build_murja.sh
+++ b/build_murja.sh
@@ -14,15 +14,7 @@ pushd ~/common-lisp
ln -s $current_dir
popd
-
-if [ ! -d ~/common-lisp ]; then
- current_dir=$(pwd)
-
- mkdir ~/common-lisp
- pushd ~/common-lisp
- ln -s $current_dir
- popd
-fi
+ls -la ~/common-lisp
sbcl --load ./build_murja.lisp
diff --git a/run_tests.lisp b/run_tests.lisp
index bf86adb..75db10a 100644
--- a/run_tests.lisp
+++ b/run_tests.lisp
@@ -1,3 +1,2 @@
+(ql:quickload :aggressive-murja)
(ql:quickload :aggressive-murja-tests)
-(unless (fiveam:run! 'murja.tests:main-suite)
- (sb-ext:exit :code 666))
diff --git a/src/local-lib/migrations.lisp b/src/local-lib/migrations.lisp
index 4778951..65298c4 100644
--- a/src/local-lib/migrations.lisp
+++ b/src/local-lib/migrations.lisp
@@ -41,12 +41,12 @@
(log:info "Migration result: ~a"
(cond ((and initial (not (migration-table-exists)))
(postmodern:execute-file filename)
- (mark-migration-done file-path))
+ (mark-migration-done path))
((and (migration-table-exists) (not (migration-does-exist path)))
- (log:info "Really running ~a" file-path)
+ (log:info "Really running ~a" path)
(postmodern:execute-file filename)
- (mark-migration-done file-path))
+ (mark-migration-done path))
(t (log:info "Didn't run ~a" path))))))
diff --git a/src/middleware/db.lisp b/src/middleware/db.lisp
index c037dac..b304628 100644
--- a/src/middleware/db.lisp
+++ b/src/middleware/db.lisp
@@ -17,11 +17,14 @@
"blog")
:host (or (sb-ext:posix-getenv "MURJA_DB_HOST")
"localhost")
- :port (let ((port-str (if *automatic-tests-on?*
- "2345"
- (sb-ext:posix-getenv "MURJA_DB_PORT"))))
+ :port (let ((port-str
+ ;; return env-var if it exists (GHA, connecting straight to the automatic test db container)
+ (or (sb-ext:posix-getenv "MURJA_DB_PORT")
+ ;; return "2345", where autotest-db is on localhost (proxied to automatic-test-db:5432)
+ (and *automatic-tests-on?* "2345"))))
(if port-str
(parse-integer port-str)
+ ;; or else return the basic postgresql 5432 port
5432))))
(defun connect-murjadb-toplevel ()
diff --git a/test/tests.lisp b/test/tests.lisp
index 42d695d..9eab5b1 100644
--- a/test/tests.lisp
+++ b/test/tests.lisp
@@ -6,6 +6,7 @@
(in-package :murja.tests)
(def-suite main-suite)
+(in-suite main-suite)
(defvar *test-server* nil)
(defvar *test-port* 3001)
@@ -32,7 +33,7 @@
(hunchentoot:stop *test-server*)
(setf *test-server* nil)))))
-(def-test multiple-migrations (:suite main-suite :fixture prepare-db-and-server)
+(def-test multiple-migrations (:fixture prepare-db-and-server)
(let ((successfully-migrated nil))
(unwind-protect
(progn
@@ -44,13 +45,17 @@
(murja.migrations:migrate)
(error (c)
(log:error "Migrations failed ~a" c)
- (error 'fail)))
+ (error "fail")))
(log:info "Re-ran migrations")
(setf successfully-migrated t)))
(is (equalp successfully-migrated t))))
-(def-test history (:suite main-suite :fixture prepare-db-and-server)
- ;;(is (equalp 3 55))
+(def-test history (:fixture prepare-db-and-server)
+ (is (equalp 3 55))
(is (equalp 1 1)))
-;; (run! 'main-suite)
+(format t "Loaded the fucking tests~%")
+
+(if (and (sb-ext:posix-getenv "GHA")
+ (not (run! 'main-suite)))
+ (sb-ext:exit :code 666))