Skip to content

Commit

Permalink
add quarto tests and update ami used
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Gartland committed Feb 2, 2024
1 parent 2649b8b commit 86291c2
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 22 deletions.
62 changes: 42 additions & 20 deletions test/bats/contract/deploy.bats
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,58 @@ load '../node_modules/bats-assert/load'
source ../content/bundles/${CONTENT}/test/.publisher-env
CONTENT_PATH='../content/bundles/'

quarto_r_content=(
"quarto-proj-r-shiny" "quarto-proj-r" "quarto-proj-r-py"
"quarty-website-r" "quarto-website-r-py"
"quarto-website-r-py-separate-files-deps" "quarto-website-r-deps"
"quarto-website-r-py-deps"
)

# deploy content with the env account
@test "deploy ${CONTENT}" {

run ${EXE} deploy ${CONTENT_PATH}/${CONTENT} -n ci_deploy
assert_success
assert_output --partial "Test Deployment... [OK]"
# now test the deployment via api
GUID="$(echo "${output}" | \
grep "Direct URL:" | \
grep -o -E '[0-9a-f-]{36}')"
run curl --silent --show-error -L --max-redirs 0 --fail \
-X GET \
-H "Authorization: Key ${CONNECT_API_KEY}" "${CONNECT_SERVER}/__api__/v1/content/${GUID}"
assert_output --partial "\"app_mode\":\"${CONTENT_TYPE}\""
if [[ ${quarto_r_content[@]} =~ ${CONTENT} ]]; then
assert_output --partial "error detecting content type: quarto with knitr engine is not yet supported."
else
assert_success
assert_output --partial "Test Deployment... [OK]"
# now test the deployment via api
GUID="$(echo "${output}" | \
grep "Direct URL:" | \
grep -o -E '[0-9a-f-]{36}')"
run curl --silent --show-error -L --max-redirs 0 --fail \
-X GET \
-H "Authorization: Key ${CONNECT_API_KEY}" "${CONNECT_SERVER}/__api__/v1/content/${GUID}"
assert_output --partial "\"app_mode\":\"${CONTENT_TYPE}\""
fi

}

# redeploy content from previous test
@test "redeploy ${CONTENT}" {

run ${EXE} redeploy ci_deploy ${CONTENT_PATH}${CONTENT}
assert_success
assert_output --partial "Test Deployment... [OK]"
# now test the deployment via api
GUID="$(echo "${output}" | \
grep "Direct URL:" | \
grep -o -E '[0-9a-f-]{36}')"
run curl --silent --show-error -L --max-redirs 0 --fail \
-X GET \
-H "Authorization: Key ${CONNECT_API_KEY}" "${CONNECT_SERVER}/__api__/v1/content/${GUID}"
assert_output --partial "\"app_mode\":\"${CONTENT_TYPE}\""
if [[ ${quarto_r_content[@]} =~ ${CONTENT} ]]; then
assert_output --partial "error detecting content type: quarto with knitr engine is not yet supported."
else
assert_success
assert_output --partial "Test Deployment... [OK]"
# test the deployment via api
GUID="$(echo "${output}" | \
grep "Direct URL:" | \
grep -o -E '[0-9a-f-]{36}')"
run curl --silent --show-error -L --max-redirs 0 --fail \
-X GET \
-H "Authorization: Key ${CONNECT_API_KEY}" "${CONNECT_SERVER}/__api__/v1/content/${GUID}"
assert_output --partial "\"app_mode\":\"${CONTENT_TYPE}\""

run curl --silent --show-error -L --max-redirs 0 --fail \
-X GET \
-H "Authorization: Key ${CONNECT_API_KEY}" "${CONNECT_SERVER}/__api__/v1/content/${GUID}"
assert_output --partial "\"app_mode\":\"${CONTENT_TYPE}\""
fi

# cleanup
run rm -rf ${CONTENT_PATH}${CONTENT}/.posit/ ${CONTENT_PATH}${CONTENT}/.positignore
}
4 changes: 2 additions & 2 deletions test/setup/connect_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import os

# use the perftest fuzzbucket instance since it already has all the deps
alias = "ubuntu22-publishing-client"
alias = "ubuntu22-publishing-client-2024.02"
box_name = "connect-publishing-client"
list_command = "fuzzbucket-client -j list"
create_command = "fuzzbucket-client create -c -S 20 -t m5.2xlarge " + alias + " -n " + box_name
Expand Down Expand Up @@ -87,4 +87,4 @@ def connect_ready(box_name, max_attempts, interval):
if response:
print("http://" + get_ip(box_name) + ":3939")
else:
print("Server did not respond after multiple attempts.")
print("Server did not respond after multiple attempts.")

0 comments on commit 86291c2

Please sign in to comment.