Commit 9629d363 authored by Eric Timmons's avatar Eric Timmons
Browse files

Add test for #44 that goes through the client

parent d92df0cf
Pipeline #5124 passed with stages
in 50 minutes and 50 seconds
......@@ -11,7 +11,7 @@
:description "Tests for CLPM"
:license "BSD-2-Clause"
:pathname "test/"
:depends-on (#:parachute #:hunchentoot #:alexandria)
:depends-on (#:parachute #:hunchentoot #:alexandria #:clpm-client)
:serial t
:components
((:file "package")
......
......@@ -3,7 +3,6 @@
(para:define-test global-context-editable-install
(uiop:with-current-directory ((asdf:system-relative-pathname :clpm "test/global-context/editable-install/"))
(with-clpm-env (:config-dir :global :data-dir data-dir)
;;(break "~S" data-dir)
(clpm '("sync" "-VV")
:output :interactive
:error-output :interactive)
......@@ -18,3 +17,16 @@
"--quit")
:output :interactive
:error-output :interactive))))
(para:define-test global-context-editable-install-with-client
(uiop:with-current-directory ((asdf:system-relative-pathname :clpm "test/global-context/editable-install/"))
(let ((*default-pathname-defaults* (uiop:getcwd)))
(with-clpm-env (:config-dir :global :data-dir data-dir)
(clpm-client:sync)
;; Ensure alexandria is installed as well.
(flet ((validate (diff)
(para:true (member "alexandria" (clpm-client:context-diff-release-diffs diff)
:test #'equal
:key 'clpm-client:release-diff-project-name))
t))
(clpm-client:install :asds '("test.asd") :validate #'validate))))))
......@@ -25,7 +25,31 @@
(string-downcase config-dir)
"/"))))
*clpm-env*))
(funcall thunk :cache-dir cache-dir :data-dir data-dir)))))
;; TODO: remove this. Instead of modifying the environment of this
;; process, we should add a set of arguments that let us set any config
;; option via the CLI and teach clpm-client how to use that.
(let ((orig-data-dir (or (uiop:getenvp "CLPM_DATA_DIR") ""))
(orig-cache-dir (or (uiop:getenvp "CLPM_CACHE_DIR") ""))
(orig-config-dirs (or (uiop:getenvp "CLPM_CONFIG_DIRS") ""))
(orig-grovel-sandbox-type (or (uiop:getenvp "CLPM_GROVEL_SANDBOX_TYPE") "")))
(unwind-protect
(progn
(setf (uiop:getenv "CLPM_DATA_DIR") (uiop:native-namestring data-dir)
(uiop:getenv "CLPM_CACHE_DIR") (uiop:native-namestring cache-dir)
(uiop:getenv "CLPM_GROVEL_SANDBOX_TYPE") "nil")
(when (keywordp config-dir)
(setf (uiop:getenv "CLPM_CONFIG_DIRS")
(uiop:native-namestring
(asdf:system-relative-pathname
:clpm
(concatenate 'string "test/configs/"
(string-downcase config-dir)
"/")))))
(funcall thunk :cache-dir cache-dir :data-dir data-dir))
(setf (uiop:getenv "CLPM_DATA_DIR") orig-data-dir
(uiop:getenv "CLPM_CACHE_DIR") orig-cache-dir
(uiop:getenv "CLPM_CONFIG_DIRS") orig-config-dirs
(uiop:getenv "CLPM_GROVEL_SANDBOX_TYPE") orig-grovel-sandbox-type)))))))
(defmacro with-clpm-env ((&key (cache-dir (gensym)) (data-dir (gensym)) config-dir)
&body body)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment