Skip to content

Commit 70bf233

Browse files
committed
Make ssh key test more robust
The add-identity-test ssh-agent case was failing for no apparent reason.
1 parent 797feb0 commit 70bf233

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/clj_ssh/ssh_test.clj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,15 @@
6060
(let [agent (ssh-agent {})]
6161
(let [n (count (.getIdentityNames agent))
6262
test-key-comment "key for test clj-ssh"
63-
has-key (some #(= (private-key-path) %) (.getIdentityNames agent))]
63+
names (vec (.getIdentityNames agent))
64+
has-key (some #(= (private-key-path) %) names)]
6465
(add-identity
6566
agent
6667
{:private-key-path (private-key-path)
6768
:public-key-path (public-key-path)})
68-
(is (or has-key (= (inc n) (count (.getIdentityNames agent)))))
69-
(is (some #(= (private-key-path) %) (.getIdentityNames agent)))))))
69+
(let [names (.getIdentityNames agent)]
70+
(is (or has-key (= (inc n) (count names))))
71+
(is (some #(= (private-key-path) %) names)))))))
7072

7173
(deftest has-identity?-test
7274
(let [key (private-key-path)

0 commit comments

Comments
 (0)