Skip to content

Instantly share code, notes, and snippets.

@mumumu
Created May 24, 2011 05:41
Show Gist options
  • Save mumumu/988183 to your computer and use it in GitHub Desktop.
Save mumumu/988183 to your computer and use it in GitHub Desktop.
#!/bin/sh
export LANG=C
testURLContentsChange()
{
sysctl xen.independent_wallclock=1
TEST_URL="http://www.example.com/"
TODAY_START_DATE=`date +'%Y-%m-%d 00:00:00'`
for i in $(seq 1 86400)
do
date -s "$TODAY_START_DATE"
NOWDATE=`date -d "$i seconds" +'%Y-%m-%d %H:%M:%S'`
date -s "$NOWDATE"
WEBPAGE=`wget -nv -O - $TEST_URL`
ACTUAL=0
if [[ "$WEBPAGE" =~ "SHOULD THIS CONTENTS EXISTS" ]]; then
ACTUAL=1
fi
if [[ $i -ge 100 && $i -le 10000 ]]; then
assertEquals "invalid value!" "$ACTUAL" 0
else
assertEquals "invalid value!" "$ACTUAL" 1
fi
done
sysctl xen.independent_wallclock=0
}
. ./shunit2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment