Browse Source

[3688] Minor correction in the alloc_engine test.

Also, removed some whitespaces.
Marcin Siodelski 10 years ago
parent
commit
19fe872f8e
2 changed files with 5 additions and 3 deletions
  1. 2 2
      src/lib/dhcpsrv/host.cc
  2. 3 1
      src/lib/dhcpsrv/tests/alloc_engine4_unittest.cc

+ 2 - 2
src/lib/dhcpsrv/host.cc

@@ -84,8 +84,8 @@ Host::Host(const uint8_t* identifier, const size_t identifier_len,
     : hw_address_(), duid_(), ipv4_subnet_id_(ipv4_subnet_id),
     : hw_address_(), duid_(), ipv4_subnet_id_(ipv4_subnet_id),
       ipv6_subnet_id_(ipv6_subnet_id),
       ipv6_subnet_id_(ipv6_subnet_id),
       ipv4_reservation_(asiolink::IOAddress::IPV4_ZERO_ADDRESS()),
       ipv4_reservation_(asiolink::IOAddress::IPV4_ZERO_ADDRESS()),
-       hostname_(hostname), dhcp4_client_classes_(dhcp4_client_classes),
-       dhcp6_client_classes_(dhcp6_client_classes) {
+      hostname_(hostname), dhcp4_client_classes_(dhcp4_client_classes),
+      dhcp6_client_classes_(dhcp6_client_classes) {
 
 
     // Initialize HWAddr or DUID
     // Initialize HWAddr or DUID
     setIdentifier(identifier, identifier_len, identifier_type);
     setIdentifier(identifier, identifier_len, identifier_type);

+ 3 - 1
src/lib/dhcpsrv/tests/alloc_engine4_unittest.cc

@@ -1334,17 +1334,19 @@ TEST_F(AllocEngine4Test, reservedHostname) {
 
 
     // Try to allocate a lease.
     // Try to allocate a lease.
     AllocEngine::ClientContext4 ctx(subnet_, ClientIdPtr(), hwaddr_,
     AllocEngine::ClientContext4 ctx(subnet_, ClientIdPtr(), hwaddr_,
-                                    IOAddress::IPV4_ZERO_ADDRESS(), false, false,
+                                    IOAddress::IOAddress("192.0.2.109"), false, false,
                                     "foo.example.org", true);
                                     "foo.example.org", true);
     AllocEngine::findReservation(ctx);
     AllocEngine::findReservation(ctx);
     Lease4Ptr allocated_lease = engine.allocateLease4(ctx);
     Lease4Ptr allocated_lease = engine.allocateLease4(ctx);
     ASSERT_TRUE(allocated_lease);
     ASSERT_TRUE(allocated_lease);
     ASSERT_FALSE(allocated_lease->addr_.isV4Zero());
     ASSERT_FALSE(allocated_lease->addr_.isV4Zero());
+    ASSERT_EQ("192.0.2.109", allocated_lease->addr_.toText());
 
 
     ctx.requested_address_ = allocated_lease->addr_;
     ctx.requested_address_ = allocated_lease->addr_;
     ctx.fake_allocation_ = false;
     ctx.fake_allocation_ = false;
     allocated_lease = engine.allocateLease4(ctx);
     allocated_lease = engine.allocateLease4(ctx);
     ASSERT_TRUE(allocated_lease);
     ASSERT_TRUE(allocated_lease);
+    EXPECT_EQ("192.0.2.109", allocated_lease->addr_.toText());
 }
 }
 
 
 // This test checks that the AllocEngine::findReservation method finds
 // This test checks that the AllocEngine::findReservation method finds