feat: flesh out git plugin further
- add `report` and `set` subcommands to the git plugin - move configuring the DOKKU_DEPLOY_BRANCH to the git plugin - implement configurable GIT_REV support - migrate DOKKU_DEPLOY_BRANCH settings - add a golang-compatible, shell based method of setting plugin configuration variables Deprecates the community dokku-git-rev plugin. Closes #2621 Refs dokku-community/dokku-git-rev#9
This commit is contained in:
89
tests/unit/10_git.bats
Normal file
89
tests/unit/10_git.bats
Normal file
@@ -0,0 +1,89 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
global_setup
|
||||
create_app
|
||||
}
|
||||
|
||||
teardown() {
|
||||
destroy_app
|
||||
global_teardown
|
||||
}
|
||||
|
||||
@test "(git) deploy specific branch" {
|
||||
run bash -c "dokku git:set --global deploy-branch global-branch"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
GIT_REMOTE_BRANCH=global-branch deploy_app
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
run bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
run bash -c "dokku git:set $TEST_APP deploy-branch app-branch"
|
||||
GIT_REMOTE_BRANCH=app-branch deploy_app
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
run bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
run bash -c "dokku git:set --global deploy-branch"
|
||||
}
|
||||
|
||||
@test "(git) ensure GIT_REV env var is set" {
|
||||
deploy_app
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
run bash -c "dokku config:get $TEST_APP GIT_REV"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_output_exists
|
||||
}
|
||||
|
||||
@test "(git) disable GIT_REV" {
|
||||
run bash -c "dokku git:set $TEST_APP rev-env-var"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
deploy_app
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
run bash -c "dokku config:get $TEST_APP GIT_REV"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_output_empty
|
||||
}
|
||||
|
||||
@test "(git) customize the GIT_REV environment variable" {
|
||||
run bash -c "dokku git:set $TEST_APP rev-env-var GIT_REV_ALT"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
deploy_app
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
run bash -c "dokku config:get $TEST_APP GIT_REV_ALT"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_output_exists
|
||||
}
|
||||
@@ -145,27 +145,3 @@ teardown() {
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(config) deploy specific DOKKU_DEPLOY_BRANCH" {
|
||||
run ssh dokku@dokku.me config:set --global DOKKU_DEPLOY_BRANCH=global-branch
|
||||
GIT_REMOTE_BRANCH=global-branch deploy_app
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
run ssh dokku@dokku.me ps:rebuild $TEST_APP
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
run ssh dokku@dokku.me config:set $TEST_APP DOKKU_DEPLOY_BRANCH=app-branch
|
||||
GIT_REMOTE_BRANCH=app-branch deploy_app
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
run ssh dokku@dokku.me ps:rebuild $TEST_APP
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
}
|
||||
|
||||
@@ -71,6 +71,18 @@ assert_output() {
|
||||
assert_equal "$expected" "$output"
|
||||
}
|
||||
|
||||
# ShellCheck doesn't know about $output from Bats
|
||||
# shellcheck disable=SC2154
|
||||
assert_output_exists() {
|
||||
[[ -n "$output" ]] || flunk "expected output, found none"
|
||||
}
|
||||
|
||||
# ShellCheck doesn't know about $output from Bats
|
||||
# shellcheck disable=SC2154
|
||||
assert_output_empty() {
|
||||
[[ -z "$output" ]] || flunk "expected no output, found $output"
|
||||
}
|
||||
|
||||
# ShellCheck doesn't know about $output from Bats
|
||||
# shellcheck disable=SC2154
|
||||
assert_output_contains() {
|
||||
|
||||
Reference in New Issue
Block a user