Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Quarto Tests to the Nightly deployments #956

Merged
merged 4 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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}\""
kgartland-rstudio marked this conversation as resolved.
Show resolved Hide resolved
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.")
Loading