]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5437] Corrected unit tests for classes in pools within shared network.
authorMarcin Siodelski <marcin@isc.org>
Mon, 26 Feb 2018 16:03:45 +0000 (17:03 +0100)
committerMarcin Siodelski <marcin@isc.org>
Mon, 26 Feb 2018 16:03:45 +0000 (17:03 +0100)
src/lib/dhcpsrv/tests/alloc_engine4_unittest.cc

index 922ee88f5cb5aef1cc2dfec1b0fc508dec3882be..eb557f5bf569560b03fcda0bcb58e4506d0b4a40 100644 (file)
@@ -745,6 +745,10 @@ TEST_F(SharedNetworkAlloc4Test, discoverSharedNetworkPoolClassification) {
     // offer an address from the pool1.
     ctx.query_->addClass(ClientClass("cable-modem"));
 
+    // Restrict access to pool2 for this client, to make sure that the
+    // server doesn't accidentally get an address from this pool.
+    pool2_->allowClientClass("telephone");
+
     ctx.subnet_ = subnet1_;
     lease = engine_.allocateLease4(ctx);
     ASSERT_TRUE(lease);
@@ -986,6 +990,10 @@ TEST_F(SharedNetworkAlloc4Test, requestSharedNetworkPoolClassification) {
     // offer an address from the pool1.
     ctx.query_->addClass(ClientClass("cable-modem"));
 
+    // Restrict access to pool2 for this client, to make sure that the
+    // server doesn't accidentally get an address from this pool.
+    pool2_->allowClientClass("telephone");
+
     ctx.subnet_ = subnet1_;
     lease = engine_.allocateLease4(ctx);
     ASSERT_TRUE(lease);
@@ -994,8 +1002,9 @@ TEST_F(SharedNetworkAlloc4Test, requestSharedNetworkPoolClassification) {
     // Let's now remove the client from the cable-modem class and try
     // to renew the address. The engine should determine that the
     // client doesn't have access to the pool1 anymore and
-    // assign an address from unrestricted pool.
+    // assign an address from another pool.
     ctx.query_.reset(new Pkt4(DHCPREQUEST, 1234));
+    ctx.query_->addClass(ClientClass("telephone"));
     ctx.subnet_ = subnet1_;
     lease = engine_.allocateLease4(ctx);
     ASSERT_TRUE(lease);