Skip to content

Commit

Permalink
Merge pull request #956 from posit-dev/kg-quarto-tests
Browse files Browse the repository at this point in the history
Add Quarto Tests to the Nightly deployments
  • Loading branch information
kgartland-rstudio authored Feb 5, 2024
2 parents 75c74f4 + 2201135 commit c196143
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 22 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/contract.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
version: 1.4.549

- uses: extractions/setup-just@v1
- uses: actions/download-artifact@v3
Expand Down
49 changes: 29 additions & 20 deletions test/bats/contract/deploy.bats
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,45 @@ load '../node_modules/bats-assert/load'
source ../content/bundles/${CONTENT}/test/.publisher-env
CONTENT_PATH='../content/bundles/'

# helper funciton for deploys
deploy_assertion() {
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}\""
fi
}

# temporary unsupported quarto types
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}\""
deploy_assertion
}

# 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}\""
deploy_assertion

# 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 c196143

Please sign in to comment.