test(live): skip unsupported workspace tests
This commit is contained in:
parent
dd37fc9cff
commit
cafcf09fca
@ -31,8 +31,11 @@ Env:
|
||||
GOG_LIVE_GROUP_EMAIL=<group@domain>
|
||||
GOG_LIVE_CLASSROOM_COURSE=<courseId>
|
||||
GOG_LIVE_CLASSROOM_CREATE=1
|
||||
GOG_LIVE_CLASSROOM_ALLOW_STATE=1
|
||||
GOG_LIVE_TRACK=1
|
||||
GOG_LIVE_ALLOW_NONTEST=1
|
||||
GOG_LIVE_CALENDAR_RESPOND=1
|
||||
GOG_LIVE_GMAIL_BATCH_DELETE=1
|
||||
GOG_KEEP_SERVICE_ACCOUNT=/path/to/service-account.json
|
||||
GOG_KEEP_IMPERSONATE=user@workspace-domain
|
||||
USAGE
|
||||
|
||||
@ -34,7 +34,11 @@ PY
|
||||
run_required "calendar" "calendar freebusy" gog calendar freebusy primary --from "$START" --to "$END" --json >/dev/null
|
||||
run_required "calendar" "calendar conflicts" gog calendar conflicts --from "$START" --to "$END" --json >/dev/null
|
||||
|
||||
run_optional "calendar-respond" "calendar respond" gog calendar respond primary "$ev_id" --status accepted --json >/dev/null
|
||||
if [ -n "${GOG_LIVE_CALENDAR_RESPOND:-}" ]; then
|
||||
run_optional "calendar-respond" "calendar respond" gog calendar respond primary "$ev_id" --status accepted --json >/dev/null
|
||||
else
|
||||
echo "==> calendar respond (skipped; needs invite from another account)"
|
||||
fi
|
||||
|
||||
run_required "calendar" "calendar delete event" gog calendar delete primary "$ev_id" --force >/dev/null
|
||||
|
||||
@ -44,9 +48,13 @@ PY
|
||||
run_optional "calendar-enterprise" "calendar working-location" gog calendar create primary --event-type working-location --working-location-type office --working-office-label "HQ" --from "$DAY1" --to "$DAY2" --json >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
if [ -n "${GOG_LIVE_GROUP_EMAIL:-}" ]; then
|
||||
if [ -n "${GOG_LIVE_GROUP_EMAIL:-}" ] && ! is_consumer_account "$ACCOUNT"; then
|
||||
run_optional "calendar-team" "calendar team" gog calendar team "$GOG_LIVE_GROUP_EMAIL" --json --max 5 >/dev/null
|
||||
fi
|
||||
|
||||
run_optional "calendar-users" "calendar users list" gog calendar users --json --max 1 >/dev/null
|
||||
if is_consumer_account "$ACCOUNT"; then
|
||||
echo "==> calendar users (skipped; Workspace only)"
|
||||
else
|
||||
run_optional "calendar-users" "calendar users list" gog calendar users --json --max 1 >/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
@ -37,12 +37,18 @@ run_classroom_tests() {
|
||||
echo "==> classroom (optional; set GOG_LIVE_CLASSROOM_COURSE to expand)"
|
||||
fi
|
||||
|
||||
if [ -n "${GOG_LIVE_CLASSROOM_CREATE:-}" ]; then
|
||||
# Disabled by default: creator account lacks course state permissions.
|
||||
if [ -n "${GOG_LIVE_CLASSROOM_CREATE:-}" ] && [ -n "${GOG_LIVE_CLASSROOM_ALLOW_STATE:-}" ]; then
|
||||
local course_json course_id topic_json topic_id announcement_json announcement_id material_json material_id coursework_json coursework_id
|
||||
|
||||
echo "==> classroom courses create"
|
||||
course_json=$(gog classroom courses create --name "gogcli-smoke-$TS" --section "gogcli" --state ACTIVE --json 2>/dev/null || \
|
||||
gog classroom courses create --name "gogcli-smoke-$TS" --section "gogcli" --state PROVISIONED --json)
|
||||
if course_json=$(gog classroom courses create --name "gogcli-smoke-$TS" --section "gogcli" --state ACTIVE --json 2>/dev/null); then
|
||||
:
|
||||
elif course_json=$(gog classroom courses create --name "gogcli-smoke-$TS" --section "gogcli" --state PROVISIONED --json 2>/dev/null); then
|
||||
:
|
||||
else
|
||||
course_json=""
|
||||
fi
|
||||
course_id=$(extract_id "$course_json")
|
||||
if [ -z "$course_id" ]; then
|
||||
echo "Classroom course create failed; skipping create tests."
|
||||
@ -97,5 +103,7 @@ run_classroom_tests() {
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
elif [ -n "${GOG_LIVE_CLASSROOM_CREATE:-}" ]; then
|
||||
echo "==> classroom create (skipped; no account with course state permissions)"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -180,6 +180,18 @@ is_test_account() {
|
||||
return 1
|
||||
}
|
||||
|
||||
is_consumer_account() {
|
||||
local a domain
|
||||
a=$(echo "$1" | tr 'A-Z' 'a-z')
|
||||
domain="${a##*@}"
|
||||
case "$domain" in
|
||||
gmail.com|googlemail.com)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
return 1
|
||||
}
|
||||
|
||||
ensure_test_account() {
|
||||
if [ "${ALLOW_NONTEST:-false}" = true ] || [ -n "${GOG_LIVE_ALLOW_NONTEST:-}" ]; then
|
||||
return 0
|
||||
|
||||
@ -20,8 +20,13 @@ run_contacts_tests() {
|
||||
run_required "contacts" "contacts search" gog contacts search "gogcli-smoke-$TS@example.com" --json --max 1 >/dev/null
|
||||
run_required "contacts" "contacts delete" gog contacts delete "$contact_id" --force >/dev/null
|
||||
|
||||
run_optional "contacts-directory" "contacts directory list" gog contacts directory list --json --max 1 >/dev/null
|
||||
run_optional "contacts-directory" "contacts directory search" gog contacts directory search "gogcli" --json --max 1 >/dev/null
|
||||
run_optional "contacts-other" "contacts other list" gog contacts other list --json --max 1 >/dev/null
|
||||
run_optional "contacts-other" "contacts other search" gog contacts other search "gogcli" --json --max 1 >/dev/null
|
||||
if is_consumer_account "$ACCOUNT"; then
|
||||
echo "==> contacts directory (skipped; Workspace only)"
|
||||
echo "==> contacts other (skipped; Workspace only)"
|
||||
else
|
||||
run_optional "contacts-directory" "contacts directory list" gog contacts directory list --json --max 1 >/dev/null
|
||||
run_optional "contacts-directory" "contacts directory search" gog contacts directory search "gogcli" --json --max 1 >/dev/null
|
||||
run_optional "contacts-other" "contacts other list" gog contacts other list --json --max 1 >/dev/null
|
||||
run_optional "contacts-other" "contacts other search" gog contacts other search "gogcli" --json --max 1 >/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
@ -15,7 +15,11 @@ run_gmail_tests() {
|
||||
run_required "gmail" "gmail settings sendas list" gog gmail settings sendas list --json >/dev/null
|
||||
run_required "gmail" "gmail settings vacation get" gog gmail settings vacation get --json >/dev/null
|
||||
run_required "gmail" "gmail settings filters list" gog gmail settings filters list --json >/dev/null
|
||||
run_optional "gmail-delegates" "gmail settings delegates list" gog gmail settings delegates list --json >/dev/null
|
||||
if is_consumer_account "$ACCOUNT"; then
|
||||
echo "==> gmail delegates (skipped; Workspace/SA only)"
|
||||
else
|
||||
run_optional "gmail-delegates" "gmail settings delegates list" gog gmail settings delegates list --json >/dev/null
|
||||
fi
|
||||
run_required "gmail" "gmail settings forwarding list" gog gmail settings forwarding list --json >/dev/null
|
||||
run_required "gmail" "gmail settings autoforward get" gog gmail settings autoforward get --json >/dev/null
|
||||
fi
|
||||
@ -49,7 +53,7 @@ run_gmail_tests() {
|
||||
run_required "gmail" "gmail batch modify add" gog gmail batch modify "$send_msg_id" --add STARRED --json >/dev/null
|
||||
run_required "gmail" "gmail batch modify remove" gog gmail batch modify "$send_msg_id" --remove STARRED --json >/dev/null
|
||||
|
||||
if skip "gmail-batch-delete"; then
|
||||
if [ -z "${GOG_LIVE_GMAIL_BATCH_DELETE:-}" ] || skip "gmail-batch-delete"; then
|
||||
echo "==> gmail batch delete (skipped)"
|
||||
else
|
||||
echo "==> gmail batch delete"
|
||||
|
||||
@ -3,10 +3,13 @@
|
||||
set -euo pipefail
|
||||
|
||||
run_workspace_tests() {
|
||||
run_optional "groups" "groups list" gog groups list --json --max 5 >/dev/null
|
||||
|
||||
if [ -n "${GOG_LIVE_GROUP_EMAIL:-}" ]; then
|
||||
run_optional "groups" "groups members" gog groups members "$GOG_LIVE_GROUP_EMAIL" --json --max 5 >/dev/null
|
||||
if is_consumer_account "$ACCOUNT"; then
|
||||
echo "==> groups (skipped; Workspace only)"
|
||||
else
|
||||
run_optional "groups" "groups list" gog groups list --json --max 5 >/dev/null
|
||||
if [ -n "${GOG_LIVE_GROUP_EMAIL:-}" ]; then
|
||||
run_optional "groups" "groups members" gog groups members "$GOG_LIVE_GROUP_EMAIL" --json --max 5 >/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
if skip "keep"; then
|
||||
@ -14,6 +17,11 @@ run_workspace_tests() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
if is_consumer_account "$ACCOUNT"; then
|
||||
echo "==> keep (skipped; Workspace only)"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -z "${GOG_KEEP_SERVICE_ACCOUNT:-}" ] || [ -z "${GOG_KEEP_IMPERSONATE:-}" ]; then
|
||||
if [ "${STRICT:-false}" = true ]; then
|
||||
echo "Missing GOG_KEEP_SERVICE_ACCOUNT/GOG_KEEP_IMPERSONATE for keep tests." >&2
|
||||
|
||||
Loading…
Reference in New Issue
Block a user