]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3636] Fixes for the failing unit tests.
authorMarcin Siodelski <marcin@isc.org>
Fri, 16 Jan 2015 15:38:51 +0000 (16:38 +0100)
committerMarcin Siodelski <marcin@isc.org>
Fri, 16 Jan 2015 15:38:51 +0000 (16:38 +0100)
src/bin/dhcp4/tests/fqdn_unittest.cc
src/lib/dhcp_ddns/ncr_msg.cc

index da9e91856ec458822060fce791da734ee61db8f3..f1f4f9fc37f76c357757ce48427c99595c7bfb5c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -136,10 +136,15 @@ public:
     /// names are correct.
     ///
     /// @param addr IP address used in the lease.
+    /// @param trailing_dot A boolean flag which indicates whether the
+    /// trailing dot should be appended to the end of the hostname.
+    /// The defatult value is "true" which means that it should.
     ///
     /// @return An std::string contained the generated FQDN.
-    std::string generatedNameFromAddress(const IOAddress& addr) {
-        return(CfgMgr::instance().getD2ClientMgr().generateFqdn(addr,true));
+    std::string generatedNameFromAddress(const IOAddress& addr,
+                                         const bool trailing_dot = true) {
+        return(CfgMgr::instance().getD2ClientMgr()
+               .generateFqdn(addr, trailing_dot));
     }
 
     // Get the Client FQDN Option from the given message.
@@ -617,7 +622,7 @@ TEST_F(NameDhcpv4SrvTest, serverUpdateUnqualifiedHostname) {
     ASSERT_NO_THROW(hostname =  processHostname(query));
 
     ASSERT_TRUE(hostname);
-    EXPECT_EQ("myhost.example.com.", hostname->getValue());
+    EXPECT_EQ("myhost.example.com", hostname->getValue());
 
 }
 
index b124891b9a78a115d1f66d9202a81b9c5675a3ed..d69fae52b2fd71bd38098b49714def8c59eaeb6a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013, 2015 Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -220,6 +220,9 @@ NameChangeRequest::NameChangeRequest(const NameChangeType change_type,
     dhcid_(dhcid), lease_expires_on_(lease_expires_on),
     lease_length_(lease_length), status_(ST_NEW) {
 
+    // User setter to validate fqdn.
+    setFqdn(fqdn);
+
     // User setter to validate address.
     setIpAddress(ip_address);