Fixed `SlaveRecoveryTest.ReconcileTasksMissingFromSlave`.

Because it is not possible to delete a file (or a folder recursively)
with open handles on Windows, we have to explicitly `reset()` the agent
before removing the framework meta directory. Otherwise, the task status
update manager will be destructed too late, and so an open handle for
`task.updates` will cause the `os::rmdir` to fail.

This is safe because we previously destructed the agent anyway, just
later in the test when it was reassigned.

Review: https://reviews.apache.org/r/65409


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/0bc1c8ce
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/0bc1c8ce
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/0bc1c8ce

Branch: refs/heads/master
Commit: 0bc1c8ce3d0a84419c96f696e8e8c56c9ad85c79
Parents: e4b3199
Author: Andrew Schwartzmeyer <and...@schwartzmeyer.com>
Authored: Wed Jan 10 14:41:51 2018 -0800
Committer: Andrew Schwartzmeyer <and...@schwartzmeyer.com>
Committed: Fri Feb 9 12:08:35 2018 -0800

----------------------------------------------------------------------
 src/tests/slave_recovery_tests.cpp | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/0bc1c8ce/src/tests/slave_recovery_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_recovery_tests.cpp 
b/src/tests/slave_recovery_tests.cpp
index 762cebe..898270d 100644
--- a/src/tests/slave_recovery_tests.cpp
+++ b/src/tests/slave_recovery_tests.cpp
@@ -3831,6 +3831,11 @@ TYPED_TEST(SlaveRecoveryTest, 
ReconcileTasksMissingFromSlave)
 
   slave.get()->terminate();
 
+  // Reset the slave so that the task status update stream destructors are
+  // called. This is necessary so that file handles are closed before we remove
+  // the framework meta directory (specifically for `task.updates`).
+  slave->reset();
+
   // Construct the framework meta directory that needs wiping.
   string frameworkPath = paths::getFrameworkPath(
       paths::getMetaRootDir(flags.work_dir),

Reply via email to