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 */ 22 #define BOOST_TEST_DYN_LINK 23 #define BOOST_TEST_MAIN 24 #define BOOST_TEST_MODULE unit 25 26 #ifdef HAVE_CONFIG_H 27 #include "config.h" 28 #endif 29 #include <boost/assign/list_of.hpp> 30 31 #include <boost/tuple/tuple.hpp> 32 #include "pdns/namespaces.hh" 33 #include "pdns/dns.hh" 34 #include "pdns/dnsbackend.hh" 35 #include "pdns/dnspacket.hh" 36 #include "pdns/pdnsexception.hh" 37 #include "pdns/logger.hh" 38 #include "pdns/arguments.hh" 39 #include "pdns/dnsrecords.hh" 40 #include "pdns/json.hh" 41 #include "pdns/statbag.hh" 42 #include "pdns/auth-packetcache.hh" 43 #include "pdns/auth-querycache.hh" 44 #include "pdns/auth-zonecache.hh" 45 46 StatBag S; 47 AuthPacketCache PC; 48 AuthQueryCache QC; 49 AuthZoneCache g_zoneCache; arg()50ArgvMap& arg() 51 { 52 static ArgvMap arg; 53 return arg; 54 }; 55 56 class RemoteLoader 57 { 58 public: 59 RemoteLoader(); 60 }; 61 62 DNSBackend* be; 63 64 #ifdef REMOTEBACKEND_ZEROMQ 65 #include <boost/test/unit_test.hpp> 66 67 struct RemotebackendSetup 68 { RemotebackendSetupRemotebackendSetup69 RemotebackendSetup() 70 { 71 be = 0; 72 try { 73 // setup minimum arguments 74 ::arg().set("module-dir") = "./.libs"; 75 new RemoteLoader(); 76 BackendMakers().launch("remote"); 77 // then get us a instance of it 78 ::arg().set("remote-connection-string") = "zeromq:endpoint=ipc:///tmp/remotebackend.0"; 79 ::arg().set("remote-dnssec") = "yes"; 80 be = BackendMakers().all()[0]; 81 // load few record types to help out 82 SOARecordContent::report(); 83 NSRecordContent::report(); 84 ARecordContent::report(); 85 } 86 catch (PDNSException& ex) { 87 BOOST_TEST_MESSAGE("Cannot start remotebackend: " << ex.reason); 88 }; 89 } ~RemotebackendSetupRemotebackendSetup90 ~RemotebackendSetup() {} 91 }; 92 93 BOOST_GLOBAL_FIXTURE(RemotebackendSetup); 94 95 #else 96 97 #include <iostream> 98 main(void)99int main(void) 100 { 101 std::cout << "No HTTP support in remotebackend - skipping test" << std::endl; 102 return 0; 103 } 104 105 #endif 106