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

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


The following commit(s) were added to refs/heads/master by this push:
     new 0a69035  Fixed flakiness in the `CreateDestroyDiskRecovery` SLRP test.
0a69035 is described below

commit 0a69035deb7a89070c647562c2c2122b2016bf91
Author: Chun-Hung Hsiao <[email protected]>
AuthorDate: Tue Aug 28 14:42:15 2018 -0700

    Fixed flakiness in the `CreateDestroyDiskRecovery` SLRP test.
    
    Review: https://reviews.apache.org/r/68550
---
 .../storage_local_resource_provider_tests.cpp      | 24 ++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/tests/storage_local_resource_provider_tests.cpp 
b/src/tests/storage_local_resource_provider_tests.cpp
index 997154a..9d0020c 100644
--- a/src/tests/storage_local_resource_provider_tests.cpp
+++ b/src/tests/storage_local_resource_provider_tests.cpp
@@ -848,11 +848,17 @@ TEST_F(StorageLocalResourceProviderTest, 
CreateDestroyDisk)
 
 // This test verifies that the storage local resource provider can
 // destroy a volume created from a storage pool after recovery.
-TEST_F(StorageLocalResourceProviderTest, DISABLED_CreateDestroyDiskRecovery)
+TEST_F(StorageLocalResourceProviderTest, CreateDestroyDiskRecovery)
 {
-  const string profilesPath = path::join(sandbox.get(), "profiles.json");
-  ASSERT_SOME(os::write(profilesPath, createDiskProfileMapping("test")));
-  loadUriDiskProfileAdaptorModule(profilesPath);
+  Future<shared_ptr<TestDiskProfileServer>> server =
+    TestDiskProfileServer::create();
+  AWAIT_READY(server);
+
+  Promise<http::Response> recoveredProfileMapping;
+  EXPECT_CALL(*server.get()->process, profiles(_))
+    .WillOnce(Return(http::OK(createDiskProfileMapping("test"))))
+    .WillOnce(Return(recoveredProfileMapping.future()));
+  loadUriDiskProfileAdaptorModule(stringify(server.get()->process->url()));
 
   setupResourceProviderConfig(Gigabytes(4));
 
@@ -1012,11 +1018,21 @@ TEST_F(StorageLocalResourceProviderTest, 
DISABLED_CreateDestroyDiskRecovery)
     .InSequence(offers)
     .WillOnce(FutureArg<1>(&volumeDestroyedOffers));
 
+  Future<UpdateOperationStatusMessage> destroyDiskStatus =
+    FUTURE_PROTOBUF(UpdateOperationStatusMessage(), _, _);
+
   driver.acceptOffers(
       {slaveRecoveredOffers->at(0).id()},
       {DESTROY_DISK(volume.get())},
       acceptFilters);
 
+  AWAIT_READY(destroyDiskStatus);
+  EXPECT_EQ(OPERATION_FINISHED, destroyDiskStatus->status().state());
+
+  // NOTE: We update the disk profile mapping after the `DESTROY_DISK` 
operation
+  // is applied, otherwise it could be dropped due to reconciling storage 
pools.
+  recoveredProfileMapping.set(http::OK(createDiskProfileMapping("test")));
+
   AWAIT_READY(volumeDestroyedOffers);
   ASSERT_FALSE(volumeDestroyedOffers->empty());
 

Reply via email to