-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
They don't actually assert things are correct, just that the commands run without error, which for a start is useful. Could, and maybe should, be a pytest test suite long-term, but at least for now wanted something that just needed the tool installed to run.
- Loading branch information
Showing
7 changed files
with
210 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env sh | ||
set -e | ||
|
||
for test_script in tests-e2e/test*; do | ||
echo "::group::${test_script}" | ||
./"${test_script}" | ||
echo "::endgroup::" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
source "$(realpath "$(dirname "${BASH_SOURCE[0]}")")/lib.sh" | ||
|
||
export CMD="${CMD:-nava-platform}" | ||
|
||
export PROJECT_NAME="${PROJECT_DIR:-foo}" | ||
export PROJECT_DIR=${PROJECT_DIR:-$(mk_temp_dir "test-platform-project")} | ||
|
||
init_project_dir() { | ||
rm -rf "${PROJECT_DIR}" | ||
# vast majority of the time we are expecting to be working against an existing | ||
# project (or at least an empty, but git-initialized project directory) | ||
mkdir -p "${PROJECT_DIR}" | ||
git init "${PROJECT_DIR}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
mk_temp_dir() { | ||
local name="${1:-platform-cli-test-e2e}" | ||
# macOS returns a symlink for $TMPDIR, so resolve to the actual path | ||
realpath "$(mktemp -d "${TMPDIR:-/tmp}/${name}.XXXXXXXXX")" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Simple, but more-or-less complete run through of core functionality. Doesn't | ||
# really check that things are *correct*, just that they run without unexpected | ||
# errors. | ||
|
||
set -xeuo pipefail | ||
|
||
####################### | ||
# Setup | ||
####################### | ||
|
||
source "$(realpath "$(dirname "${BASH_SOURCE[0]}")")/common.sh" | ||
|
||
init_project_dir | ||
|
||
####################### | ||
# Test | ||
####################### | ||
|
||
$CMD --help | ||
|
||
# TODO: add --data-file support to CLI and have as many of these | ||
# settings in more maintainable separate file | ||
$CMD infra install \ | ||
--commit \ | ||
--data base_project_name="${PROJECT_NAME}" \ | ||
--data base_owner=platform-admins \ | ||
--data base_code_repository_url=https://foo.example \ | ||
--data base_default_region=us-east-1 \ | ||
--data app_name=rails \ | ||
--data app_local_port=3000 \ | ||
--data app_has_dev_env_setup=true \ | ||
"${PROJECT_DIR}" | ||
|
||
$CMD infra info "${PROJECT_DIR}" | ||
|
||
$CMD infra update "${PROJECT_DIR}" | ||
|
||
{ yes || true; } | $CMD app install \ | ||
--template-uri https://github.com/navapbc/template-application-rails \ | ||
--version platform-cli \ | ||
--commit \ | ||
"${PROJECT_DIR}" \ | ||
rails \ | ||
--data app_local_port=3000 | ||
|
||
$CMD app update \ | ||
--template-uri https://github.com/navapbc/template-application-rails \ | ||
--version platform-cli \ | ||
"${PROJECT_DIR}" \ | ||
rails | ||
|
||
for app_template in flask nextjs; do | ||
$CMD infra add-app \ | ||
--commit \ | ||
--data app_name="${app_template}" \ | ||
--data app_local_port=3000 \ | ||
--data app_has_dev_env_setup=true \ | ||
"${PROJECT_DIR}" \ | ||
${app_template} | ||
|
||
{ yes || true; } | $CMD app install \ | ||
--template-uri https://github.com/navapbc/template-application-"${app_template}" \ | ||
--version platform-cli \ | ||
--commit \ | ||
"${PROJECT_DIR}" \ | ||
"${app_template}" \ | ||
--data app_local_port=3000 | ||
|
||
$CMD app update \ | ||
--template-uri https://github.com/navapbc/template-application-"${app_template}" \ | ||
--version platform-cli \ | ||
"${PROJECT_DIR}" \ | ||
"${app_template}" | ||
done | ||
|
||
$CMD infra info "${PROJECT_DIR}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Test that local templates work | ||
|
||
set -xeuo pipefail | ||
|
||
####################### | ||
# Setup | ||
####################### | ||
|
||
source "$(realpath "$(dirname "${BASH_SOURCE[0]}")")/common.sh" | ||
|
||
init_project_dir | ||
|
||
####################### | ||
# Test | ||
####################### | ||
|
||
infra_template_dir=$(mk_temp_dir) | ||
git clone https://github.com/navapbc/template-infra.git "${infra_template_dir}" | ||
git -C "${infra_template_dir}" checkout lorenyu/platform-cli | ||
|
||
# TODO: add --data-file support to CLI and have as many of these | ||
# settings in more maintainable separate file | ||
$CMD infra install \ | ||
--template-uri "${infra_template_dir}" \ | ||
--commit \ | ||
--data base_project_name="${PROJECT_NAME}" \ | ||
--data base_owner=platform-admins \ | ||
--data base_code_repository_url=https://foo.example \ | ||
--data base_default_region=us-east-1 \ | ||
--data app_name=app \ | ||
--data app_local_port=3000 \ | ||
--data app_has_dev_env_setup=true \ | ||
"${PROJECT_DIR}" | ||
|
||
$CMD infra update \ | ||
--template-uri "${infra_template_dir}" \ | ||
"${PROJECT_DIR}" | ||
|
||
rails_template_dir=$(mk_temp_dir) | ||
git clone https://github.com/navapbc/template-application-rails "${rails_template_dir}" | ||
git -C "${rails_template_dir}" checkout platform-cli | ||
|
||
{ yes || true; } | $CMD app install \ | ||
--template-uri "${rails_template_dir}" \ | ||
--version platform-cli \ | ||
--template-name template-application-rails \ | ||
--commit \ | ||
"${PROJECT_DIR}" \ | ||
app \ | ||
--data app_local_port=3000 | ||
|
||
$CMD app update \ | ||
--template-uri "${rails_template_dir}" \ | ||
--version platform-cli \ | ||
--template-name template-application-rails \ | ||
"${PROJECT_DIR}" \ | ||
app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Test that `install` commands will create the project directory when it doesn't | ||
# already exist | ||
|
||
set -xeuo pipefail | ||
|
||
####################### | ||
# Setup | ||
####################### | ||
|
||
source "$(realpath "$(dirname "${BASH_SOURCE[0]}")")/common.sh" | ||
|
||
####################### | ||
# Test | ||
####################### | ||
|
||
rm -rf "${PROJECT_DIR}" | ||
|
||
# TODO: add --data-file support to CLI and have as many of these | ||
# settings in more maintainable separate file | ||
$CMD infra install \ | ||
--data base_project_name="${PROJECT_NAME}" \ | ||
--data base_owner=platform-admins \ | ||
--data base_code_repository_url=https://foo.example \ | ||
--data base_default_region=us-east-1 \ | ||
--data app_name=app \ | ||
--data app_local_port=3000 \ | ||
--data app_has_dev_env_setup=true \ | ||
"${PROJECT_DIR}" | ||
|
||
rm -rf "${PROJECT_DIR}" | ||
|
||
$CMD app install \ | ||
--template-uri https://github.com/navapbc/template-application-rails \ | ||
--version platform-cli \ | ||
--data app_local_port=3000 \ | ||
"${PROJECT_DIR}" \ | ||
app |