mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-01-27 00:33:34 +00:00
Remove tests related to memcache, add BPS to copyright
I re-used some of the test LDAP logic from the test suite of Request Tracker by BPS.
This commit is contained in:
parent
353a2d1b13
commit
30b05549d0
@ -301,8 +301,7 @@ test_memcache:
|
||||
- mkdir -p davical_log
|
||||
- cp -r /var/log/davical davical_log/test_memcache
|
||||
|
||||
# Only test if the memcache test passes
|
||||
test_memcache_and_ldap:
|
||||
test_ldap:
|
||||
stage: testldap
|
||||
image: debian:unstable
|
||||
artifacts:
|
||||
@ -321,8 +320,7 @@ test_memcache_and_ldap:
|
||||
- echo "en_NZ.UTF-8 UTF-8" >> /etc/locale.gen
|
||||
- locale-gen
|
||||
- echo "LANG=en_NZ.UTF-8" > /etc/default/locale
|
||||
- apt-get -y install libdbd-pg-perl libyaml-perl php php-cli php-pgsql php-xml php-memcached php-ldap postgresql-client postgresql libapache2-mod-php curl xmlstarlet memcached libnet-ldap-server-test-perl netcat-openbsd
|
||||
- phpenmod memcached
|
||||
- apt-get -y install libdbd-pg-perl libyaml-perl php php-cli php-pgsql php-xml php-ldap postgresql-client postgresql libapache2-mod-php curl xmlstarlet libnet-ldap-server-test-perl netcat-openbsd
|
||||
- phpenmod ldap
|
||||
- curl 'https://gitlab.com/davical-project/awl/-/archive/master/awl-master.tar.gz' | tar zxf -
|
||||
- mv awl-master /usr/share/awl/
|
||||
@ -349,14 +347,13 @@ test_memcache_and_ldap:
|
||||
- a2enmod rewrite
|
||||
- a2enmod headers
|
||||
- apache2ctl start
|
||||
- /etc/init.d/memcached start
|
||||
- useradd testrunner
|
||||
# testrunner needs to be able to read /var/log/apache2/regression-error.log for the ldap tests.
|
||||
- adduser testrunner adm
|
||||
- cd testing && su testrunner -c 'IS_CI=yes ALLSUITES="ldap" ./run_regressions.sh all x'
|
||||
after_script:
|
||||
- mkdir -p apache2_log
|
||||
- cp -r /var/log/apache2 apache2_log/test_memcache_and_ldap
|
||||
- cp -r /var/log/apache2 apache2_log/test_ldap
|
||||
- xz apache2_log/test_memcache_and_ldap/*
|
||||
- mkdir -p davical_log
|
||||
- cp -r /var/log/davical davical_log/test_memcache_and_ldap
|
||||
- cp -r /var/log/davical davical_log/test_ldap
|
||||
|
||||
@ -1 +0,0 @@
|
||||
OK
|
||||
@ -1,3 +0,0 @@
|
||||
# Ensure that memcached has nothing cached.
|
||||
|
||||
SCRIPT=echo flush_all | nc -N 127.0.0.1 11211
|
||||
@ -1,3 +1,7 @@
|
||||
# Copyright (c) 2021-2024 Andrew Ruthven <andrew@etc.gen.nz>
|
||||
# Portions Copyright (c) Best Practical Solutions, LLC
|
||||
# <sales@bestpractical.com>, licensed under the GPL v2.
|
||||
#
|
||||
BEGINPERL
|
||||
if ($debug) { $ENV{'LDAP_DEBUG'} = 1 };
|
||||
|
||||
@ -21,18 +25,33 @@ $evaled{'ldap_server'} = Net::LDAP::Server::Test->new( $ldap_socket, auto_schema
|
||||
|
||||
my $ldap = Net::LDAP->new("localhost:$ldap_port") || die "Failed to instantiate Net::LDAP: $!";
|
||||
$ldap->bind();
|
||||
my $username = "ldap1";
|
||||
my $base = "dc=example,dc=com";
|
||||
my $dn = "uid=$username,$base";
|
||||
my $entry = {
|
||||
cn => $username,
|
||||
mail => "$username\@example.com",
|
||||
uid => $username,
|
||||
objectClass => 'User',
|
||||
userPassword => 'ldap1',
|
||||
};
|
||||
my $base = "dc=example,dc=com";
|
||||
my $users = "ou=users,$base";
|
||||
my $groups = "ou=groups,$base";
|
||||
$ldap->add( $base );
|
||||
$ldap->add( $dn, attr => [%$entry] );
|
||||
|
||||
for my $username (qw/ldap1 ldap2/) {
|
||||
my $dn = "uid=$username,$users";
|
||||
my $entry = {
|
||||
cn => $username,
|
||||
mail => "$username\@example.com",
|
||||
uid => $username,
|
||||
objectClass => 'User',
|
||||
userPassword => $username,
|
||||
};
|
||||
$ldap->add( $dn, attr => [%$entry] );
|
||||
}
|
||||
|
||||
for my $group (qw/group1 group2/) {
|
||||
my $dn = "cn=$group,$groups";
|
||||
(my $member = $group) =~ s/group/ldap/;
|
||||
my $entry = {
|
||||
cn => $group,
|
||||
objectClass => 'groupofNames',
|
||||
member => "cn=$member,$users",
|
||||
};
|
||||
$ldap->add( $dn, attr => [%$entry] );
|
||||
}
|
||||
|
||||
# We need to keep the client around, otherwise the test server will exit.
|
||||
$evaled{'ldap_client'} = $ldap;
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
No cached credentials found - no salt
|
||||
No cached credentials found
|
||||
@ -1,4 +0,0 @@
|
||||
# Make sure there are no cached credentials present.
|
||||
SCRIPT=if [ $(grep "HTTPAuthLogin:CheckCache: No salt stored for ldap1" /var/log/apache2/regression-error.log | wc -l) -eq 1 ] ; then echo "No cached credentials found" - no salt; else echo "Cached credentials, salt present, failed"; fi
|
||||
SCRIPT=if [ $(grep "HTTPAuthLogin:CheckCache: Cached credentials for ldap1 are good" /var/log/apache2/regression-error.log | wc -l) -eq 0 ] ; then echo "No cached credentials found"; else echo "Cached credentials, failed"; fi
|
||||
|
||||
@ -1,67 +0,0 @@
|
||||
HTTP/1.1 207 Multi-Status
|
||||
Date: Dow, 01 Jan 2000 00:00:00 GMT
|
||||
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
|
||||
DAV: extended-mkcol, bind, addressbook, calendar-auto-schedule, calendar-proxy
|
||||
ETag: "ed58709591152964fd4a584af5b55d79"
|
||||
Content-Length: 942
|
||||
Content-Type: text/xml; charset="utf-8"
|
||||
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<multistatus xmlns="DAV:">
|
||||
<response>
|
||||
<href>/caldav.php/</href>
|
||||
<propstat>
|
||||
<prop>
|
||||
<resourcetype>
|
||||
<collection/>
|
||||
</resourcetype>
|
||||
</prop>
|
||||
<status>HTTP/1.1 200 OK</status>
|
||||
</propstat>
|
||||
</response>
|
||||
<response>
|
||||
<href>/caldav.php/resource1/</href>
|
||||
<propstat>
|
||||
<prop>
|
||||
<resourcetype>
|
||||
<collection/>
|
||||
<principal/>
|
||||
</resourcetype>
|
||||
</prop>
|
||||
<status>HTTP/1.1 200 OK</status>
|
||||
</propstat>
|
||||
</response>
|
||||
<response>
|
||||
<href>/caldav.php/resource2/</href>
|
||||
<propstat>
|
||||
<prop>
|
||||
<resourcetype>
|
||||
<collection/>
|
||||
<principal/>
|
||||
</resourcetype>
|
||||
</prop>
|
||||
<status>HTTP/1.1 200 OK</status>
|
||||
</propstat>
|
||||
</response>
|
||||
<response>
|
||||
<href>/caldav.php/ldap1/</href>
|
||||
<propstat>
|
||||
<prop>
|
||||
<resourcetype>
|
||||
<collection/>
|
||||
<principal/>
|
||||
</resourcetype>
|
||||
</prop>
|
||||
<status>HTTP/1.1 200 OK</status>
|
||||
</propstat>
|
||||
</response>
|
||||
</multistatus>
|
||||
|
||||
active: >1<
|
||||
email: >ldap1@example.com<
|
||||
fullname: >ldap1<
|
||||
last_used: >NULL<
|
||||
password: >NULL<
|
||||
user_no: >1001<
|
||||
username: >ldap1<
|
||||
|
||||
@ -1 +0,0 @@
|
||||
0001-test-ldap.test
|
||||
@ -1 +0,0 @@
|
||||
Cached credentials found
|
||||
@ -1,5 +0,0 @@
|
||||
# Check to see if the log line for cached credentials being valid is
|
||||
# present. That is only issued if we're successfully fetch valid credentials
|
||||
# from our cache.
|
||||
SCRIPT=if [ $(grep "HTTPAuthLogin:CheckCache: Cached credentials for ldap1 are good" /var/log/apache2/regression-error.log | wc -l) -eq 1 ] ; then echo "Cached credentials found"; else echo "Cached credentials failed"; fi
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
No cached credentials found - no salt
|
||||
No cached credentials found
|
||||
@ -1,4 +0,0 @@
|
||||
# Make sure there are no cached credentials present.
|
||||
SCRIPT=if [ $(grep "HTTPAuthLogin:CheckCache: No salt stored for ldap2" /var/log/apache2/regression-error.log | wc -l) -eq 1 ] ; then echo "No cached credentials found - no salt"; else echo "Cached credentials, present, failed"; fi
|
||||
SCRIPT=if [ $(grep "HTTPAuthLogin:CheckCache: Cached credentials for ldap2" /var/log/apache2/regression-error.log | wc -l) -eq 0 ] ; then echo "No cached credentials found"; else echo "Cached credentials, failed"; fi
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
HTTP/1.1 401 Unauthorized
|
||||
Date: Dow, 01 Jan 2000 00:00:00 GMT
|
||||
WWW-Authenticate: Basic realm="DAViCal CalDAV Server"
|
||||
Content-Length: 40
|
||||
Content-Type: text/plain; ; charset="utf-8"
|
||||
|
||||
Please log in for access to this system.
|
||||
@ -1,66 +0,0 @@
|
||||
# Test again for an invalid user to check that the failed credentials are
|
||||
# cached.
|
||||
BEGINPERL
|
||||
if ($debug) { $ENV{'LDAP_DEBUG'} = 1 };
|
||||
|
||||
use Net::LDAP::Server::Test;
|
||||
use Net::LDAP;
|
||||
use IO::Socket::INET;
|
||||
|
||||
#my $port = find_idle_port();
|
||||
|
||||
#my $ldap_port = RT::Test->find_idle_port;
|
||||
my $ldap_port = 21394;
|
||||
my $ldap_socket = IO::Socket::INET->new(
|
||||
Listen => 5,
|
||||
Proto => 'tcp',
|
||||
Reuse => 1,
|
||||
LocalPort => $ldap_port,
|
||||
);
|
||||
|
||||
# Keep it around after this block exits.
|
||||
$evaled{'ldap_server'} = Net::LDAP::Server::Test->new( $ldap_socket, auto_schema => 1 );
|
||||
|
||||
my $ldap = Net::LDAP->new("localhost:$ldap_port") || die "Failed to instantiate Net::LDAP: $!";
|
||||
$ldap->bind();
|
||||
my $username = "ldap1";
|
||||
my $base = "dc=example,dc=com";
|
||||
my $dn = "uid=$username,$base";
|
||||
my $entry = {
|
||||
cn => $username,
|
||||
mail => "$username\@example.com",
|
||||
uid => $username,
|
||||
objectClass => 'User',
|
||||
userPassword => 'ldap1',
|
||||
};
|
||||
$ldap->add( $base );
|
||||
$ldap->add( $dn, attr => [%$entry] );
|
||||
|
||||
# We need to keep the client around, otherwise the test server will exit.
|
||||
$evaled{'ldap_client'} = $ldap;
|
||||
#sleep 100;
|
||||
ENDPERL
|
||||
|
||||
TYPE=PROPFIND
|
||||
URL=http://regression_ldap.host/caldav.php/
|
||||
HEADER=Content-Type: text/xml
|
||||
HEADER=Depth: 1
|
||||
AUTH=ldap2:ldap2
|
||||
HEAD
|
||||
|
||||
BEGINDATA
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<D:propfind xmlns:D="DAV:">
|
||||
<D:prop>
|
||||
<D:resourcetype/>
|
||||
</D:prop>
|
||||
</D:propfind>
|
||||
ENDDATA
|
||||
|
||||
# Check that no usr record has been created.
|
||||
QUERY
|
||||
SELECT active, email, fullname, last_used, password, username, user_no
|
||||
FROM usr
|
||||
WHERE username = 'ldap2';
|
||||
ENDQUERY
|
||||
|
||||
@ -1 +0,0 @@
|
||||
Cached credentials found, password incorrect
|
||||
@ -1,5 +0,0 @@
|
||||
# Check to see if the log line for cached credentials being invalid is
|
||||
# present. That is only issued if we've fetch a fail for the credentials
|
||||
# from our cache.
|
||||
SCRIPT=if [ $(grep "HTTPAuthLogin:CheckCache: Cached credentials for ldap2 are good and invalid" /var/log/apache2/regression-error.log | wc -l) -eq 1 ] ; then echo "Cached credentials found, password incorrect"; else echo "Cached credentials failed"; fi
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user