Commit f5257881 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

built normal requests within the test code and avoid having a separate data file.


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac221@2303 e5f2f494-b856-4b98-b285-d166d9295462
parent 6f1e6e89
......@@ -75,6 +75,8 @@ protected:
vector<uint8_t> data;
void createDataFromFile(const char* const datafile);
void createRequest(const Opcode& opcode, const Name& request_name,
const RRClass& rrclass, const RRType& rrtype);
};
// These are flags to indicate whether the corresponding flag bit of the
......@@ -100,6 +102,21 @@ AuthSrvTest::createDataFromFile(const char* const datafile) {
IOSocket::getDummyUDPSocket(), *endpoint);
}
void
AuthSrvTest::createRequest(const Opcode& opcode, const Name& request_name,
const RRClass& rrclass, const RRType& rrtype)
{
request_message.setOpcode(opcode);
request_message.addQuestion(Question(request_name, rrclass, rrtype));
request_message.toWire(request_renderer);
delete io_message;
endpoint = IOEndpoint::create(IPPROTO_UDP, IOAddress("192.0.2.1"), 5300);
io_message = new IOMessage(request_renderer.getData(),
request_renderer.getLength(),
IOSocket::getDummyUDPSocket(), *endpoint);
}
void
headerCheck(const Message& message, const qid_t qid, const Rcode& rcode,
const uint16_t opcodeval, const unsigned int flags,
......@@ -246,15 +263,13 @@ TEST_F(AuthSrvTest, ednsBadVers) {
// notify-in teset.
TEST_F(AuthSrvTest, notifyInTest) {
createDataFromFile("notifyin_fromwire");
createRequest(Opcode::NOTIFY(), Name("example.com"), RRClass::IN(),
RRType::SOA());
parse_message.clear(Message::PARSE);
EXPECT_EQ(false, server.processMessage(*io_message, parse_message,
response_renderer));
//headerCheck(parse_message, default_qid, Rcode::SERVFAIL(), Opcode::NOTIFY().getCode(), QR_FLAG,
// 1, 0, 0, 0);
response_renderer));
}
void
updateConfig(AuthSrv* server, const char* const dbfile,
const bool expect_success)
......
###
### This data file was auto-generated from simplequery_fromWire.spec
###
# Header Section
# ID=4149 QR=Query Opcode=NOTIFY(4) Rcode=NOERROR(0)
1035 2400
# QDCNT=1, ANCNT=0, NSCNT=0, ARCNT=0
0001 0000 0000 0000
# Question Section
# QNAME=example.com. QTYPE=SOA(6) QCLASS=IN(1)
076578616d706c6503636f6d00 0006 0001
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment