Repository: mesos Updated Branches: refs/heads/master d58e6351b -> 33e6a23e9
Fixed two leaks in UriDiskProfileAdaptorTests. Original code in: https://reviews.apache.org/r/65640/ These leaks cause log lines like the following to appear throughout test output: process.cpp:2746] Returning '404 Not Found' for '/(97)/profiles' uri_disk_profile_adaptor.cpp:225] Failed to parse result: ... This leads to unnecessary confusion when viewing other test failures. Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/33e6a23e Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/33e6a23e Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/33e6a23e Branch: refs/heads/master Commit: 33e6a23e9ca967e9659236edc7a50e7d4f363a03 Parents: d58e635 Author: Joseph Wu <[email protected]> Authored: Mon Apr 23 11:57:31 2018 -0700 Committer: Joseph Wu <[email protected]> Committed: Mon Apr 23 14:17:54 2018 -0700 ---------------------------------------------------------------------- src/tests/disk_profile_adaptor_tests.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/33e6a23e/src/tests/disk_profile_adaptor_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/disk_profile_adaptor_tests.cpp b/src/tests/disk_profile_adaptor_tests.cpp index 3337741..ce11d47 100644 --- a/src/tests/disk_profile_adaptor_tests.cpp +++ b/src/tests/disk_profile_adaptor_tests.cpp @@ -450,18 +450,20 @@ TEST_F(UriDiskProfileAdaptorTest, DISABLED_FetchFromFile) // Create the module before we've written anything to the file. // This means the first poll will fail, so the module believes there // are no profiles at the moment. - Try<DiskProfileAdaptor*> module = + Try<DiskProfileAdaptor*> _module = modules::ModuleManager::create<DiskProfileAdaptor>( URI_DISK_PROFILE_ADAPTOR_NAME, params); - ASSERT_SOME(module); + + ASSERT_SOME(_module); + Owned<DiskProfileAdaptor> module(_module.get()); // Start watching for updates. // By the time this returns, we'll know that the first poll has finished // because when the module reads from file, it does so immediately upon // being initialized. Future<hashset<string>> future = - module.get()->watch(hashset<string>::EMPTY, resourceProviderInfo); + module->watch(hashset<string>::EMPTY, resourceProviderInfo); // Write the single profile to the file. ASSERT_SOME(os::write(profileFile, contents)); @@ -475,7 +477,7 @@ TEST_F(UriDiskProfileAdaptorTest, DISABLED_FetchFromFile) // Translate the profile name into the profile mapping. Future<DiskProfileAdaptor::ProfileInfo> mapping = - module.get()->translate(profileName, resourceProviderInfo); + module->translate(profileName, resourceProviderInfo); AWAIT_ASSERT_READY(mapping); ASSERT_TRUE(mapping.get().capability.has_block()); @@ -638,22 +640,24 @@ TEST_F(UriDiskProfileAdaptorTest, FetchFromHTTP) process::address().port, server.process->self().id + "/profiles"))); - Try<DiskProfileAdaptor*> module = + Try<DiskProfileAdaptor*> _module = modules::ModuleManager::create<DiskProfileAdaptor>( URI_DISK_PROFILE_ADAPTOR_NAME, params); - ASSERT_SOME(module); + + ASSERT_SOME(_module); + Owned<DiskProfileAdaptor> module(_module.get()); // Wait for the first HTTP poll to complete. Future<hashset<string>> future = - module.get()->watch(hashset<string>::EMPTY, resourceProviderInfo); + module->watch(hashset<string>::EMPTY, resourceProviderInfo); AWAIT_ASSERT_READY(future); ASSERT_EQ(1u, future->size()); EXPECT_EQ("profile", *(future->begin())); // Start watching for an update to the list of profiles. - future = module.get()->watch({"profile"}, resourceProviderInfo); + future = module->watch({"profile"}, resourceProviderInfo); // Trigger the second HTTP poll. Clock::advance(pollInterval); @@ -661,7 +665,7 @@ TEST_F(UriDiskProfileAdaptorTest, FetchFromHTTP) // Dispatch a call to the module, which ensures that the polling has actually // completed (not just the HTTP call). - AWAIT_ASSERT_READY(module.get()->translate("profile", resourceProviderInfo)); + AWAIT_ASSERT_READY(module->translate("profile", resourceProviderInfo)); // We don't expect the module to notify watcher(s) because the server's // response is considered invalid (the module does not allow profiles
