53af7110db60ea93d61684c2e3ebb52dc3c73680 lrnassar Tue Jun 2 11:47:02 2026 -0700 Fix hubApi blat01 test so the QA cron passes from internal IPs. refs #36315 The apiKey gate on /blat is bypassed for bottleneck.except IPs (which includes hgwdev, where the QA cron runs against genome-test), so a no-apiKey request returns a live blat[] result rather than the apiKey error the test expected. Accept either valid outcome (apiKey gate error or blat[] result). Also query /cgi-bin/hubApi/blat/dna directly as a temporary workaround: the Apache rewrite for the bare /blat/ path is not yet deployed, so /blat/dna returns 404. Revert to the bare path once the rewrite rule is in place. diff --git src/hg/hubApi/tests/makefile src/hg/hubApi/tests/makefile index 6af366b24b3..8ef1032fbb2 100644 --- src/hg/hubApi/tests/makefile +++ src/hg/hubApi/tests/makefile @@ -1143,42 +1143,48 @@ @zdiff expected/$@.gz testOutput/$@.gz ############################################################################## ### search - test search function ############################################################################## # basic search just to see if it works: search01: setOutput @ printf "### $@ '${SERVERNAME}/search?search=brca;genome=hg38'\n" @ curl -L "${SERVERNAME}/search?search=brca;genome=hg38" 2> /dev/null | python -mjson.tool | egrep -c -n "\[|\]" | awk -v t="$@" '{if (($$1 < 30) || ($$1 > 50)) {printf "test %s failed, count %d not in range 30-40\n", t, $$1; exit 255;}}' ############################################################################## ### blat - test /blat endpoint ############################################################################## -# /blat smoke test. Always verifies the apiKey gate (no secret required); -# if APIKEY is exported, additionally runs a live alignment of the +# /blat smoke test. Accepts either valid outcome of a no-apiKey request: +# the apiKey-gate error (external clients) or a live blat[] result (internal +# bottleneck.except IPs / known agents, where the gate is bypassed -- this is +# the case for the QA cron running on hgwdev against genome-test). +# If APIKEY is exported, additionally runs a live alignment of the # demo sequence against hg38 and checks for a 'blat' array in the response. +# TEMPORARY: hits /cgi-bin/hubApi/blat/dna directly because the Apache rewrite +# for the bare /blat/ path is not yet deployed (bare /blat/dna returns 404). +# Revert to "${SERVERNAME}/blat/dna" once the rewrite rule is in place. blat01: setOutput - @printf "### $@ '${SERVERNAME}/blat/dna?genome=hg38;userSeq=GTCCTCGGAACCAGGACCTCGGCGTGGCCTAGCG'\n" - @curl -L -sG "${SERVERNAME}/blat/dna" \ + @printf "### $@ '${SERVERNAME}/cgi-bin/hubApi/blat/dna?genome=hg38;userSeq=GTCCTCGGAACCAGGACCTCGGCGTGGCCTAGCG'\n" + @curl -L -sG "${SERVERNAME}/cgi-bin/hubApi/blat/dna" \ --data-urlencode "genome=hg38" \ --data-urlencode "userSeq=GTCCTCGGAACCAGGACCTCGGCGTGGCCTAGCG" \ - 2>/dev/null | grep -q apiKey \ - || { echo "test $@ failed: missing-apiKey request did not return apiKey error"; exit 255; } + 2>/dev/null | egrep -q 'apiKey|"blat"' \ + || { echo "test $@ failed: response had neither apiKey gate nor blat[] result"; exit 255; } @if [ -n "$$APIKEY" ]; then \ - curl -L -sG "${SERVERNAME}/blat/dna" \ + curl -L -sG "${SERVERNAME}/cgi-bin/hubApi/blat/dna" \ --data-urlencode "apiKey=$$APIKEY" \ --data-urlencode "genome=hg38" \ --data-urlencode "userSeq=GTCCTCGGAACCAGGACCTCGGCGTGGCCTAGCG" \ 2>/dev/null | python -mjson.tool | grep -q '"blat"' \ || { echo "test $@ failed: live BLAT response has no blat[] field"; exit 255; }; \ echo "### $@: apiKey gate OK; live BLAT OK"; \ else \ echo "### $@: apiKey gate OK (export APIKEY=<key> to also test live BLAT)"; \ fi ############################################################################## ### chrAlias - test chrom alias ############################################################################## # testing /getData/track?genome=ce11&track=gold&chrom=MT