Real regression testing, using parts of the framework developed earlier.

This commit is contained in:
Andrew McMillan 2006-10-26 00:29:47 +13:00
parent a4196cedd0
commit 99719ddbfc
29 changed files with 502 additions and 17 deletions

View File

@ -89,19 +89,31 @@
<item url="htdocs/relationship_types.php" uploadstatus="1" />
<item url="dba/patches/0.99.1.sql" uploadstatus="1" />
<item url="dba/patches/" uploadstatus="1" />
<item url="INSTALL" />
<item url="README" />
<item url="TODO" />
<item url="docs/" />
<item url="docs/website/installation.php" />
<item url="docs/website/" />
<item url="docs/website/index.php" />
<item url="docs/website/inc/page-header.php" />
<item url="docs/website/inc/" />
<item url="docs/website/inc/page-footer.php" />
<item url="docs/website/style.css" />
<item url="docs/website/news.php" />
<item url="docs/website/background.php" />
<item url="docs/website/clients.php" />
<item url="INSTALL" uploadstatus="1" />
<item url="README" uploadstatus="1" />
<item url="TODO" uploadstatus="1" />
<item url="docs/" uploadstatus="1" />
<item url="docs/website/installation.php" uploadstatus="1" />
<item url="docs/website/" uploadstatus="1" />
<item url="docs/website/index.php" uploadstatus="1" />
<item url="docs/website/inc/page-header.php" uploadstatus="1" />
<item url="docs/website/inc/" uploadstatus="1" />
<item url="docs/website/inc/page-footer.php" uploadstatus="1" />
<item url="docs/website/style.css" uploadstatus="1" />
<item url="docs/website/clients.php" uploadstatus="1" />
<item url="testing/normalise_result" />
<item url="testing/run_regressions.sh" />
<item url="testing/watch-port-80.sh" />
<item url="testing/tests/regression-suite/" />
<item url="testing/tests/regression-suite/001-Mulberry-1.test" />
<item url="testing/tests/regression-suite/002-Mulberry-1.test" />
<item url="testing/tests/regression-suite/003-Mulberry-1.test" />
<item url="testing/tests/regression-suite/004-Mulberry-1.test" />
<item url="testing/tests/regression-suite/005-Mulberry-1.test" />
<item url="testing/tests/regression-suite/006-Mulberry-1.test" />
<item url="testing/tests/regression-suite/010-Mulberry-PUT-1.test" />
<item url="testing/README.regression_tests" />
<item url="testing/tests/regression-suite/007-Mulberry-1.test" />
<item url="testing/tests/regression-suite/011-Mulberry-PUT-1b.test" />
</project>
</webproject>

View File

@ -0,0 +1,24 @@
Regression Testing
==================
At present these regression tests are basically written to work in my
own environment. While I am, of course, happy to see patches that make
them more generic they are still very much a work in progress.
At present the most demanding client to support is Mulberry, so the first
regression tests imitate Mulberry taking RSCDS through it's paces:
- Initial OPTIONS request at the root
- Initial PROPFIND request at the root with Depth 1
- Second PROPFIND request at the second level
- MKCALENDAR request to create a calendar at /user1/home/
- Third PROPFIND request duplicating the Second one (but finding a calendar now).
- Fourth PROPFIND request solely looking for the new calendar, requesting 'getetag'
- Not that Mulberry would let us do this, but we try to MKCALENDAR again at /user1/home/ to check for the error we expect.
- PUT our first event into the calendar.
- PUT the same event a second time, which should not give an error, but should respond with 'Replaced' rather than 'Created'.
=====>>>> We are up to here...
- PUT the same event a third time, but with an If-None-Match header, which /should/ give a 412 Precondition Failed error.

View File

@ -8,7 +8,7 @@ my $test=$ARGV[1];
usage() unless ( defined($suite) && defined($test) );
my @arguments = ( "--basic", "--user", "andrew:x", "--proxy", "", "--silent" );
my @arguments = ( "--basic", "--user", "user1:user1", "--proxy", "", "--silent" );
push @arguments, "--verbose" if ( defined($ARGV[2]) );
my $url;

16
testing/normalise_result Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/perl -w
#
# Given a result on stdin, try and normalise some
# elements of it (such as HTTP Header dates) so that we can
# simply compare it with other results
#
use strict;
while( <STDIN> ) {
/^Date: [SMTWF][a-z]{2}, [0-9]{1,2} [JFMAJSOND][a-z]+ 20[0-9]{2} [012][0-9]:[0-5][0-9]:[0-5][0-9] GMT\r$/ && do {
$_ = "Date: Dow, 01 Jan 2000 00:00:00 GMT\r\n";
};
print;
}

36
testing/run_regressions.sh Executable file
View File

@ -0,0 +1,36 @@
#!/bin/sh
#
# Run the regression tests and display differences
#
# Restart PGPool to ensure we can drop and recreate the database
# FIXME: We should really drop everything *from* the database and create it
# from that, so we don't need to do this.
sudo /etc/init.d/pgpool restart
dropdb caldav
../dba/create-database.sh caldav
for T in tests/regression-suite/*.test ; do
TEST="`basename ${T} .test`"
./dav_test regression-suite "${TEST}" | ./normalise_result > "tests/regression-suite/results/${TEST}"
if [ ! -f "tests/regression-suite/${TEST}.result" ] ; then
touch "tests/regression-suite/${TEST}.result"
fi
diff -u "tests/regression-suite/${TEST}.result" "tests/regression-suite/results/${TEST}" >"tests/regression-suite/diffs/${TEST}"
done
for T in tests/regression-suite/*.test ; do
TEST="`basename ${T} .test`"
if [ -s "tests/regression-suite/diffs/${TEST}" -o ! -f "tests/regression-suite/${TEST}.result" ] ; then
echo "======================================="
echo "Displaying diff for test ${TEST}"
echo "======================================="
cat "tests/regression-suite/diffs/${TEST}"
read -p "Accept this as new standard result [y/N]? " ACCEPT
if [ "${ACCEPT}" = "y" ] ; then
cp "tests/regression-suite/results/${TEST}" "tests/regression-suite/${TEST}.result"
fi
else
echo "Test ${TEST} passed OK!"
fi
done

View File

@ -2,6 +2,8 @@
# After creating a calendar in Mulberry, we should be able
# to do a PROPFIND and discover it.
TYPE=PROPFIND
URL=http://mycaldav/caldav.php/andrew/
URL=http://mycaldav/caldav.php/
HEADER=Depth: 1
HEADER=Content-Type: text/xml; charset=utf-8
HEADER=Content-Type: text/xml; charset=utf-8
HEAD
VERBOSE

View File

@ -0,0 +1,2 @@
diffs
results

View File

@ -0,0 +1,8 @@
HTTP/1.1 200 OK
Date: Dow, 01 Jan 2000 00:00:00 GMT
Server: Apache/2.2.3 (Debian) DAV/2
Content-length: 0
Allow: OPTIONS, GET, PUT, DELETE, PROPFIND, REPORT, MKCALENDAR, MKCOL
DAV: 1, 2, access-control, calendar-access
Content-Type: text/plain; charset=UTF-8

View File

@ -0,0 +1,5 @@
#
# Do an initial OPTIONS request
TYPE=OPTIONS
URL=http://mycaldav/caldav.php/
HEAD

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<D:propfind xmlns:D="DAV:">
<D:prop>
<D:getcontentlength/>
<D:getcontenttype/>
<D:resourcetype/>
</D:prop>
</D:propfind>

View File

@ -0,0 +1,153 @@
HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
Server: Apache/2.2.3 (Debian) DAV/2
ETag: "1e91289a2ef6640fadb7d5c9e6c5ebbb"
Content-Length: 3214
Content-Type: text/xml;charset=UTF-8
<?xml version="1.0" encoding="UTF-8" ?>
<multistatus xmlns="DAV:">
<response>
<href>/caldav.php/</href>
<propstat>
<prop>
<getcontentlength/>
<getcontenttype>httpd/unix-directory</getcontenttype>
<resourcetype>
<collection/>
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/admin/</href>
<propstat>
<prop>
<getcontentlength/>
<getcontenttype>httpd/unix-directory</getcontenttype>
<resourcetype>
<collection/>
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/andrew/</href>
<propstat>
<prop>
<getcontentlength/>
<getcontenttype>httpd/unix-directory</getcontenttype>
<resourcetype>
<collection/>
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/user1/</href>
<propstat>
<prop>
<getcontentlength/>
<getcontenttype>httpd/unix-directory</getcontenttype>
<resourcetype>
<collection/>
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/user2/</href>
<propstat>
<prop>
<getcontentlength/>
<getcontenttype>httpd/unix-directory</getcontenttype>
<resourcetype>
<collection/>
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/manager1/</href>
<propstat>
<prop>
<getcontentlength/>
<getcontenttype>httpd/unix-directory</getcontenttype>
<resourcetype>
<collection/>
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/assistant1/</href>
<propstat>
<prop>
<getcontentlength/>
<getcontenttype>httpd/unix-directory</getcontenttype>
<resourcetype>
<collection/>
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/resource1/</href>
<propstat>
<prop>
<getcontentlength/>
<getcontenttype>httpd/unix-directory</getcontenttype>
<resourcetype>
<collection/>
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/resource2/</href>
<propstat>
<prop>
<getcontentlength/>
<getcontenttype>httpd/unix-directory</getcontenttype>
<resourcetype>
<collection/>
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/resmgr1/</href>
<propstat>
<prop>
<getcontentlength/>
<getcontenttype>httpd/unix-directory</getcontenttype>
<resourcetype>
<collection/>
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/teamclient1/</href>
<propstat>
<prop>
<getcontentlength/>
<getcontenttype>httpd/unix-directory</getcontenttype>
<resourcetype>
<collection/>
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
</multistatus>

View File

@ -0,0 +1,8 @@
#
# After creating a calendar in Mulberry, we should be able
# to do a PROPFIND and discover it.
TYPE=PROPFIND
URL=http://mycaldav/caldav.php/
HEADER=Depth: 1
HEADER=Content-Type: text/xml; charset=utf-8
HEAD

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<D:propfind xmlns:D="DAV:">
<D:prop>
<D:getcontentlength/>
<D:getcontenttype/>
<D:resourcetype/>
</D:prop>
</D:propfind>

View File

@ -0,0 +1,23 @@
HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
Server: Apache/2.2.3 (Debian) DAV/2
ETag: "137b55c4b6461331a0d3e7b89d5b71b0"
Content-Length: 365
Content-Type: text/xml;charset=UTF-8
<?xml version="1.0" encoding="UTF-8" ?>
<multistatus xmlns="DAV:">
<response>
<href>/caldav.php/user1/</href>
<propstat>
<prop>
<getcontentlength/>
<getcontenttype>httpd/unix-directory</getcontenttype>
<resourcetype>
<collection/>
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
</multistatus>

View File

@ -0,0 +1,8 @@
#
# Before creating a calendar in Mulberry, we should be able
# to do a PROPFIND and it should not be there.
TYPE=PROPFIND
URL=http://mycaldav/caldav.php/user1/
HEADER=Depth: 1
HEADER=Content-Type: text/xml; charset=utf-8
HEAD

View File

@ -0,0 +1,6 @@
HTTP/1.1 200 Created
Date: Dow, 01 Jan 2000 00:00:00 GMT
Server: Apache/2.2.3 (Debian) DAV/2
Content-Length: 0
Content-Type: text/html; charset=UTF-8

View File

@ -0,0 +1,6 @@
#
# So we should now make a calendar that we will use for some
# testing.
TYPE=MKCALENDAR
URL=http://mycaldav/caldav.php/user1/home/
HEAD

View File

@ -0,0 +1,37 @@
HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
Server: Apache/2.2.3 (Debian) DAV/2
ETag: "e898d6c4a9951794a9f7147f432570d0"
Content-Length: 708
Content-Type: text/xml;charset=UTF-8
<?xml version="1.0" encoding="UTF-8" ?>
<multistatus xmlns="DAV:">
<response>
<href>/caldav.php/user1/</href>
<propstat>
<prop>
<getcontentlength/>
<getcontenttype>httpd/unix-directory</getcontenttype>
<resourcetype>
<collection/>
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/user1/home/</href>
<propstat>
<prop>
<getcontentlength/>
<getcontenttype>httpd/unix-directory</getcontenttype>
<resourcetype>
<collection/>
<calendar xmlns="urn:ietf:params:xml:ns:caldav"/>
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
</multistatus>

View File

@ -0,0 +1,10 @@
#
# Before creating a calendar in Mulberry, we should be able
# to do a PROPFIND and it should not be there.
TYPE=PROPFIND
URL=http://mycaldav/caldav.php/user1/
HEADER=Depth: 1
HEADER=Content-Type: text/xml; charset=utf-8
HEAD
# We re-use the data from the PROPFIND request before we made the calendar
DATA=003-Mulberry-1

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<D:propfind xmlns:D="DAV:">
<D:prop>
<D:getcontentlength/>
<D:getcontenttype/>
<D:resourcetype/>
<D:getetag/>
</D:prop>
</D:propfind>

View File

@ -0,0 +1,25 @@
HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
Server: Apache/2.2.3 (Debian) DAV/2
ETag: "37e795bc0198358d27e006b91dc75aa7"
Content-Length: 483
Content-Type: text/xml;charset=UTF-8
<?xml version="1.0" encoding="UTF-8" ?>
<multistatus xmlns="DAV:">
<response>
<href>/caldav.php/user1/home/</href>
<propstat>
<prop>
<getcontentlength/>
<getcontenttype>httpd/unix-directory</getcontenttype>
<resourcetype>
<collection/>
<calendar xmlns="urn:ietf:params:xml:ns:caldav"/>
</resourcetype>
<getetag>"faf25336de0e470a54075c14cbcf5272"</getetag>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
</multistatus>

View File

@ -0,0 +1,7 @@
#
# After creating the calendar we should be able to get any URLs
TYPE=PROPFIND
URL=http://mycaldav/caldav.php/user1/home/
HEADER=Depth: 1
HEADER=Content-Type: text/xml; charset=utf-8
HEAD

View File

@ -0,0 +1,6 @@
HTTP/1.1 412 Calendar Already Exists
Date: Dow, 01 Jan 2000 00:00:00 GMT
Server: Apache/2.2.3 (Debian) DAV/2
Content-Length: 0
Content-Type: text/html; charset=UTF-8

View File

@ -0,0 +1,6 @@
#
# So we should now make a calendar that we will use for some
# testing.
TYPE=MKCALENDAR
URL=http://mycaldav/caldav.php/user1/home/
HEAD

View File

@ -0,0 +1,7 @@
HTTP/1.1 201 Created
Date: Dow, 01 Jan 2000 00:00:00 GMT
Server: Apache/2.2.3 (Debian) DAV/2
ETag: "b000d7defa19ccb7cd21e546b54155ee"
Content-length: 0
Content-Type: text/html; charset=UTF-8

View File

@ -0,0 +1,7 @@
#
# We now have a calendar so we can PUT an event into it...
TYPE=PUT
URL=http://mycaldav/caldav.php/user1/home/F56B49B10FC923D20FE2DC92D6580340-0.ics
HEADER=Content-Type: text/calendar; charset=utf-8
HEAD
DATA=F56B49B10FC923D20FE2DC92D6580340-0.ics

View File

@ -0,0 +1,7 @@
HTTP/1.1 201 Replaced
Date: Dow, 01 Jan 2000 00:00:00 GMT
Server: Apache/2.2.3 (Debian) DAV/2
ETag: "b000d7defa19ccb7cd21e546b54155ee"
Content-length: 0
Content-Type: text/html; charset=UTF-8

View File

@ -0,0 +1,7 @@
#
# We now have a calendar so we can PUT an event into it...
TYPE=PUT
URL=http://mycaldav/caldav.php/user1/home/F56B49B10FC923D20FE2DC92D6580340-0.ics
HEADER=Content-Type: text/calendar; charset=utf-8
HEAD
DATA=F56B49B10FC923D20FE2DC92D6580340-0.ics

View File

@ -0,0 +1,32 @@
BEGIN:VCALENDAR
CALSCALE:GREGORIAN
PRODID:-//mulberrymail.com//Mulberry v4.0//EN
VERSION:2.0
X-WR-CALNAME:home
BEGIN:VTIMEZONE
LAST-MODIFIED:20040110T032845Z
TZID:New Zealand Standard Time
X-LIC-LOCATION:Pacific/Auckland
BEGIN:DAYLIGHT
DTSTART:20000404T020000
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
TZNAME:NZDT
TZOFFSETFROM:+1200
TZOFFSETTO:+1300
END:DAYLIGHT
BEGIN:STANDARD
DTSTART:20001026T020000
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=10
TZNAME:NZST
TZOFFSETFROM:+1300
TZOFFSETTO:+1200
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTAMP:20061025T101327Z
DTSTART;TZID=New Zealand Standard Time:20061025T091500
DURATION:PT1H
SUMMARY:A first event
UID:B18CBB57295D01D7661A6DD4@D76FAF7B10D9E8D2D41F779C
END:VEVENT
END:VCALENDAR