Updated disk profile tests due to changes in the module interface.

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


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

Branch: refs/heads/master
Commit: 2da758eb03801bce716e87521a65357fa13e2d06
Parents: 542776b
Author: Chun-Hung Hsiao <chhs...@mesosphere.io>
Authored: Thu Feb 8 14:41:20 2018 -0800
Committer: Jie Yu <yujie....@gmail.com>
Committed: Thu Feb 8 16:24:02 2018 -0800

----------------------------------------------------------------------
 src/tests/disk_profile_tests.cpp | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2da758eb/src/tests/disk_profile_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/disk_profile_tests.cpp b/src/tests/disk_profile_tests.cpp
index b6b35ef..d75765e 100644
--- a/src/tests/disk_profile_tests.cpp
+++ b/src/tests/disk_profile_tests.cpp
@@ -299,7 +299,10 @@ TEST_F(UriDiskProfileTest, FetchFromFile)
   const string profileName = "profile";
   const string profileFile = path::join(sandbox.get(), "profiles.json");
   const Duration pollInterval = Seconds(10);
-  const string csiPluginType = "ignored";
+
+  ResourceProviderInfo resourceProviderInfo;
+  resourceProviderInfo.set_type("ignored");
+  resourceProviderInfo.set_name("ignored");
 
   Parameters params;
 
@@ -328,7 +331,7 @@ TEST_F(UriDiskProfileTest, FetchFromFile)
   // because when the module reads from file, it does so immediately upon
   // being initialized.
   Future<hashset<string>> future =
-    module.get()->watch(hashset<string>::EMPTY, csiPluginType);
+    module.get()->watch(hashset<string>::EMPTY, resourceProviderInfo);
 
   // Write the single profile to the file.
   ASSERT_SOME(os::write(profileFile, contents));
@@ -342,7 +345,7 @@ TEST_F(UriDiskProfileTest, FetchFromFile)
 
   // Translate the profile name into the profile mapping.
   Future<DiskProfileAdaptor::ProfileInfo> mapping =
-    module.get()->translate(profileName, csiPluginType);
+    module.get()->translate(profileName, resourceProviderInfo);
 
   AWAIT_ASSERT_READY(mapping);
   ASSERT_TRUE(mapping.get().capability.has_block());
@@ -438,7 +441,10 @@ TEST_F(UriDiskProfileTest, FetchFromHTTP)
     })~";
 
   const Duration pollInterval = Seconds(10);
-  const string csiPluginType = "ignored";
+
+  ResourceProviderInfo resourceProviderInfo;
+  resourceProviderInfo.set_type("ignored");
+  resourceProviderInfo.set_name("ignored");
 
   ServerWrapper server;
 
@@ -476,14 +482,14 @@ TEST_F(UriDiskProfileTest, FetchFromHTTP)
 
   // Wait for the first HTTP poll to complete.
   Future<hashset<string>> future =
-    module.get()->watch(hashset<string>::EMPTY, csiPluginType);
+    module.get()->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"}, csiPluginType);
+  future = module.get()->watch({"profile"}, resourceProviderInfo);
 
   // Trigger the second HTTP poll.
   Clock::advance(pollInterval);
@@ -491,7 +497,7 @@ TEST_F(UriDiskProfileTest, 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", csiPluginType));
+  AWAIT_ASSERT_READY(module.get()->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

Reply via email to