From b371f1052ffbb42e3fbebda4af11f10d66a59fa7 Mon Sep 17 00:00:00 2001
From: Elvin Sindrilaru <esindril@cern.ch>
Date: Tue, 12 Feb 2019 04:42:46 +0100
Subject: [PATCH] UNIT_TEST: Check that the helper doesn't allocate a new id
 when the xrd connection pool is disabled

---
 unit_tests/common/XrdConnPoolTests.cc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/unit_tests/common/XrdConnPoolTests.cc b/unit_tests/common/XrdConnPoolTests.cc
index 2ba2091257..54936efaa4 100644
--- a/unit_tests/common/XrdConnPoolTests.cc
+++ b/unit_tests/common/XrdConnPoolTests.cc
@@ -36,6 +36,11 @@ TEST(XrdConnPool, DefaultDisabled)
   eos::common::XrdConnPool pool;
   ASSERT_EQ(pool.AssignConnection(url), 0);
   ASSERT_EQ(url.GetURL(), surl);
+  // No id should be allocated and the url should stay the same
+  eos::common::XrdConnIdHelper id_helper(pool, url);
+  ASSERT_EQ(id_helper.GetId(), 0);
+  ASSERT_FALSE(id_helper.HasNewConnection());
+  ASSERT_EQ(url.GetURL(), surl);
 }
 
 TEST(XrdConnPool, EvenDistribuion)
@@ -94,6 +99,7 @@ TEST(XrdConnPool, ConnIdHelper)
   // Each gets the same id since it's released at the end of each loop
   for (uint32_t i = 0; i < max_size; ++i) {
     XrdConnIdHelper id_helper(pool, url);
+    ASSERT_TRUE(id_helper.HasNewConnection());
     ASSERT_EQ(id_helper.GetId(), 1);
   }
 
-- 
GitLab