Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added cleanup of temporary files from test

  • Loading branch information...
commit 4f9029bd68b9c7403758f8069ffc5b3e1ab697b6 1 parent 0027414
@hugoduncan hugoduncan authored
Showing with 19 additions and 11 deletions.
  1. +1 −0  src/pallet/utils.clj
  2. +18 −11 test/pallet/resource/remote_file_test.clj
View
1  src/pallet/utils.clj
@@ -208,6 +208,7 @@
(info (script-result :out))
(do
(error (str "Exit status " (script-result :exit)))
+ (error (script-result :out))
(error (script-result :err))))
(ssh session (str "rm " tmpfile))
(doseq [[file remote-name] *file-transfers*]
View
29 test/pallet/resource/remote_file_test.clj
@@ -7,6 +7,7 @@
(:require
pallet.compat
[pallet.core :as core]
+ [pallet.resource.exec-script :as exec-script]
[pallet.compute :as compute]
[pallet.utils :as utils]))
@@ -59,14 +60,20 @@
(with-temporary [tmp (tmpfile)
target-tmp (tmpfile)]
- (.delete target-tmp)
- (io/copy "text" tmp)
- (core/defnode tag [])
- (core/apply-phases-to-node
- nil (compute/make-unmanaged-node "tag" "localhost")
- [(phase
- (remote-file (.getPath target-tmp) :local-file (.getPath tmp)
- :owner (. System getProperty "user.name")))]
- (assoc utils/*admin-user* :username (test-username) :no-sudo true))
- (is (.canRead target-tmp))
- (is (= "text" (slurp (.getPath target-tmp))))))
+ ;; this is convoluted to get around the "t" sticky bit on temp dirs
+ (let [user (assoc utils/*admin-user* :username (test-username) :no-sudo true)]
+ (.delete target-tmp)
+ (io/copy "text" tmp)
+ (core/defnode tag [])
+ (core/apply-phases-to-node
+ nil (compute/make-unmanaged-node "tag" "localhost")
+ [(phase
+ (remote-file (.getPath target-tmp) :local-file (.getPath tmp) :mode "0666"))]
+ user)
+ (is (.canRead target-tmp))
+ (is (= "text" (slurp (.getPath target-tmp))))
+ (core/apply-phases-to-node
+ nil (compute/make-unmanaged-node "tag" "localhost")
+ [(phase (exec-script/exec-script (script (rm ~(.getPath target-tmp)))))]
+ user)
+ (is (not (.exists target-tmp))))))
Please sign in to comment.
Something went wrong with that request. Please try again.