This is an automated email from the ASF dual-hosted git repository.

bankim pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 78bd6c04ef37ca8906379a587140bc646433e28c
Author: Bankim Bhavsar <[email protected]>
AuthorDate: Fri Feb 12 10:26:24 2021 -0800

    [test] Start using GTEST_SKIP where applicable
    
    Use the GTEST_SKIP() macro in SKIP_IF_SLOW_NOT_ALLOWED()
    instead of early return so that test is marked
    as SKIPPED instead of PASSED.
    
    Replace instances where macro SKIP_IF_SLOW_NOT_ALLOWED()
    is not used.
    
    Use the GTEST_SKIP macro for a crypto test that is skipped
    in FIPS mode.
    
    On the dist-test UI, verified a skipped test is marked as
    "successful" so no negative impact and same as earlier
    but the test doesn't get marked as "skipped" or such.
    Marking a test as skipped will require separate change to the
    dist-test UI.
    
    Sample output when tests are skipped:
    
    [----------] Global test environment tear-down
    [==========] 18 tests from 4 test suites ran. (27888 ms total)
    [  PASSED  ] 14 tests.
    [  SKIPPED ] 4 tests, listed below:
    [  SKIPPED ] ParameterizedAddMasterTest.TestAddMasterCatchupFromWAL/0
    [  SKIPPED ] ParameterizedAddMasterTest.TestAddMasterCatchupFromWAL/1
    [  SKIPPED ] ParameterizedAddMasterTest.TestAddMasterSysCatalogCopy/0
    [  SKIPPED ] ParameterizedAddMasterTest.TestAddMasterSysCatalogCopy/1
    
    Change-Id: I4466bdde3965921d527131e76ad221643ff05705
    Reviewed-on: http://gerrit.cloudera.org:8080/17063
    Tested-by: Kudu Jenkins
    Reviewed-by: Alexey Serbin <[email protected]>
---
 src/kudu/client/client-test.cc                     | 10 +---
 src/kudu/fs/block_manager-test.cc                  |  5 +-
 src/kudu/integration-tests/alter_table-test.cc     |  5 +-
 .../integration-tests/auth_token_expire-itest.cc   | 16 ++-----
 .../client-negotiation-failover-itest.cc           |  6 +--
 .../consensus_peer_health_status-itest.cc          |  5 +-
 src/kudu/integration-tests/create-table-itest.cc   |  5 +-
 .../integration-tests/create-table-stress-test.cc  | 15 ++----
 src/kudu/integration-tests/delete_table-itest.cc   | 11 +----
 .../integration-tests/location_assignment-itest.cc | 11 +----
 .../master_cert_authority-itest.cc                 |  6 +--
 .../integration-tests/master_failover-itest.cc     | 21 ++-------
 .../integration-tests/open-readonly-fs-itest.cc    |  2 +-
 .../integration-tests/raft_config_change-itest.cc  |  6 +--
 src/kudu/integration-tests/raft_consensus-itest.cc | 13 ++---
 .../raft_consensus_failure_detector-imc-itest.cc   |  6 +--
 .../raft_consensus_nonvoter-itest.cc               | 50 ++++----------------
 .../raft_consensus_stress-itest.cc                 |  5 +-
 .../integration-tests/security-faults-itest.cc     | 11 +----
 .../security-unknown-tsk-itest.cc                  |  6 +--
 src/kudu/integration-tests/tablet_copy-itest.cc    | 22 ++-------
 .../tablet_copy_client_session-itest.cc            | 10 +---
 .../integration-tests/tablet_replacement-itest.cc  | 17 ++-----
 src/kudu/integration-tests/token_signer-itest.cc   |  6 +--
 .../tombstoned_voting-imc-itest.cc                 |  8 ++--
 .../tombstoned_voting-stress-test.cc               |  2 +-
 src/kudu/integration-tests/ts_recovery-itest.cc    |  2 +-
 src/kudu/security/crypto-test.cc                   |  5 +-
 src/kudu/security/token-test.cc                    |  5 +-
 src/kudu/tablet/compaction-test.cc                 | 10 +---
 src/kudu/tablet/compaction_policy-test.cc          |  5 +-
 src/kudu/tools/ksck_remote-test.cc                 |  5 +-
 src/kudu/tools/kudu-admin-test.cc                  |  5 +-
 src/kudu/tools/rebalancer_tool-test.cc             | 55 +++++-----------------
 src/kudu/util/monotime-test.cc                     |  5 +-
 src/kudu/util/test_util.h                          |  2 +-
 src/kudu/util/thread-test.cc                       | 11 +----
 37 files changed, 86 insertions(+), 304 deletions(-)

diff --git a/src/kudu/client/client-test.cc b/src/kudu/client/client-test.cc
index 62d16b7..d210765 100644
--- a/src/kudu/client/client-test.cc
+++ b/src/kudu/client/client-test.cc
@@ -3861,10 +3861,7 @@ class FlushModeOpRatesTest : public ClientTest,
 // in AUTO_FLUSH and AUTO_FLUSH_BACKGROUND mode; all the operations have
 // the same pre-defined size.
 TEST_P(FlushModeOpRatesTest, RunComparison) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const size_t kBufferSizeBytes = 1024;
   const size_t kRowNum = 256;
@@ -5246,10 +5243,7 @@ shared_ptr<KuduSession> LoadedSession(const 
shared_ptr<KuduClient>& client,
 // half update rows in descending order.
 // This ensures that we don't hit a deadlock in such a situation.
 TEST_F(ClientTest, TestDeadlockSimulation) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "TestDeadlockSimulation disabled since slow.";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   // Make reverse client who will make batches that update rows
   // in reverse order. Separate client used so rpc calls come in at same time.
diff --git a/src/kudu/fs/block_manager-test.cc 
b/src/kudu/fs/block_manager-test.cc
index 0064c31..588f091 100644
--- a/src/kudu/fs/block_manager-test.cc
+++ b/src/kudu/fs/block_manager-test.cc
@@ -599,10 +599,7 @@ TYPED_TEST(BlockManagerTest, CloseTwiceTest) {
 TYPED_TEST(BlockManagerTest, CloseManyBlocksTest) {
   const int kNumBlocks = 1000;
 
-  if (!AllowSlowTests()) {
-    LOG(INFO) << "Not running in slow-tests mode";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   Random rand(SeedRandom());
   unique_ptr<BlockCreationTransaction> creation_transaction =
diff --git a/src/kudu/integration-tests/alter_table-test.cc 
b/src/kudu/integration-tests/alter_table-test.cc
index 3dad23f..6d6f65e 100644
--- a/src/kudu/integration-tests/alter_table-test.cc
+++ b/src/kudu/integration-tests/alter_table-test.cc
@@ -586,10 +586,7 @@ TEST_F(AlterTableTest, TestShutdownWithPendingTasks) {
 //  - get the new schema state, and mark the alter as complete
 //  - get the old schema state, and ask the TS again to perform the alter.
 TEST_F(AlterTableTest, TestRestartTSDuringAlter) {
-  if (!AllowSlowTests()) {
-    LOG(INFO) << "Skipping slow test";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   ASSERT_EQ(0, tablet_replica_->tablet()->metadata()->schema_version());
 
diff --git a/src/kudu/integration-tests/auth_token_expire-itest.cc 
b/src/kudu/integration-tests/auth_token_expire-itest.cc
index a22588c..b0f04c7 100644
--- a/src/kudu/integration-tests/auth_token_expire-itest.cc
+++ b/src/kudu/integration-tests/auth_token_expire-itest.cc
@@ -19,7 +19,6 @@
 #include <cstdint>
 #include <functional>
 #include <memory>
-#include <ostream>
 #include <string>
 #include <vector>
 
@@ -285,10 +284,7 @@ INSTANTIATE_TEST_SUITE_P(ValidityIntervals, 
AuthTokenExpireDuringWorkloadITest,
 TEST_P(AuthTokenExpireDuringWorkloadITest, InvalidTokenDuringMixedWorkload) {
   static const int32_t kTimeoutMs = 10 * 60 * 1000;
 
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   ASSERT_OK(cluster_->Start());
 
@@ -327,10 +323,7 @@ TEST_P(AuthTokenExpireDuringWorkloadITest, 
InvalidTokenDuringSeparateWorkloads)
   const string table_name = "authn-token-expire-separate-workloads";
   static const int32_t kTimeoutMs = 10 * 60 * 1000;
 
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   ASSERT_OK(cluster_->Start());
 
@@ -547,10 +540,7 @@ class MultiMasterIdleConnectionsITest : public 
AuthTokenExpireITestBase {
 // when the client tried to open the test table after master leader 
re-election:
 //   Timed out: GetTableSchema timed out after deadline expired
 TEST_F(MultiMasterIdleConnectionsITest, ClientReacquiresAuthnToken) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const string kTableName = "keep-connection-to-former-master-leader";
   const auto time_start = MonoTime::Now();
diff --git a/src/kudu/integration-tests/client-negotiation-failover-itest.cc 
b/src/kudu/integration-tests/client-negotiation-failover-itest.cc
index ee831b6..134d2d2 100644
--- a/src/kudu/integration-tests/client-negotiation-failover-itest.cc
+++ b/src/kudu/integration-tests/client-negotiation-failover-itest.cc
@@ -17,7 +17,6 @@
 
 #include <cstdlib>
 #include <memory>
-#include <ostream>
 #include <string>
 #include <thread>
 #include <vector>
@@ -137,10 +136,7 @@ TEST_F(ClientFailoverOnNegotiationTimeoutITest, 
Kudu1580ConnectToTServer) {
   static const int kTimeoutMs = 5 * 60 * 1000;
   static const char* kTableName = "kudu1580";
 
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   cluster_opts_.num_tablet_servers = kNumTabletServers;
   ASSERT_OK(CreateAndStartCluster());
diff --git a/src/kudu/integration-tests/consensus_peer_health_status-itest.cc 
b/src/kudu/integration-tests/consensus_peer_health_status-itest.cc
index bf328e1..855839b 100644
--- a/src/kudu/integration-tests/consensus_peer_health_status-itest.cc
+++ b/src/kudu/integration-tests/consensus_peer_health_status-itest.cc
@@ -62,10 +62,7 @@ class ConsensusPeerHealthStatusITest : public 
RaftConsensusITestBase {
 // This is a functional test that verifies that when a replica goes into a bad
 // state, its health status is detected by the leader replica.
 TEST_F(ConsensusPeerHealthStatusITest, TestPeerHealthStatusTransitions) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "Test disabled in fast test mode. Set 
KUDU_ALLOW_SLOW_TESTS=1 to enable.";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const MonoDelta kTimeout = MonoDelta::FromSeconds(30);
   const vector<string> kMasterFlags = {
diff --git a/src/kudu/integration-tests/create-table-itest.cc 
b/src/kudu/integration-tests/create-table-itest.cc
index dce0bd3..71a1b48 100644
--- a/src/kudu/integration-tests/create-table-itest.cc
+++ b/src/kudu/integration-tests/create-table-itest.cc
@@ -443,10 +443,7 @@ static void LookUpRandomKeysLoop(const 
std::shared_ptr<master::MasterServiceProx
 // This test replicates these conditions and hammers the master with key
 // lookups, attempting to reproduce the master crashes.
 TEST_F(CreateTableITest, TestCreateTableWithDeadTServers) {
-  if (!AllowSlowTests()) {
-    LOG(INFO) << "Skipping slow test";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const char* kTableName = "test";
 
diff --git a/src/kudu/integration-tests/create-table-stress-test.cc 
b/src/kudu/integration-tests/create-table-stress-test.cc
index 8b6b83e..11f9b18 100644
--- a/src/kudu/integration-tests/create-table-stress-test.cc
+++ b/src/kudu/integration-tests/create-table-stress-test.cc
@@ -170,10 +170,7 @@ void CreateTableStressTest::CreateBigTable(const string& 
table_name, int num_tab
 }
 
 TEST_F(CreateTableStressTest, CreateAndDeleteBigTable) {
-  if (!AllowSlowTests()) {
-    LOG(INFO) << "Skipping slow test";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
   string table_name = "test_table";
   NO_FATALS(CreateBigTable(table_name, FLAGS_num_test_tablets));
   master::GetTableLocationsResponsePB resp;
@@ -204,10 +201,7 @@ TEST_F(CreateTableStressTest, CreateAndDeleteBigTable) {
 }
 
 TEST_F(CreateTableStressTest, RestartMasterDuringCreation) {
-  if (!AllowSlowTests()) {
-    LOG(INFO) << "Skipping slow test";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   string table_name = "test_table";
   NO_FATALS(CreateBigTable(table_name, FLAGS_num_test_tablets));
@@ -232,10 +226,7 @@ TEST_F(CreateTableStressTest, RestartMasterDuringCreation) 
{
 }
 
 TEST_F(CreateTableStressTest, TestGetTableLocationsOptions) {
-  if (!AllowSlowTests()) {
-    LOG(INFO) << "Skipping slow test";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   string table_name = "test_table";
   LOG(INFO) << CURRENT_TEST_NAME() << ": Step 1. Creating big table " << 
table_name << " ...";
diff --git a/src/kudu/integration-tests/delete_table-itest.cc 
b/src/kudu/integration-tests/delete_table-itest.cc
index 678d5cb..e53defc 100644
--- a/src/kudu/integration-tests/delete_table-itest.cc
+++ b/src/kudu/integration-tests/delete_table-itest.cc
@@ -858,11 +858,7 @@ TEST_F(DeleteTableITest, TestMergeConsensusMetadata) {
 // state, which means they have not yet been committed to a majority, cannot
 // shut down during a DeleteTablet() call.
 TEST_F(DeleteTableITest, TestDeleteFollowerWithReplicatingOps) {
-  if (!AllowSlowTests()) {
-    // We will typically wait at least 5 seconds for timeouts to occur.
-    LOG(INFO) << "Skipping test in fast-test mode.";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const MonoDelta timeout = MonoDelta::FromSeconds(10);
 
@@ -1154,10 +1150,7 @@ TEST_F(DeleteTableITest, 
TestUnknownTabletsAreNotDeleted) {
 // Ensure that the master doesn't try to delete tombstoned tablets.
 // Regression test for KUDU-2114.
 TEST_F(DeleteTableITest, TestNoDeleteTombstonedTablets) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "This test sleeps for several seconds and only runs in 
slow-test mode";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const MonoDelta kTimeout = MonoDelta::FromSeconds(30);
   const vector<string> master_flags = {
diff --git a/src/kudu/integration-tests/location_assignment-itest.cc 
b/src/kudu/integration-tests/location_assignment-itest.cc
index 31d6937..8f7e211 100644
--- a/src/kudu/integration-tests/location_assignment-itest.cc
+++ b/src/kudu/integration-tests/location_assignment-itest.cc
@@ -18,7 +18,6 @@
 #include <cstdint>
 #include <functional>
 #include <memory>
-#include <ostream>
 #include <string>
 #include <tuple>
 #include <unordered_map>
@@ -215,10 +214,7 @@ class TsLocationAssignmentITest :
 // is assigned the same location after restart once the location assignment
 // script is kept the same between restarts.
 TEST_P(TsLocationAssignmentITest, Basic) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   NO_FATALS(StartCluster());
   NO_FATALS(CheckLocationInfo());
@@ -234,10 +230,7 @@ TEST_P(TsLocationAssignmentITest, Basic) {
 // Verify the behavior of the location mapping cache upon tablet server
 // registrations.
 TEST_P(TsLocationAssignmentITest, LocationMappingCacheOnTabletServerRestart) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   NO_FATALS(StartCluster());
   NO_FATALS(CheckLocationInfo());
diff --git a/src/kudu/integration-tests/master_cert_authority-itest.cc 
b/src/kudu/integration-tests/master_cert_authority-itest.cc
index 088bba9..6c0e142 100644
--- a/src/kudu/integration-tests/master_cert_authority-itest.cc
+++ b/src/kudu/integration-tests/master_cert_authority-itest.cc
@@ -18,7 +18,6 @@
 #include <algorithm>
 #include <iterator>
 #include <memory>
-#include <ostream>
 #include <string>
 #include <thread>
 #include <vector>
@@ -462,10 +461,7 @@ TEST_F(SingleMasterConnectToClusterTest, ConnectToCluster) 
{
 }
 
 TEST_F(MultiMasterConnectToClusterTest, ConnectToCluster) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
   ASSERT_OK(cluster_->Start());
   Run();
 }
diff --git a/src/kudu/integration-tests/master_failover-itest.cc 
b/src/kudu/integration-tests/master_failover-itest.cc
index f671b0a..1a46fe3 100644
--- a/src/kudu/integration-tests/master_failover-itest.cc
+++ b/src/kudu/integration-tests/master_failover-itest.cc
@@ -173,10 +173,7 @@ INSTANTIATE_TEST_SUITE_P(HmsConfigurations, 
MasterFailoverTest, ::testing::Value
 TEST_P(MasterFailoverTest, TestCreateTableSync) {
   const char* kTableName = "default.test_create_table_sync";
 
-  if (!AllowSlowTests()) {
-    LOG(INFO) << "This test can only be run in slow mode.";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   LOG(INFO) << "Pausing leader master";
   int leader_idx;
@@ -206,10 +203,7 @@ TEST_P(MasterFailoverTest, TestCreateTableSync) {
 TEST_P(MasterFailoverTest, TestPauseAfterCreateTableIssued) {
   const char* kTableName = "default.test_pause_after_create_table_issued";
 
-  if (!AllowSlowTests()) {
-    LOG(INFO) << "This test can only be run in slow mode.";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   ASSERT_OK(CreateTable(kTableName, kNoWaitForCreate));
 
@@ -236,10 +230,7 @@ TEST_P(MasterFailoverTest, 
TestPauseAfterCreateTableIssued) {
 // elected leader master and succeed.
 TEST_P(MasterFailoverTest, TestDeleteTableSync) {
   const char* kTableName = "default.test_delete_table_sync";
-  if (!AllowSlowTests()) {
-    LOG(INFO) << "This test can only be run in slow mode.";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   ASSERT_OK(CreateTable(kTableName, kWaitForCreate));
 
@@ -270,11 +261,7 @@ TEST_P(MasterFailoverTest, TestRenameTableSync) {
   const char* kTableNameOrig = "default.test_alter_table_sync";
   const char* kTableNameNew = "default.test_alter_table_sync_renamed";
 
-  if (!AllowSlowTests()) {
-    LOG(INFO) << "This test can only be run in slow mode.";
-    return;
-  }
-
+  SKIP_IF_SLOW_NOT_ALLOWED();
   ASSERT_OK(CreateTable(kTableNameOrig, kWaitForCreate));
 
   LOG(INFO) << "Pausing leader master";
diff --git a/src/kudu/integration-tests/open-readonly-fs-itest.cc 
b/src/kudu/integration-tests/open-readonly-fs-itest.cc
index f5eccfc..824f99d 100644
--- a/src/kudu/integration-tests/open-readonly-fs-itest.cc
+++ b/src/kudu/integration-tests/open-readonly-fs-itest.cc
@@ -99,7 +99,7 @@ class OpenReadonlyFsITest : public KuduTest {
 // This is a regression test for KUDU-1657. It typically takes about 35 seconds
 // to trigger that bug.
 TEST_F(OpenReadonlyFsITest, TestWriteAndVerify) {
-  if (!AllowSlowTests()) return;
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   KuduSchema schema;
   KuduSchemaBuilder b;
diff --git a/src/kudu/integration-tests/raft_config_change-itest.cc 
b/src/kudu/integration-tests/raft_config_change-itest.cc
index 83b7900..743bba4 100644
--- a/src/kudu/integration-tests/raft_config_change-itest.cc
+++ b/src/kudu/integration-tests/raft_config_change-itest.cc
@@ -111,11 +111,7 @@ class RaftConfigChangeITest : public 
ExternalMiniClusterITestBase {
 // 8. Once that process completes, all 3 replicas will have identical logs,
 //    which is what we wait for at the end of the test.
 TEST_F(RaftConfigChangeITest, TestKudu2147) {
-  if (!AllowSlowTests()) {
-    // This test injects seconds of latency so can take a while to converge.
-    LOG(WARNING) << "Skipping test in fast-test mode.";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
   const MonoDelta kTimeout = MonoDelta::FromSeconds(30);
   // Slow down leader heartbeats so that in the explicit election below, the
   // second leader does not immediately heartbeat to the initial leader. If
diff --git a/src/kudu/integration-tests/raft_consensus-itest.cc 
b/src/kudu/integration-tests/raft_consensus-itest.cc
index 0fae6e4..e8902b8 100644
--- a/src/kudu/integration-tests/raft_consensus-itest.cc
+++ b/src/kudu/integration-tests/raft_consensus-itest.cc
@@ -2098,7 +2098,7 @@ static void EnableLogLatency(server::GenericServiceProxy* 
proxy) {
 
 // Run a regular workload with a leader that's writing to its WAL slowly.
 TEST_F(RaftConsensusITest, TestSlowLeader) {
-  if (!AllowSlowTests()) return;
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   NO_FATALS(BuildAndStart());
 
@@ -2178,7 +2178,7 @@ TEST_F(RaftConsensusITest, TestLargeBatches) {
 TEST_F(RaftConsensusITest, TestCommitIndexFarBehindAfterLeaderElection) {
   const MonoDelta kTimeout = MonoDelta::FromSeconds(10);
 
-  if (!AllowSlowTests()) return;
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   // Set the batch size low so that, after the new leader takes
   // over below, the ops required to catch up from the committed index
@@ -2265,7 +2265,7 @@ TEST_F(RaftConsensusITest, 
TestCommitIndexFarBehindAfterLeaderElection) {
 
 // Run a regular workload with one follower that's writing to its WAL slowly.
 TEST_F(RaftConsensusITest, TestSlowFollower) {
-  if (!AllowSlowTests()) return;
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   NO_FATALS(BuildAndStart());
 
@@ -2296,7 +2296,7 @@ TEST_F(RaftConsensusITest, TestSlowFollower) {
 // Run a special workload that constantly updates a single row on a cluster
 // where every replica is writing to its WAL slowly.
 TEST_F(RaftConsensusITest, TestHammerOneRow) {
-  if (!AllowSlowTests()) return;
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   NO_FATALS(BuildAndStart());
 
@@ -3070,10 +3070,7 @@ TEST_P(RaftConsensusParamReplicationModesITest, 
TestRestartWithDifferentUUID) {
 // Designating graceful leadership transfer to a follower that cannot catch up
 // should eventually fail.
 TEST_F(RaftConsensusITest, TestLeaderTransferWhenFollowerFallsBehindLeaderGC) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
   const auto kTimeout = MonoDelta::FromSeconds(30);
   vector<string> ts_flags = {
     // Disable follower eviction.
diff --git 
a/src/kudu/integration-tests/raft_consensus_failure_detector-imc-itest.cc 
b/src/kudu/integration-tests/raft_consensus_failure_detector-imc-itest.cc
index 33af873..e104a8f 100644
--- a/src/kudu/integration-tests/raft_consensus_failure_detector-imc-itest.cc
+++ b/src/kudu/integration-tests/raft_consensus_failure_detector-imc-itest.cc
@@ -17,7 +17,6 @@
 
 #include <functional>
 #include <memory>
-#include <ostream>
 #include <string>
 #include <unordered_map>
 #include <utility>
@@ -62,10 +61,7 @@ class RaftConsensusFailureDetectorIMCTest : public 
MiniClusterITestBase {
 // configuration change.
 // Regression test for KUDU-2229.
 TEST_F(RaftConsensusFailureDetectorIMCTest, TestFailureDetectorActivation) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const MonoDelta kTimeout = MonoDelta::FromSeconds(30);
 
diff --git a/src/kudu/integration-tests/raft_consensus_nonvoter-itest.cc 
b/src/kudu/integration-tests/raft_consensus_nonvoter-itest.cc
index b62a6d1..1c6c3cf 100644
--- a/src/kudu/integration-tests/raft_consensus_nonvoter-itest.cc
+++ b/src/kudu/integration-tests/raft_consensus_nonvoter-itest.cc
@@ -696,10 +696,7 @@ TEST_F(RaftConsensusNonVoterITest, 
AddThenRemoveNonVoterReplica) {
 //  * does not start leader elections
 //  * returns an error on RunLeaderElection() RPC call
 TEST_F(RaftConsensusNonVoterITest, NonVoterReplicasDoNotVote) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const MonoDelta kTimeout = MonoDelta::FromSeconds(60);
   const int kOriginalReplicasNum = 2;
@@ -831,10 +828,7 @@ TEST_F(RaftConsensusNonVoterITest, 
NonVoterReplicasDoNotVote) {
 // Promote and demote a replica under active workload.
 // Promote a replica and remove it, making sure it gets tombstoned.
 TEST_F(RaftConsensusNonVoterITest, PromoteAndDemote) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const MonoDelta kTimeout = MonoDelta::FromSeconds(120);
   const int kInitialReplicasNum = 3;
@@ -1020,10 +1014,7 @@ TEST_F(RaftConsensusNonVoterITest, PromoteAndDemote) {
 //    its failure detection mechanism works as expected.
 //
 TEST_F(RaftConsensusNonVoterITest, PromotedReplicaCanVote) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const MonoDelta kTimeout = MonoDelta::FromSeconds(60);
   const int kInitialReplicasNum = 3;
@@ -1165,10 +1156,7 @@ TEST_F(RaftConsensusNonVoterITest, 
PromotedReplicaCanVote) {
 // Add an extra non-voter replica to the tablet and make sure it's evicted
 // by the catalog manager once catalog manager sees its state updated.
 TEST_F(RaftConsensusNonVoterITest, CatalogManagerEvictsExcessNonVoter) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const int kReplicaUnavailableSec = 5;
   const MonoDelta kTimeout = MonoDelta::FromSeconds(60);
@@ -1262,10 +1250,7 @@ TEST_F(RaftConsensusNonVoterITest, 
CatalogManagerEvictsExcessNonVoter) {
 //
 // TODO(aserbin): and make it run for 5 tablet servers.
 TEST_F(RaftConsensusNonVoterITest, CatalogManagerAddsNonVoter) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const int kReplicaUnavailableSec = 10;
   const MonoDelta kTimeout = MonoDelta::FromSeconds(6 * 
kReplicaUnavailableSec);
@@ -1323,10 +1308,7 @@ TEST_F(RaftConsensusNonVoterITest, 
CatalogManagerAddsNonVoter) {
 // original voter replicas from the tablet server should stay, but the newly
 // added non-voter replicas should be evicted.
 TEST_F(RaftConsensusNonVoterITest, TabletServerIsGoneAndBack) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const auto kReplicasNum = 3;
   const auto kReplicaUnavailableSec = 5;
@@ -1430,10 +1412,7 @@ TEST_F(RaftConsensusNonVoterITest, 
TabletServerIsGoneAndBack) {
 // replace the failed voter replica, so eventually the tablet has appropriate
 // number of functional replicas to guarantee the tablet's replication factor.
 TEST_F(RaftConsensusNonVoterITest, FailedTabletCopy) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const auto kReplicasNum = 3;
   const auto kConsensusRpcTimeout = MonoDelta::FromSeconds(5);
@@ -1613,10 +1592,7 @@ TEST_F(RaftConsensusNonVoterITest, FailedTabletCopy) {
 // After that, all tablet servers except for the former leader replica's server
 // are started again.
 TEST_F(RaftConsensusNonVoterITest, RestartClusterWithNonVoter) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const auto kReplicasNum = 3;
   const auto kConsensusRpcTimeout = MonoDelta::FromSeconds(5);
@@ -1771,10 +1747,7 @@ TEST_F(RaftConsensusNonVoterITest, 
RestartClusterWithNonVoter) {
 // Raft cluster, adding a new non-voter replica, when a majority of voters
 // is not online. Make sure the configuration change is not committed.
 TEST_F(RaftConsensusNonVoterITest, NonVoterReplicasInConsensusQueue) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const MonoDelta kTimeout = MonoDelta::FromSeconds(60);
   const int kOriginalReplicasNum = 3;
@@ -1977,10 +1950,7 @@ INSTANTIATE_TEST_SUITE_P(,
                           
RaftConsensusITestBase::BehindWalGcBehavior::SHUTDOWN),
         ::testing::Bool()));
 TEST_P(ReplicaBehindWalGcThresholdITest, ReplicaReplacement) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const auto kReplicasNum = 3;
   const auto kTimeoutSec = 60;
diff --git a/src/kudu/integration-tests/raft_consensus_stress-itest.cc 
b/src/kudu/integration-tests/raft_consensus_stress-itest.cc
index 7191542..9700d61 100644
--- a/src/kudu/integration-tests/raft_consensus_stress-itest.cc
+++ b/src/kudu/integration-tests/raft_consensus_stress-itest.cc
@@ -106,10 +106,7 @@ class RaftConsensusStressITest : public 
RaftConsensusITestBase {
 // some point all replacement replicas are placed on top of previously
 // tombstoned ones.
 TEST_F(RaftConsensusStressITest, RemoveReplaceInCycle) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const bool is_343_scheme = 
FLAGS_test_raft_prepare_replacement_before_eviction;
   const int kReplicaUnavailableSec = 
FLAGS_test_follower_unavailable_considered_failed_sec;
diff --git a/src/kudu/integration-tests/security-faults-itest.cc 
b/src/kudu/integration-tests/security-faults-itest.cc
index 67880b0..c25da19 100644
--- a/src/kudu/integration-tests/security-faults-itest.cc
+++ b/src/kudu/integration-tests/security-faults-itest.cc
@@ -19,7 +19,6 @@
 #include <cstdint>
 #include <iterator>
 #include <memory>
-#include <ostream>
 #include <string>
 #include <vector>
 
@@ -165,10 +164,7 @@ class SecurityComponentsFaultsITest : public KuduTest {
 // Check how the system behaves when KDC is not available upon start-up
 // of Kudu server-side components.
 TEST_F(SecurityComponentsFaultsITest, NoKdcOnStart) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   // Start with the KDC first: let's generate generate keytabs, get initial
   // kerberos tickets, etc.
@@ -206,10 +202,7 @@ TEST_F(SecurityComponentsFaultsITest, NoKdcOnStart) {
 // Check that restarting KDC does not affect running master and tablet servers:
 // they are able to operate with no issues past ticket TTL once KDC is back.
 TEST_F(SecurityComponentsFaultsITest, KdcRestartsInTheMiddle) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   // Enable KRPC negotiation tracing for the Kudu client running smoke test
   // workload.
diff --git a/src/kudu/integration-tests/security-unknown-tsk-itest.cc 
b/src/kudu/integration-tests/security-unknown-tsk-itest.cc
index 35f90aa..c7d37ae 100644
--- a/src/kudu/integration-tests/security-unknown-tsk-itest.cc
+++ b/src/kudu/integration-tests/security-unknown-tsk-itest.cc
@@ -19,7 +19,6 @@
 #include <cstdint>
 #include <cstdlib>
 #include <memory>
-#include <ostream>
 #include <string>
 #include <thread>
 #include <vector>
@@ -346,10 +345,7 @@ TEST_F(SecurityUnknownTskTest, 
ErrorUnavailableCommonOperations) {
 // this gives coverage of ERROR_UNAVAILABLE handling for all RPC calls involved
 // in the workload scenario.
 TEST_F(SecurityUnknownTskTest, ErrorUnavailableDuringWorkload) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   static const int64_t kTimeoutMs = 20 * 1000;
   int64_t tsk_seq_num = 100;
diff --git a/src/kudu/integration-tests/tablet_copy-itest.cc 
b/src/kudu/integration-tests/tablet_copy-itest.cc
index 9e534a0..ced7108 100644
--- a/src/kudu/integration-tests/tablet_copy-itest.cc
+++ b/src/kudu/integration-tests/tablet_copy-itest.cc
@@ -167,11 +167,7 @@ class TabletCopyITest : public 
ExternalMiniClusterITestBase {
 // A leader can "go rogue" due to a VM pause, CTRL-z, partition, etc.
 TEST_F(TabletCopyITest, TestRejectRogueLeader) {
   // This test pauses for at least 10 seconds. Only run in slow-test mode.
-  if (!AllowSlowTests()) {
-    LOG(INFO) << "Skipping test in fast-test mode.";
-    return;
-  }
-
+  SKIP_IF_SLOW_NOT_ALLOWED();
   vector<string> ts_flags, master_flags;
   ts_flags.emplace_back("--enable_leader_failure_detection=false");
   
master_flags.emplace_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
@@ -620,10 +616,7 @@ TEST_F(TabletCopyITest, 
TestTabletCopyFollowerWithHigherTerm) {
 // multiple tablets between the same tablet copy client host and source host
 // could corrupt each other.
 TEST_F(TabletCopyITest, TestConcurrentTabletCopys) {
-  if (!AllowSlowTests()) {
-    LOG(INFO) << "Skipping test in fast-test mode.";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   vector<string> ts_flags, master_flags;
   ts_flags.emplace_back("--enable_leader_failure_detection=false");
@@ -730,10 +723,7 @@ TEST_F(TabletCopyITest, TestConcurrentTabletCopys) {
 // KUDU-1047.
 TEST_F(TabletCopyITest, TestDeleteLeaderDuringTabletCopyStressTest) {
   // This test takes a while due to failure detection.
-  if (!AllowSlowTests()) {
-    LOG(INFO) << "Skipping test in fast-test mode.";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const MonoDelta timeout = MonoDelta::FromSeconds(60);
   NO_FATALS(StartCluster(vector<string>(), vector<string>(), 5));
@@ -1472,11 +1462,7 @@ void BadTabletCopyITest::LoadTable(TestWorkload* 
workload, int min_rows, int min
 
 // Ensure that a tablet copy failure results in no orphaned blocks and no data 
loss.
 TEST_P(BadTabletCopyITest, TestBadCopy) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "Not running " << CURRENT_TEST_NAME() << " because it is a 
slow test.";
-    return;
-  }
-
+  SKIP_IF_SLOW_NOT_ALLOWED();
   // Load 2 tablets with 3 replicas each across 3 tablet servers s.t. we end up
   // with a replication distribution like: ([A], [A,B], [A,B], [B]).
   const MonoDelta kTimeout = MonoDelta::FromSeconds(30);
diff --git a/src/kudu/integration-tests/tablet_copy_client_session-itest.cc 
b/src/kudu/integration-tests/tablet_copy_client_session-itest.cc
index 119a5bd..964f8da 100644
--- a/src/kudu/integration-tests/tablet_copy_client_session-itest.cc
+++ b/src/kudu/integration-tests/tablet_copy_client_session-itest.cc
@@ -122,10 +122,7 @@ void 
TabletCopyClientSessionITest::PrepareClusterForTabletCopy(
 // Regression test for KUDU-1785. Ensure that starting a tablet copy session
 // while a tablet is bootstrapping will result in a simple failure, not a 
crash.
 TEST_F(TabletCopyClientSessionITest, 
TestStartTabletCopyWhileSourceBootstrapping) {
-  if (!AllowSlowTests()) {
-    LOG(INFO) << "Test only runs in slow test mode";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
   const MonoDelta kTimeout = MonoDelta::FromSeconds(90); // Can be very slow 
on TSAN.
   NO_FATALS(PrepareClusterForTabletCopy());
 
@@ -282,10 +279,7 @@ TEST_F(TabletCopyClientSessionITest, 
TestCopyFromCrashedSource) {
 // Regression for KUDU-2125: ensure that a heavily loaded source cluster can
 // satisfy many concurrent tablet copies.
 TEST_F(TabletCopyClientSessionITest, TestTabletCopyWithBusySource) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
   const int kNumTablets = 20;
 
   ExternalMiniClusterOptions opts;
diff --git a/src/kudu/integration-tests/tablet_replacement-itest.cc 
b/src/kudu/integration-tests/tablet_replacement-itest.cc
index 10982b1..65ca217 100644
--- a/src/kudu/integration-tests/tablet_replacement-itest.cc
+++ b/src/kudu/integration-tests/tablet_replacement-itest.cc
@@ -136,10 +136,7 @@ void TabletReplacementITest::GetTsMapForReplicas(
 
 void TabletReplacementITest::TestDontEvictIfRemainingConfigIsUnstable(
     InstabilityType type, bool is_3_4_3_mode) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   // The configuration is tuned to minimize chances of reporting on failed
   // tablet replicas one-by-one. That's because by the scenario 2 replicas out
@@ -319,7 +316,7 @@ TEST_F(TabletReplacementITest, 
TestMasterTombstoneEvictedReplica) {
     // The rest of this test has multi-second waits, so we do it in slow test 
mode.
     LOG(WARNING) << "not verifying that a newly-added replica won't be 
tombstoned; "
                     "run with KUDU_ALLOW_SLOW_TESTS=1 to verify";
-    return;
+    GTEST_SKIP();
   }
 
   // Shut down a majority of followers (3 servers) and then try to add the
@@ -485,10 +482,7 @@ class EvictAndReplaceDeadFollowerITest :
 
 // Test that unreachable followers are evicted and replaced.
 TEST_P(EvictAndReplaceDeadFollowerITest, UnreachableFollower) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const bool is_3_4_3_mode = GetParam();
   MonoDelta kTimeout = MonoDelta::FromSeconds(30);
@@ -590,10 +584,7 @@ INSTANTIATE_TEST_SUITE_P(,
 // copied tablet should detect that these config change
 // operations have already been applied and skip them.
 TEST_F(TabletReplacementITest, 
TestRemoteBoostrapWithPendingConfigChangeCommits) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const MonoDelta timeout = MonoDelta::FromSeconds(30);
   vector<string> ts_flags;
diff --git a/src/kudu/integration-tests/token_signer-itest.cc 
b/src/kudu/integration-tests/token_signer-itest.cc
index 32d1626..be07721 100644
--- a/src/kudu/integration-tests/token_signer-itest.cc
+++ b/src/kudu/integration-tests/token_signer-itest.cc
@@ -19,7 +19,6 @@
 #include <cstdint>
 #include <functional>
 #include <memory>
-#include <ostream>
 #include <string>
 #include <vector>
 
@@ -214,10 +213,7 @@ TEST_F(TokenSignerITest, TskMasterLeadershipChange) {
 //   * Make sure the TSK stays valid and can be used for token verification
 //     up to the very end of the token validity interval.
 TEST_F(TokenSignerITest, AuthnTokenLifecycle) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
   vector<TokenSigningPublicKeyPB> public_keys;
   ASSERT_OK(GetLeaderPublicKeys(&public_keys));
   ASSERT_EQ(1, public_keys.size());
diff --git a/src/kudu/integration-tests/tombstoned_voting-imc-itest.cc 
b/src/kudu/integration-tests/tombstoned_voting-imc-itest.cc
index 6409e1a..485dbfc 100644
--- a/src/kudu/integration-tests/tombstoned_voting-imc-itest.cc
+++ b/src/kudu/integration-tests/tombstoned_voting-imc-itest.cc
@@ -79,7 +79,7 @@ class TombstonedVotingIMCITest : public MiniClusterITestBase {
 // Ensure that a tombstoned replica cannot vote after we call Shutdown() on it.
 TEST_F(TombstonedVotingIMCITest, TestNoVoteAfterShutdown) {
   // This test waits for several seconds, so only run it in slow mode.
-  if (!AllowSlowTests()) return;
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   FLAGS_allow_unsafe_replication_factor = true; // Allow an even replication 
factor.
   FLAGS_enable_tablet_copy = false; // Tablet copy would interfere with this 
test.
@@ -152,7 +152,7 @@ TEST_F(TombstonedVotingIMCITest, TestNoVoteAfterShutdown) {
 // This is implemented by directly exercising the RPC API with different vote 
request parameters.
 TEST_F(TombstonedVotingIMCITest, TestVotingLogic) {
   // This test waits for several seconds, so only run it in slow mode.
-  if (!AllowSlowTests()) return;
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   FLAGS_allow_unsafe_replication_factor = true; // Allow an even replication 
factor.
   FLAGS_enable_tablet_copy = false; // Tablet copy would interfere with this 
test.
@@ -251,7 +251,7 @@ TEST_F(TombstonedVotingIMCITest, TestVotingLogic) {
 // Disable tombstoned voting and ensure that an election that would require it 
fails.
 TEST_F(TombstonedVotingIMCITest, TestNoVoteIfTombstonedVotingDisabled) {
   // This test waits for several seconds, so only run it in slow mode.
-  if (!AllowSlowTests()) return;
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   FLAGS_raft_enable_tombstoned_voting = false; // Disable tombstoned voting.
   FLAGS_allow_unsafe_replication_factor = true; // Allow an even replication 
factor.
@@ -301,7 +301,7 @@ TEST_F(TombstonedVotingIMCITest, 
TestNoVoteIfTombstonedVotingDisabled) {
 // the last-logged opid was unknown. This may occur if a tablet is tombstoned
 // while in a FAILED state.
 TEST_F(TombstonedVotingIMCITest, TestNoVoteIfNoLastLoggedOpId) {
-  if (!AllowSlowTests()) return; // This test waits for several seconds.
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   FLAGS_allow_unsafe_replication_factor = true; // Allow an even replication 
factor.
 
diff --git a/src/kudu/integration-tests/tombstoned_voting-stress-test.cc 
b/src/kudu/integration-tests/tombstoned_voting-stress-test.cc
index 7f77f03..41496f0 100644
--- a/src/kudu/integration-tests/tombstoned_voting-stress-test.cc
+++ b/src/kudu/integration-tests/tombstoned_voting-stress-test.cc
@@ -217,7 +217,7 @@ void TombstonedVotingStressTest::RunVoteRequestLoop() {
 // copying replicas.
 TEST_F(TombstonedVotingStressTest, TestTombstonedVotingUnderStress) {
   // This test waits for several seconds, so only run it in slow mode.
-  if (!AllowSlowTests()) return;
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const MonoDelta kTimeout = MonoDelta::FromSeconds(30);
 
diff --git a/src/kudu/integration-tests/ts_recovery-itest.cc 
b/src/kudu/integration-tests/ts_recovery-itest.cc
index cb25cfc..94ae9cc 100644
--- a/src/kudu/integration-tests/ts_recovery-itest.cc
+++ b/src/kudu/integration-tests/ts_recovery-itest.cc
@@ -785,7 +785,7 @@ INSTANTIATE_TEST_SUITE_P(DifferentFaultPoints,
                                           
"fault_crash_before_flush_tablet_meta_after_flush_mrs"));
 
 TEST_P(Kudu969Test, Test) {
-  if (!AllowSlowTests()) return;
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   // We use a replicated cluster here so that the 'REPLICATE' messages
   // and 'COMMIT' messages are spread out further in time, and it's
diff --git a/src/kudu/security/crypto-test.cc b/src/kudu/security/crypto-test.cc
index 1918094..b0312e0 100644
--- a/src/kudu/security/crypto-test.cc
+++ b/src/kudu/security/crypto-test.cc
@@ -20,10 +20,12 @@
 #include <openssl/crypto.h>
 
 #include <cstring>
+#include <ostream>
 #include <string>
 #include <utility>
 #include <vector>
 
+#include <glog/logging.h>
 #include <gtest/gtest.h>
 
 #include "kudu/gutil/strings/strip.h"
@@ -97,7 +99,8 @@ class CryptoTest : public KuduTest {
 TEST_F(CryptoTest, RsaPrivateKeyInputOutputPEM) {
   // TODO(KUDU-3207): Skip when run in FIPS mode due to different private key 
format.
   if (FIPS_mode()) {
-    return;
+    LOG(WARNING) << "Skipping test in FIPS mode. See KUDU-3207.";
+    GTEST_SKIP();
   }
   PrivateKey key;
   ASSERT_OK(key.FromFile(private_key_file_, DataFormat::PEM));
diff --git a/src/kudu/security/token-test.cc b/src/kudu/security/token-test.cc
index 00e4f61..e0cf0f7 100644
--- a/src/kudu/security/token-test.cc
+++ b/src/kudu/security/token-test.cc
@@ -791,10 +791,7 @@ TEST_F(TokenTest, TestVaryingTokenValidityIntervals) {
 // Test to check the invariant that all tokens signed within a TSK's activity
 // interval must be expired by the end of the TSK's validity interval.
 TEST_F(TokenTest, TestKeyValidity) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
   // Note: this test's runtime is roughly the length of a key-validity
   // interval, which is determined by the token validity intervals and the key
   // rotation interval.
diff --git a/src/kudu/tablet/compaction-test.cc 
b/src/kudu/tablet/compaction-test.cc
index 4788ee2..aeb9570 100644
--- a/src/kudu/tablet/compaction-test.cc
+++ b/src/kudu/tablet/compaction-test.cc
@@ -1124,20 +1124,14 @@ TEST_F(TestCompaction, 
TestMergeMRSWithAllInvisibleRows) {
 // contain non-overlapping data. In this case the merge can be optimized
 // to be block-wise.
 TEST_F(TestCompaction, BenchmarkMergeWithoutOverlap) {
-  if (!AllowSlowTests()) {
-    LOG(INFO) << "Skipped: must enable slow tests.";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
   NO_FATALS(DoBenchmark<false>());
 }
 
 // Benchmark for the compaction merge input when the inputs are entirely
 // overlapping (i.e the inputs become fully interleaved in the output)
 TEST_F(TestCompaction, BenchmarkMergeWithOverlap) {
-  if (!AllowSlowTests()) {
-    LOG(INFO) << "Skipped: must enable slow tests.";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
   NO_FATALS(DoBenchmark<true>());
 }
 #endif
diff --git a/src/kudu/tablet/compaction_policy-test.cc 
b/src/kudu/tablet/compaction_policy-test.cc
index eb2e398..fe09583 100644
--- a/src/kudu/tablet/compaction_policy-test.cc
+++ b/src/kudu/tablet/compaction_policy-test.cc
@@ -265,10 +265,7 @@ static RowSetVector LoadFile(const string& name) {
 // data. This test can be used as a benchmark for optimizing the compaction
 // policy, and also serves as a basic regression/stress test using real data.
 TEST_F(TestCompactionPolicy, TestYcsbCompaction) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
   const RowSetVector rowsets = LoadFile("testdata/ycsb-test-rowsets.tsv");
   RowSetTree tree;
   ASSERT_OK(tree.Reset(rowsets));
diff --git a/src/kudu/tools/ksck_remote-test.cc 
b/src/kudu/tools/ksck_remote-test.cc
index 63f81e9..344f740 100644
--- a/src/kudu/tools/ksck_remote-test.cc
+++ b/src/kudu/tools/ksck_remote-test.cc
@@ -509,10 +509,7 @@ TEST_F(RemoteKsckTest, 
TestChecksumSnapshotCurrentTimestamp) {
 TEST_F(RemoteKsckTest, TestChecksumSnapshotLastingLongerThanAHM) {
   // This test is really slow because -tablet_history_max_age_sec's lowest
   // acceptable value is 1.
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   // This test relies on somewhat precise timing: the timestamp update must
   // happen during the wait to start the checksum, for each tablet. It's likely
diff --git a/src/kudu/tools/kudu-admin-test.cc 
b/src/kudu/tools/kudu-admin-test.cc
index ae90e87..bf30864 100644
--- a/src/kudu/tools/kudu-admin-test.cc
+++ b/src/kudu/tools/kudu-admin-test.cc
@@ -1475,10 +1475,7 @@ TEST_F(AdminCliTest, TestLeaderTransferToNonVoter) {
 // abrupt stepdowns are happening, as long as the writes have long enough
 // timeouts to ride over the unstable leadership.
 TEST_F(AdminCliTest, TestSimultaneousLeaderTransferAndAbruptStepdown) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const MonoDelta kTimeout = MonoDelta::FromSeconds(10);
   FLAGS_num_tablet_servers = 3;
diff --git a/src/kudu/tools/rebalancer_tool-test.cc 
b/src/kudu/tools/rebalancer_tool-test.cc
index 044c54d..208854c 100644
--- a/src/kudu/tools/rebalancer_tool-test.cc
+++ b/src/kudu/tools/rebalancer_tool-test.cc
@@ -301,10 +301,7 @@ class RebalanceIgnoredTserversTest :
     public AdminCliTest {
 };
 TEST_F(RebalanceIgnoredTserversTest, Basic) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   FLAGS_num_tablet_servers = 5;
   // Start a cluster with a single tablet.
@@ -475,10 +472,7 @@ INSTANTIATE_TEST_SUITE_P(, RebalanceParamTest,
     ::testing::Combine(::testing::Values(1, 2, 3, 5),
                        ::testing::Values(Kudu1097::Disable, 
Kudu1097::Enable)));
 TEST_P(RebalanceParamTest, Rebalance) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const auto& param = GetParam();
   const auto kRepFactor = std::get<0>(param);
@@ -771,10 +765,7 @@ class IgnoredTserverGoesDownDuringRebalancingTest : public 
RebalancingTest {
   }
 };
 TEST_F(IgnoredTserverGoesDownDuringRebalancingTest, TserverDown) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const vector<string> kTserverExtraFlags = {
     // Slow down tablet copy to make rebalancing step running longer
@@ -895,10 +886,7 @@ class DDLDuringRebalancingTest : public RebalancingTest,
 INSTANTIATE_TEST_SUITE_P(, DDLDuringRebalancingTest,
                          ::testing::Values(Kudu1097::Disable, 
Kudu1097::Enable));
 TEST_P(DDLDuringRebalancingTest, TablesCreatedAndDeletedDuringRebalancing) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   NO_FATALS(Prepare());
 
@@ -1087,10 +1075,7 @@ class ConcurrentRebalancersTest : public RebalancingTest,
 INSTANTIATE_TEST_SUITE_P(, ConcurrentRebalancersTest,
                          ::testing::Values(Kudu1097::Disable, 
Kudu1097::Enable));
 TEST_P(ConcurrentRebalancersTest, TwoConcurrentRebalancers) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   NO_FATALS(Prepare());
 
@@ -1180,10 +1165,7 @@ class TserverGoesDownDuringRebalancingTest : public 
RebalancingTest,
 INSTANTIATE_TEST_SUITE_P(, TserverGoesDownDuringRebalancingTest,
                          ::testing::Values(Kudu1097::Disable, 
Kudu1097::Enable));
 TEST_P(TserverGoesDownDuringRebalancingTest, TserverDown) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const vector<string> kTserverExtraFlags = {
     // Slow down tablet copy to make rebalancing step running longer
@@ -1267,10 +1249,7 @@ class TserverAddedDuringRebalancingTest : public 
RebalancingTest,
 INSTANTIATE_TEST_SUITE_P(, TserverAddedDuringRebalancingTest,
                          ::testing::Values(Kudu1097::Disable, 
Kudu1097::Enable));
 TEST_P(TserverAddedDuringRebalancingTest, TserverStarts) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const vector<string> kTserverExtraFlags = {
     // Slow down tablet copy to make rebalancing step running longer
@@ -1339,10 +1318,7 @@ class RebalancingDuringElectionStormTest : public 
RebalancingTest,
 INSTANTIATE_TEST_SUITE_P(, RebalancingDuringElectionStormTest,
                          ::testing::Values(Kudu1097::Disable, 
Kudu1097::Enable));
 TEST_P(RebalancingDuringElectionStormTest, RoundRobin) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   NO_FATALS(Prepare());
 
@@ -1598,10 +1574,7 @@ class LocationAwareRebalancingBasicTest : public 
RebalancingTest {
 // and the placement policy constraints should be reimposed after running
 // the rebalancer tool.
 TEST_F(LocationAwareRebalancingBasicTest, Basic) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   const LocationInfo location_info = { { "/A", 2 }, { "/B", 2 }, { "/C", 2 }, 
};
   vector<string> table_names;
@@ -1935,10 +1908,7 @@ INSTANTIATE_TEST_SUITE_P(, 
LocationAwareRebalancingParamTest,
                          ::testing::ValuesIn(kLaRebalancingParams),
                          LaRebalancingTestName);
 TEST_P(LocationAwareRebalancingParamTest, Rebalance) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
   const auto& param = GetParam();
   const auto& location_info = param.location_info;
   const auto& excluded_locations = param.excluded_locations;
@@ -2012,10 +1982,7 @@ public:
 };
 
 TEST_F(IntraLocationRebalancingBasicTest, LocationsWithEmptyTabletServers) {
-  if (!AllowSlowTests()) {
-    LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
   const string first_table_name_pattern = "rebalance_test_first_table_$0";
   const string second_table_name_pattern = "rebalance_test_second_table_$0";
   const LocationInfo location_info = { { "/A", 3 }, { "/B", 3 }, { "/C", 3 },
diff --git a/src/kudu/util/monotime-test.cc b/src/kudu/util/monotime-test.cc
index 826e3a4..a75d6fa 100644
--- a/src/kudu/util/monotime-test.cc
+++ b/src/kudu/util/monotime-test.cc
@@ -170,10 +170,7 @@ TEST(TestMonoTime, TestSleepFor) {
 }
 
 TEST(TestMonoTime, TestSleepForOverflow) {
-  if (!AllowSlowTests()) {
-    LOG(INFO) << "Skipping test because it sleeps for ~4s";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   // This quantity (~4s sleep) overflows a 32-bit integer such that
   // the value becomes 0.
diff --git a/src/kudu/util/test_util.h b/src/kudu/util/test_util.h
index 6dbb37b..d9150d7 100644
--- a/src/kudu/util/test_util.h
+++ b/src/kudu/util/test_util.h
@@ -35,7 +35,7 @@
 #define SKIP_IF_SLOW_NOT_ALLOWED() do { \
   if (!AllowSlowTests()) { \
     LOG(WARNING) << "test is skipped; set KUDU_ALLOW_SLOW_TESTS=1 to run"; \
-    return; \
+    GTEST_SKIP(); \
   } \
 } while (0)
 
diff --git a/src/kudu/util/thread-test.cc b/src/kudu/util/thread-test.cc
index 4da7223..524027c 100644
--- a/src/kudu/util/thread-test.cc
+++ b/src/kudu/util/thread-test.cc
@@ -20,7 +20,6 @@
 #include <unistd.h>
 
 #include <functional>
-#include <ostream>
 #include <string>
 #include <vector>
 
@@ -46,10 +45,7 @@ class ThreadTest : public KuduTest {};
 // Join with a thread and emit warnings while waiting to join.
 // This has to be manually verified.
 TEST_F(ThreadTest, TestJoinAndWarn) {
-  if (!AllowSlowTests()) {
-    LOG(INFO) << "Skipping test in quick test mode, since this sleeps";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   scoped_refptr<Thread> holder;
   ASSERT_OK(Thread::Create("test", "sleeper thread",
@@ -61,10 +57,7 @@ TEST_F(ThreadTest, TestJoinAndWarn) {
 }
 
 TEST_F(ThreadTest, TestFailedJoin) {
-  if (!AllowSlowTests()) {
-    LOG(INFO) << "Skipping test in quick test mode, since this sleeps";
-    return;
-  }
+  SKIP_IF_SLOW_NOT_ALLOWED();
 
   scoped_refptr<Thread> holder;
   ASSERT_OK(Thread::Create("test", "sleeper thread",

Reply via email to