IMPALA-5108: Followup change to do the cleanup.

This change involves giving names to constant values
to improve readability of test program.

Change-Id: I521e7e493e4ae26e1955861637cd31f5f678dd0b
Reviewed-on: http://gerrit.cloudera.org:8080/7801
Reviewed-by: Dan Hecht <[email protected]>
Tested-by: Impala Public Jenkins


Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/260a9725
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/260a9725
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/260a9725

Branch: refs/heads/master
Commit: 260a97256f0aae47bbba56fa2a08c6f4c63d1e1d
Parents: 59d1aa6
Author: Pranay <[email protected]>
Authored: Wed Aug 23 21:57:50 2017 -0700
Committer: Impala Public Jenkins <[email protected]>
Committed: Tue Aug 29 01:28:02 2017 +0000

----------------------------------------------------------------------
 be/src/service/session-expiry-test.cc | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/260a9725/be/src/service/session-expiry-test.cc
----------------------------------------------------------------------
diff --git a/be/src/service/session-expiry-test.cc 
b/be/src/service/session-expiry-test.cc
index a0a493c..fa69476 100644
--- a/be/src/service/session-expiry-test.cc
+++ b/be/src/service/session-expiry-test.cc
@@ -42,7 +42,7 @@ DECLARE_int32(beeswax_port);
 // that doesn't depend upon being rescheduled in a timely fashion.
 
 TEST(SessionTest, TestExpiry) {
-  const int NUM_CLIENTS = 5;
+  const int NUM_SESSIONS = 5;
   const int MAX_IDLE_TIMEOUT_MS = 4000;
   FLAGS_idle_session_timeout = 1;
   InProcessStatestore* ips = InProcessStatestore::StartWithEphemeralPorts();
@@ -62,11 +62,11 @@ TEST(SessionTest, TestExpiry) {
   EXPECT_EQ(beeswax_session_metric->value(), 0L);
 
   {
-    scoped_ptr<ThriftClient<ImpalaServiceClient>> beeswax_clients[NUM_CLIENTS];
-    scoped_ptr<ThriftClient<ImpalaHiveServer2ServiceClient>> 
hs2_clients[NUM_CLIENTS];
+    scoped_ptr<ThriftClient<ImpalaServiceClient>> 
beeswax_clients[NUM_SESSIONS];
+    scoped_ptr<ThriftClient<ImpalaHiveServer2ServiceClient>> 
hs2_clients[NUM_SESSIONS];
 
     // Create five Beeswax clients and five HS2 clients (each HS2 gets one 
session each)
-    for (int i = 0; i < NUM_CLIENTS; ++i) {
+    for (int i = 0; i < NUM_SESSIONS; ++i) {
       beeswax_clients[i].reset(new ThriftClient<ImpalaServiceClient>(
               "localhost", impala->beeswax_port()));
       EXPECT_OK(beeswax_clients[i]->Open());
@@ -80,14 +80,16 @@ TEST(SessionTest, TestExpiry) {
     }
 
     int64_t start = UnixMillis();
-    while (expired_metric->value() != 10 && UnixMillis() - start < 
MAX_IDLE_TIMEOUT_MS) {
+    while (expired_metric->value() != NUM_SESSIONS * 2 &&
+      UnixMillis() - start < MAX_IDLE_TIMEOUT_MS) {
       SleepForMs(100);
     }
 
-    ASSERT_EQ(expired_metric->value(), 10L) << "Sessions did not expire within 
5s";
-    ASSERT_EQ(beeswax_session_metric->value(), 5L)
+    ASSERT_EQ(expired_metric->value(), NUM_SESSIONS * 2)
+        << "Sessions did not expire within "<< MAX_IDLE_TIMEOUT_MS / 1000 <<" 
secs";
+    ASSERT_EQ(beeswax_session_metric->value(), NUM_SESSIONS)
         << "Beeswax sessions unexpectedly closed after expiration";
-    ASSERT_EQ(hs2_session_metric->value(), 5L)
+    ASSERT_EQ(hs2_session_metric->value(), NUM_SESSIONS)
         << "HiveServer2 sessions unexpectedly closed after expiration";
 
     TPingImpalaServiceResp resp;

Reply via email to