# This file is part of vmod-dbrw -*- autotest -*- # Copyright (C) 2013-2018 Sergey Poznyakoff # # Vmod-dbrw is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Vmod-dbrw is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with vmod-dbrw. If not, see . m4_define([AT_DBRW_INITDB],[ AT_CHECK([ rm -f $FAILFILE $INITFILE AT_DBCRED_PREREQ initdb -c $DBRW_TEST_DBTYPE "$DBRW_TEST_PARAMS" 2>err <<'EOT' DROP TABLE IF EXISTS redirects; CREATE TABLE redirects ( host varchar(255) NOT NULL DEFAULT '', url varchar(255) NOT NULL DEFAULT '', dest varchar(255) DEFAULT NULL, PRIMARY KEY (host,url) ); INSERT INTO redirects VALUES ('en.example.net','/local','http://uno.example.com/remote'), ('to.example.net','/user','http://dos.example.com/var'); DROP TABLE IF EXISTS rewrite; CREATE TABLE rewrite ( host varchar(255) NOT NULL DEFAULT '', url varchar(255) NOT NULL DEFAULT '', dest varchar(255) DEFAULT NULL, value varchar(255) DEFAULT NULL, pattern varchar(255) DEFAULT NULL, flags varchar(64) DEFAULT NULL ); CREATE INDEX source ON rewrite(host,url); INSERT INTO rewrite VALUES ('en.example.net','/local','http://uno.example.com/remote',NULL,NULL,'eq'), ('en.example.net','/local','http://dos.example.com/$[]1','$url','/local/(.*)',NULL), ('en.example.net','/local2','http://to.example.net/$[]1$[]2','$url','/local2/([[^\\?]]*)(\\?.*)?',NULL), ('to.example.net','/local','http://dos.example.net/$[]1','$url','/local/(.*)','QSA'), ('tre.example.net','/local','http://dos.example.net/$[]1?i=10','$url','/local/(.*)','QSA,R=302'); EOT ], [0], [], [], [mv err $FAILFILE], [echo "OK" > $INITFILE]) ])