Remove linked app from links file when destroying app
This commit is contained in:
2
tests/bin/sudo
Executable file
2
tests/bin/sudo
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
exit 0
|
||||
20
tests/hook_pre_delete.bats
Executable file
20
tests/hook_pre_delete.bats
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bats
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
dokku apps:create my_app >&2
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:create" l >&2
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app >&2
|
||||
}
|
||||
|
||||
teardown() {
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app >&2
|
||||
dokku --force "$PLUGIN_COMMAND_PREFIX:destroy" l >&2
|
||||
rm "$DOKKU_ROOT/my_app" -rf
|
||||
}
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:hook:pre-delete) removes app from links file when destroying app" {
|
||||
[[ -n $(< "$PLUGIN_DATA_ROOT/l/LINKS") ]]
|
||||
dokku --force apps:destroy my_app
|
||||
[[ -z $(< "$PLUGIN_DATA_ROOT/l/LINKS") ]]
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/test_helper.bash"
|
||||
|
||||
BIN_STUBS="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/bin"
|
||||
|
||||
if [[ ! -d $DOKKU_ROOT ]]; then
|
||||
git clone https://github.com/progrium/dokku.git $DOKKU_ROOT > /dev/null
|
||||
fi
|
||||
@@ -13,3 +15,10 @@ cd -
|
||||
rm -rf $DOKKU_ROOT/plugins/service
|
||||
mkdir -p $DOKKU_ROOT/plugins/service
|
||||
find ./ -maxdepth 1 -type f -exec cp '{}' $DOKKU_ROOT/plugins/service \;
|
||||
|
||||
if [[ ! -f $BIN_STUBS/plugn ]]; then
|
||||
wget -O- "$PLUGN_URL" | tar xzf - -C "$BIN_STUBS"
|
||||
plugn init
|
||||
ln -s "$DOKKU_ROOT"/plugins/* "$DOKKU_ROOT"/plugins/available
|
||||
ln -s "$DOKKU_ROOT"/plugins/* "$DOKKU_ROOT"/plugins/enabled
|
||||
fi
|
||||
|
||||
@@ -10,6 +10,7 @@ export PLUGIN_AVAILABLE_PATH="$PLUGIN_PATH"
|
||||
export PLUGIN_CORE_AVAILABLE_PATH="$PLUGIN_PATH"
|
||||
export POSTGRES_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/fixtures"
|
||||
export PLUGIN_DATA_ROOT="$POSTGRES_ROOT"
|
||||
export PLUGN_URL="https://github.com/progrium/plugn/releases/download/v0.1.0/plugn_0.1.0_linux_x86_64.tgz"
|
||||
|
||||
mkdir -p "$PLUGIN_DATA_ROOT"
|
||||
rm -rf "${PLUGIN_DATA_ROOT:?}"/*
|
||||
|
||||
Reference in New Issue
Block a user