Ticket #2029: test-cases.sh

File test-cases.sh, 1.7 KB (added by João Salavessa, 6 years ago)
Line 
1#1) crit (and MISS) on third curl whenever first is MISS/EXPIRED. Expecting to ALWAYS get "X-Cache: HIT /" on third curl but getting "X-Cache: MISS /"
2tc1(){ curl -sSD- 127.0.0.1 -H returnVary:x -H x:1; curl -sSD- 127.0.0.1 -H xtra:x+ -H x:2; curl -sSD- 127.0.0.1 -H xtra:x+ -H x:2; }
3#2) same issue as above with different Vary/headers
4tc2(){ curl -sSD- 127.0.0.1 -H returnVary:x,y -H x:1 -H y:1; curl -sSD- 127.0.0.1 -H returnVary:y -H xtra:x+ -H x:2 -H y:1; curl -sSD- 127.0.0.1 -H returnVary:y -H xtra:x+ -H x:2 -H y:1; }
5
6#3) like 1) but everything works as expected as response headers on second/third curl's are not larger
7tc3(){ curl -sSD- 127.0.0.1 -H returnVary:x -H x:1; curl -sSD- 127.0.0.1 -H xtra:x -H x:2; curl -sSD- 127.0.0.1 -H xtra:x -H x:2; }
8#4) like 2) but everything works as expected as response headers on second/third curl's are not larger
9tc4(){ curl -sSD- 127.0.0.1 -H returnVary:x,y -H x:1 -H y:1; curl -sSD- 127.0.0.1 -H returnVary:y -H x:2 -H y:1; curl -sSD- 127.0.0.1 -H returnVary:y -H x:2 -H y:1; }
10
11#5) slight change from 2) but also works as expected probably because the first curl will never "match" the cache entry from the third call
12tc5(){ curl -sSD- 127.0.0.1 -H returnVary:x,y -H x:1 -H y:1; curl -sSD- 127.0.0.1 -H returnVary:x -H xtra:x -H x:2 -H y:1; curl -sSD- 127.0.0.1 -H returnVary:x -H xtra:x -H x:2 -H y:1; }
13
14#6) a couple of test cases more where issue happens: if 5) executed after 3) or 4) when cache entry is expired it will error
15tc3_5(){ tc3; sleep 6; tc5; }
16tc4_5(){ tc4; sleep 6; tc5; }
17
18#util loop function
19loop(){ local t=${2:-4} i=0; while [ $((i++)) -lt $t ]; do [ $i -eq 1 ] || sleep ${3:-3}; echo "===== LOOP $i/$t ====="; eval "$1"; done; }