From 80c5fd48e17757919ff0788cf45a1fef5529fef9 Mon Sep 17 00:00:00 2001
From: florijan <florijan@memgraph.io>
Date: Fri, 12 Jan 2018 16:45:45 +0100
Subject: [PATCH] Reduce durability test flakyness

Summary:
Reduce flakyness by ensuring the first database gets destructed before
taking wal-file count.

Reviewers: teon.banek, mferencevic, dgleich

Reviewed By: mferencevic, dgleich

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1105
---
 tests/unit/durability.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tests/unit/durability.cpp b/tests/unit/durability.cpp
index c40b56e29..460b40cc1 100644
--- a/tests/unit/durability.cpp
+++ b/tests/unit/durability.cpp
@@ -674,10 +674,9 @@ TEST_F(Durability, NoWalDuringRecovery) {
 
     // Sleep to ensure the WAL gets flushed.
     std::this_thread::sleep_for(std::chrono::milliseconds(50));
-
-    wal_files_before = DirFiles(wal_dir_).size();
-    ASSERT_GT(wal_files_before, 3);
   }
+  wal_files_before = DirFiles(wal_dir_).size();
+  ASSERT_GT(wal_files_before, 3);
   {
     auto recovered_config = DbConfig();
     recovered_config.db_recover_on_startup = true;