refactor: move run command to it's own plugin

This commit is contained in:
Jose Diaz-Gonzalez
2021-07-27 01:37:51 -04:00
parent bd3f753d85
commit dbc3d82017
11 changed files with 113 additions and 33 deletions

View File

@@ -20,26 +20,6 @@ teardown() {
assert_output_contains "Cleans up exited/dead Docker containers and removes dangling image"
}
@test "(core) run (with --options)" {
deploy_app
run /bin/bash -c "dokku --force --quiet run $TEST_APP python -V"
echo "output: $output"
echo "status: $status"
assert_success
}
@test "(core) run (with --env / -e)" {
deploy_app
run /bin/bash -c "dokku run --env TEST=testvalue -e TEST2=testvalue2 $TEST_APP env | grep -E '^TEST=testvalue'"
echo "output: $output"
echo "status: $status"
run /bin/bash -c "dokku run --env TEST=testvalue -e TEST2=testvalue2 $TEST_APP env | grep -E '^TEST2=testvalue2'"
echo "output: $output"
echo "status: $status"
assert_success
}
@test "(core) unknown command" {
run /bin/bash -c "dokku fakecommand"
echo "output: $output"

41
tests/unit/run_1.bats Normal file
View File

@@ -0,0 +1,41 @@
#!/usr/bin/env bats
load test_helper
setup() {
global_setup
create_app
}
teardown() {
destroy_app
dokku config:unset --global DOKKU_RM_CONTAINER
global_teardown
}
@test "(run) run:help" {
run /bin/bash -c "dokku run:help"
echo "output: $output"
echo "status: $status"
assert_output_contains "Run a one-off process inside a container"
}
@test "(run) run (with --options)" {
deploy_app
run /bin/bash -c "dokku --force --quiet run $TEST_APP python -V"
echo "output: $output"
echo "status: $status"
assert_success
}
@test "(run) run (with --env / -e)" {
deploy_app
run /bin/bash -c "dokku run --env TEST=testvalue -e TEST2=testvalue2 $TEST_APP env | grep -E '^TEST=testvalue'"
echo "output: $output"
echo "status: $status"
run /bin/bash -c "dokku run --env TEST=testvalue -e TEST2=testvalue2 $TEST_APP env | grep -E '^TEST2=testvalue2'"
echo "output: $output"
echo "status: $status"
assert_success
}

View File

@@ -5,14 +5,11 @@ load test_helper
setup() {
global_setup
create_app
DOCKERFILE="$BATS_TMPDIR/Dockerfile"
}
teardown() {
rm -rf /home/dokku/$TEST_APP/tls
destroy_app
dokku config:unset --global DOKKU_RM_CONTAINER
rm -f "$DOCKERFILE"
global_teardown
}