refactor: use a single implementation for checking cnb/herokuish images
Also use a plugin trigger for testing whether an image is herokuish or not rather than trying to mess around with sourced files.
This commit is contained in:
@@ -70,40 +70,43 @@ EOF
|
||||
}
|
||||
|
||||
@test "(core) image type detection (herokuish default user)" {
|
||||
export DOKKU_ROOT
|
||||
deploy_app
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions"
|
||||
|
||||
run is_image_herokuish_based "dokku/$TEST_APP" "$TEST_APP"
|
||||
run deploy_app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku plugin:trigger builder-image-is-herokuish $TEST_APP dokku/$TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "true"
|
||||
}
|
||||
|
||||
@test "(core) image type detection (herokuish custom user)" {
|
||||
export DOKKU_ROOT
|
||||
deploy_app
|
||||
run deploy_app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
CID=$(<"$DOKKU_ROOT/$TEST_APP/CONTAINER.web.1")
|
||||
docker commit --change "ENV USER postgres" "$CID" "dokku/${TEST_APP}:latest"
|
||||
dokku config:set --no-restart "$TEST_APP" DOKKU_APP_USER=postgres
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions"
|
||||
|
||||
run is_image_herokuish_based "dokku/$TEST_APP" "$TEST_APP"
|
||||
run /bin/bash -c "dokku plugin:trigger builder-image-is-herokuish $TEST_APP dokku/$TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "true"
|
||||
}
|
||||
|
||||
@test "(core) image type detection (dockerfile)" {
|
||||
export DOKKU_ROOT
|
||||
deploy_app dockerfile
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions"
|
||||
|
||||
run is_image_herokuish_based "dokku/$TEST_APP" "$TEST_APP"
|
||||
run deploy_app dockerfile
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku plugin:trigger builder-image-is-herokuish $TEST_APP dokku/$TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "false"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user