Skip to content

Commit

Permalink
Merge pull request #2145 from posit-dev/kg-addition-files-deploy
Browse files Browse the repository at this point in the history
add additional files to deploy tests
  • Loading branch information
kgartland-rstudio authored Aug 20, 2024
2 parents 2e45aed + 77ac215 commit 8959587
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions test/bats/contract/deploy.bats
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,15 @@ deploy_assertion() {
"${CONNECT_SERVER}/__api__/v1/content/${GUID}"
assert_output --partial "\"app_mode\":\"${APP_MODE}\""
assert_output --partial "\"description\":\"${CONTENT} description\""
# if [[ ${static_content[@]} != ${CONTENT_TYPE} ]]; then
assert_output --partial "\"connection_timeout\":25"
assert_output --partial "\"read_timeout\":30"
assert_output --partial "\"init_timeout\":35"
assert_output --partial "\"idle_timeout\":40"
assert_output --partial "\"max_processes\":2"
assert_output --partial "\"min_processes\":1"
assert_output --partial "\"max_conns_per_process\":5"
assert_output --partial "\"load_factor\":0.8"
# fi
assert_output --partial "\"connection_timeout\":25"
assert_output --partial "\"read_timeout\":30"
assert_output --partial "\"init_timeout\":35"
assert_output --partial "\"idle_timeout\":40"
assert_output --partial "\"max_processes\":2"
assert_output --partial "\"min_processes\":1"
assert_output --partial "\"max_conns_per_process\":5"
assert_output --partial "\"load_factor\":0.8"


# reset min_processes to 0
run curl --silent --show-error -L --max-redirs 0 --fail \
Expand All @@ -59,6 +58,10 @@ init_with_fields() {
# add description
perl -i -pe '$_ .= qq(description = "'"${CONTENT}"' description"\n) if /title/' ${FULL_PATH}/.posit/publish/${CONTENT}.toml

if [[ ${ADDITIONAL_FILES} ]]; then
perl -i -pe "s/(files = \[.*)\]/\1, '${ADDITIONAL_FILES}']/" ${FULL_PATH}/.posit/publish/${CONTENT}.toml
fi

# add Connect runtime fields for interactive content
echo "
[connect]
Expand All @@ -72,8 +75,6 @@ runtime.max_conns_per_process = 5
runtime.load_factor = 0.8
" >> ${FULL_PATH}/.posit/publish/${CONTENT}.toml

# TODO: replace the type field with what we expect
# sed -i "" "s/type = '[^']*'/type = '${CONTENT_TYPE}'/g" "${FULL_PATH}/.posit/publish/${CONTENT}.toml"
sed -i"" -e "s/type = '[^']*'/type = '${CONTENT_TYPE}'/g" "${FULL_PATH}/.posit/publish/${CONTENT}.toml"
}

Expand All @@ -95,16 +96,15 @@ python_content_types=(
assert_line "Wrote file requirements.txt:"

# compare show output to expected existing requirements.in file
run ${EXE} requirements show ${FULL_PATH}/
run ${EXE} requirements show ${FULL_PATH}/
assert_success

run diff <(grep -o '^[^=]*' ${FULL_PATH}/test/requirements.in | grep -v '^#') <(grep -o '^[^=]*' ${FULL_PATH}/requirements.txt | grep -v '^#')
run diff -i <(grep -o '^[^=]*' ${FULL_PATH}/test/requirements.in | grep -v '^#') <(grep -o '^[^=]*' ${FULL_PATH}/requirements.txt | grep -v '^#')
assert_success
else
skip
fi
}

# deploy content with the env account using requirements files
@test "deploy ${CONTENT}" {
if [[ ${CONTENT} != "parameterized_report" ]]; then
Expand Down

0 comments on commit 8959587

Please sign in to comment.