Merge pull request #2287 from dokku/u2mejc-ssh-keys

Add ssh-keys core plugin
This commit is contained in:
Jose Diaz-Gonzalez
2016-07-30 15:11:01 -04:00
committed by GitHub
12 changed files with 186 additions and 22 deletions

View File

@@ -0,0 +1,38 @@
#!/usr/bin/env bats
load test_helper
setup() {
create_key
}
teardown() {
destroy_key
}
@test "(ssh-keys) ssh-keys:add, ssh-keys:list, ssh-keys:remove" {
run /bin/bash -c "dokku ssh-keys:add name1 /tmp/testkey.pub"
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "cat /tmp/testkey.pub | dokku ssh-keys:add name2"
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "dokku ssh-keys:list | grep name1 && dokku ssh-keys:list | grep name2"
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "dokku ssh-keys:remove name1"
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "dokku ssh-keys:list | grep name1"
echo "output: "$output
echo "status: "$status
assert_failure
run /bin/bash -c "dokku ssh-keys:list | grep name2"
echo "output: "$output
echo "status: "$status
assert_success
}

View File

@@ -117,6 +117,11 @@ create_app() {
dokku apps:create "$TEST_APP"
}
create_key() {
ssh-keygen -P "" -f /tmp/testkey &> /dev/null
}
destroy_app() {
local RC="$1"; local RC=${RC:=0}
local APP="$2"; local TEST_APP=${APP:=$TEST_APP}
@@ -124,6 +129,10 @@ destroy_app() {
return "$RC"
}
destroy_key() {
rm -f /tmp/testkey* &> /dev/null || true
}
add_domain() {
dokku domains:add "$TEST_APP" "$1"
}