]>
Commit | Line | Data |
---|---|---|
12471842 PL |
1 | /* |
2 | * This file is part of PowerDNS or dnsdist. | |
3 | * Copyright -- PowerDNS.COM B.V. and its contributors | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify | |
6 | * it under the terms of version 2 of the GNU General Public License as | |
7 | * published by the Free Software Foundation. | |
8 | * | |
9 | * In addition, for the avoidance of any doubt, permission is granted to | |
10 | * link this program with OpenSSL and to (re)distribute the binaries | |
11 | * produced as the result of such linking. | |
12 | * | |
13 | * This program is distributed in the hope that it will be useful, | |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | * GNU General Public License for more details. | |
17 | * | |
18 | * You should have received a copy of the GNU General Public License | |
19 | * along with this program; if not, write to the Free Software | |
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
21 | */ | |
663fedf9 AT |
22 | #define BOOST_TEST_DYN_LINK |
23 | #define BOOST_TEST_MAIN | |
24 | #define BOOST_TEST_MODULE unit | |
25 | ||
870a0fe4 AT |
26 | #ifdef HAVE_CONFIG_H |
27 | #include "config.h" | |
28 | #endif | |
663fedf9 AT |
29 | #include <boost/test/unit_test.hpp> |
30 | #include <boost/assign/list_of.hpp> | |
fa8fd4d2 | 31 | |
663fedf9 AT |
32 | #include <boost/tuple/tuple.hpp> |
33 | #include "pdns/namespaces.hh" | |
21e99384 RK |
34 | #include "pdns/dns.hh" |
35 | #include "pdns/dnsbackend.hh" | |
36 | #include "pdns/dnspacket.hh" | |
21e99384 RK |
37 | #include "pdns/pdnsexception.hh" |
38 | #include "pdns/logger.hh" | |
39 | #include "pdns/arguments.hh" | |
663fedf9 | 40 | #include "pdns/dnsrecords.hh" |
93278d2a | 41 | #include "pdns/json.hh" |
663fedf9 | 42 | #include "pdns/statbag.hh" |
bf269e28 RG |
43 | #include "pdns/auth-packetcache.hh" |
44 | #include "pdns/auth-querycache.hh" | |
663fedf9 AT |
45 | |
46 | StatBag S; | |
bf269e28 RG |
47 | AuthPacketCache PC; |
48 | AuthQueryCache QC; | |
663fedf9 AT |
49 | ArgvMap &arg() |
50 | { | |
51 | static ArgvMap arg; | |
52 | return arg; | |
53 | }; | |
54 | ||
55 | class RemoteLoader | |
56 | { | |
57 | public: | |
58 | RemoteLoader(); | |
59 | }; | |
60 | ||
61 | DNSBackend *be; | |
62 | ||
63 | struct RemotebackendSetup { | |
64 | RemotebackendSetup() { | |
65 | be = 0; | |
66 | try { | |
67 | // setup minimum arguments | |
74caf870 | 68 | ::arg().set("module-dir")="./.libs"; |
663fedf9 AT |
69 | new RemoteLoader(); |
70 | BackendMakers().launch("remote"); | |
71 | // then get us a instance of it | |
72 | ::arg().set("remote-connection-string")="unix:path=/tmp/remotebackend.sock"; | |
73 | ::arg().set("remote-dnssec")="yes"; | |
74 | be = BackendMakers().all()[0]; | |
75 | // load few record types to help out | |
76 | SOARecordContent::report(); | |
77 | NSRecordContent::report(); | |
78 | ARecordContent::report(); | |
3f81d239 | 79 | } catch (PDNSException &ex) { |
663fedf9 AT |
80 | BOOST_TEST_MESSAGE("Cannot start remotebackend: " << ex.reason ); |
81 | }; | |
82 | } | |
83 | ~RemotebackendSetup() { } | |
84 | }; | |
85 | ||
86 | BOOST_GLOBAL_FIXTURE( RemotebackendSetup ); | |
87 |