Permalink
Browse files

Make ssh key test more robust

The add-identity-test ssh-agent case was failing for no apparent reason.
  • Loading branch information...
1 parent 797feb0 commit 70bf2330707c3deac468b9c2cdce366ff0f5a64e @hugoduncan committed Dec 16, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 test/clj_ssh/ssh_test.clj
@@ -60,13 +60,15 @@
(let [agent (ssh-agent {})]
(let [n (count (.getIdentityNames agent))
test-key-comment "key for test clj-ssh"
- has-key (some #(= (private-key-path) %) (.getIdentityNames agent))]
+ names (vec (.getIdentityNames agent))
+ has-key (some #(= (private-key-path) %) names)]
(add-identity
agent
{:private-key-path (private-key-path)
:public-key-path (public-key-path)})
- (is (or has-key (= (inc n) (count (.getIdentityNames agent)))))
- (is (some #(= (private-key-path) %) (.getIdentityNames agent)))))))
+ (let [names (.getIdentityNames agent)]
+ (is (or has-key (= (inc n) (count names))))
+ (is (some #(= (private-key-path) %) names)))))))
(deftest has-identity?-test
(let [key (private-key-path)

0 comments on commit 70bf233

Please sign in to comment.