45 lines
1.2 KiB
Common Lisp
45 lines
1.2 KiB
Common Lisp
;;; cl-scopes/test/test-storage
|
|
|
|
;;;; testing facility for scopes/storage
|
|
|
|
(defpackage :scopes/test-storage
|
|
(:use :common-lisp)
|
|
(:local-nicknames (:storage :scopes/storage)
|
|
(:tracking :scopes/storage/tracking)
|
|
(:t :scopes/testing))
|
|
(:export #:*db-config-test*
|
|
#:run #:run-all #:run-postgres #:run-sqlite)
|
|
(:import-from :scopes/testing #:==))
|
|
|
|
(in-package :scopes/test-storage)
|
|
|
|
(defparameter *db-config-test* nil)
|
|
|
|
(defun run-all ()
|
|
(run-sqlite)
|
|
(run-postgres))
|
|
|
|
(defun run-sqlite ()
|
|
(load "test/config-sqlite")
|
|
(let ((storage:*db-config* *db-config-test*))
|
|
(run)))
|
|
|
|
(defun run-postgres ()
|
|
(load "test/config-postgres")
|
|
(let ((storage:*db-config* *db-config-test*))
|
|
(run)))
|
|
|
|
(defun run ()
|
|
(let* ((engine (storage:make-engine))
|
|
(st (storage:make-storage engine))
|
|
(t:*tst* (t:test-suite)))
|
|
(setf (storage:schema st) (getf (storage:db-options st) :schema))
|
|
(test-track st)
|
|
(t:show-result)))
|
|
|
|
(defun test-track (st)
|
|
(let* ((cont (make-instance 'tracking:container :storage st))
|
|
(tr (make-instance 'tracking:track :container cont)))
|
|
(storage:drop-table st :testing.tracks)
|
|
(tracking:create-table cont)
|
|
(== (tracking:data tr) nil)))
|