You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ch...@apache.org on 2018/11/29 18:31:37 UTC

[mesos] 13/14: Recovered disk through `CREATE_DISK` in test `AgentRegisteredWithNewId`.

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

commit ea4534a39ec5823f13e7b62bf9928faf79c4e881
Author: Chun-Hung Hsiao <ch...@mesosphere.io>
AuthorDate: Wed Nov 14 20:27:09 2018 -0800

    Recovered disk through `CREATE_DISK` in test `AgentRegisteredWithNewId`.
    
    Test `AgentRegisteredWithNewId` is now improved to exercise the code
    path for recovering disks created by the last agent through
    `CREATE_DISK`.
    
    Review: https://reviews.apache.org/r/69365
---
 .../storage_local_resource_provider_tests.cpp      | 351 ++++++++++++++-------
 1 file changed, 233 insertions(+), 118 deletions(-)

diff --git a/src/tests/storage_local_resource_provider_tests.cpp b/src/tests/storage_local_resource_provider_tests.cpp
index e2a4d02..8c88c14 100644
--- a/src/tests/storage_local_resource_provider_tests.cpp
+++ b/src/tests/storage_local_resource_provider_tests.cpp
@@ -67,6 +67,7 @@ using process::post;
 using process::reap;
 
 using testing::AtMost;
+using testing::Between;
 using testing::DoAll;
 using testing::Not;
 using testing::Sequence;
@@ -192,7 +193,8 @@ public:
 
   void setupResourceProviderConfig(
       const Bytes& capacity,
-      const Option<string> volumes = None())
+      const Option<string> volumes = None(),
+      const Option<string> createParameters = None())
   {
     const string testCsiPluginName = "test_csi_plugin";
 
@@ -230,6 +232,7 @@ public:
                     "arguments": [
                       "%s",
                       "--available_capacity=%s",
+                      "--create_parameters=%s",
                       "--volumes=%s",
                       "--work_dir=%s"
                     ]
@@ -262,6 +265,7 @@ public:
         testCsiPluginPath,
         testCsiPluginPath,
         stringify(capacity),
+        createParameters.getOrElse(""),
         volumes.getOrElse(""),
         testCsiPluginWorkDir);
 
@@ -273,34 +277,41 @@ public:
   }
 
   // Create a JSON string representing a disk profile mapping containing the
-  // given profile.
-  static string createDiskProfileMapping(const string& profile)
+  // given profile-parameter pairs.
+  static string createDiskProfileMapping(
+      const hashmap<string, Option<JSON::Object>>& profiles)
   {
-    Try<string> diskProfileMapping = strings::format(
-        R"~(
-        {
-          "profile_matrix": {
-            "%s": {
-              "csi_plugin_type_selector": {
-                "plugin_type": "org.apache.mesos.csi.test"
-              },
-              "volume_capabilities": {
-                "mount": {},
-                "access_mode": {
-                  "mode": "SINGLE_NODE_WRITER"
-                }
-              }
-            }
-          }
-        }
-        )~",
-        profile);
-
-    // This extra closure is necessary in order to use `ASSERT_*`, as
-    // these macros require a void return type.
-    [&] { ASSERT_SOME(diskProfileMapping); }();
+    JSON::Object diskProfileMapping{
+      {"profile_matrix", JSON::Object{}}
+    };
+
+    foreachpair (const string& profile,
+                 const Option<JSON::Object>& parameters,
+                 profiles) {
+      JSON::Object profileInfo{
+        {"csi_plugin_type_selector", JSON::Object{
+          {"plugin_type", "org.apache.mesos.csi.test"}
+        }},
+        {"volume_capabilities", JSON::Object{
+          {"mount", JSON::Object{}},
+          {"access_mode", JSON::Object{
+            {"mode", "SINGLE_NODE_WRITER"}
+          }}
+        }}};
+
+      diskProfileMapping
+        .values.at("profile_matrix").as<JSON::Object>()
+        .values.emplace(profile, profileInfo);
+
+      if (parameters.isSome()) {
+        diskProfileMapping
+          .values.at("profile_matrix").as<JSON::Object>()
+          .values.at(profile).as<JSON::Object>()
+          .values.emplace("create_parameters", parameters.get());
+      }
+    }
 
-    return diskProfileMapping.get();
+    return stringify(diskProfileMapping);
   }
 
   string metricName(const string& basename)
@@ -454,7 +465,10 @@ TEST_F(StorageLocalResourceProviderTest, DISABLED_ZeroSizedDisk)
 TEST_F(StorageLocalResourceProviderTest, DISABLED_SmallDisk)
 {
   const string profilesPath = path::join(sandbox.get(), "profiles.json");
-  ASSERT_SOME(os::write(profilesPath, createDiskProfileMapping("test")));
+
+  ASSERT_SOME(
+      os::write(profilesPath, createDiskProfileMapping({{"test", None()}})));
+
   loadUriDiskProfileAdaptorModule(profilesPath);
 
   setupResourceProviderConfig(Kilobytes(512), "volume0:512KB");
@@ -649,7 +663,8 @@ TEST_F(StorageLocalResourceProviderTest, ProfileAppeared)
   Clock::settle();
 
   // Update the disk profile mapping.
-  updatedProfileMapping.set(http::OK(createDiskProfileMapping("test")));
+  updatedProfileMapping.set(
+      http::OK(createDiskProfileMapping({{"test", None()}})));
 
   // Advance the clock to make sure another allocation is triggered.
   Clock::advance(masterFlags.allocation_interval);
@@ -681,7 +696,10 @@ TEST_F(StorageLocalResourceProviderTest, ProfileAppeared)
 TEST_F(StorageLocalResourceProviderTest, CreateDestroyDisk)
 {
   const string profilesPath = path::join(sandbox.get(), "profiles.json");
-  ASSERT_SOME(os::write(profilesPath, createDiskProfileMapping("test")));
+
+  ASSERT_SOME(
+      os::write(profilesPath, createDiskProfileMapping({{"test", None()}})));
+
   loadUriDiskProfileAdaptorModule(profilesPath);
 
   setupResourceProviderConfig(Gigabytes(4));
@@ -856,8 +874,9 @@ TEST_F(StorageLocalResourceProviderTest, CreateDestroyDiskRecovery)
 
   Promise<http::Response> recoveredProfileMapping;
   EXPECT_CALL(*server.get()->process, profiles(_))
-    .WillOnce(Return(http::OK(createDiskProfileMapping("test"))))
+    .WillOnce(Return(http::OK(createDiskProfileMapping({{"test", None()}}))))
     .WillOnce(Return(recoveredProfileMapping.future()));
+
   loadUriDiskProfileAdaptorModule(stringify(server.get()->process->url()));
 
   setupResourceProviderConfig(Gigabytes(4));
@@ -1027,7 +1046,8 @@ TEST_F(StorageLocalResourceProviderTest, CreateDestroyDiskRecovery)
 
   // 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")));
+  recoveredProfileMapping.set(
+      http::OK(createDiskProfileMapping({{"test", None()}})));
 
   AWAIT_READY(volumeDestroyedOffers);
   ASSERT_FALSE(volumeDestroyedOffers->empty());
@@ -1064,7 +1084,7 @@ TEST_F(StorageLocalResourceProviderTest, ProfileDisappeared)
 
   Promise<http::Response> updatedProfileMapping;
   EXPECT_CALL(*server.get()->process, profiles(_))
-    .WillOnce(Return(http::OK(createDiskProfileMapping("test1"))))
+    .WillOnce(Return(http::OK(createDiskProfileMapping({{"test1", None()}}))))
     .WillOnce(Return(updatedProfileMapping.future()));
 
   const Duration pollInterval = Seconds(10);
@@ -1230,7 +1250,8 @@ TEST_F(StorageLocalResourceProviderTest, ProfileDisappeared)
   Clock::advance(pollInterval);
 
   // Update the disk profile mapping.
-  updatedProfileMapping.set(http::OK(createDiskProfileMapping("test2")));
+  updatedProfileMapping.set(
+      http::OK(createDiskProfileMapping({{"test2", None()}})));
 
   AWAIT_READY(updateSlave3);
 
@@ -1413,14 +1434,18 @@ TEST_F(StorageLocalResourceProviderTest, AgentFailoverPluginKilled)
 
 // This test verifies that if an agent is registered with a new ID,
 // the ID of the resource provider would be changed as well, and any
-// created volume becomes a pre-existing volume.
+// created volume becomes a preprovisioned volume.
 TEST_F(StorageLocalResourceProviderTest, AgentRegisteredWithNewId)
 {
   const string profilesPath = path::join(sandbox.get(), "profiles.json");
-  ASSERT_SOME(os::write(profilesPath, createDiskProfileMapping("test")));
+
+  ASSERT_SOME(os::write(profilesPath, createDiskProfileMapping(
+      {{"test1", JSON::Object{{"label", "foo"}}},
+       {"test2", None()}})));
+
   loadUriDiskProfileAdaptorModule(profilesPath);
 
-  setupResourceProviderConfig(Gigabytes(4));
+  setupResourceProviderConfig(Gigabytes(2), None(), "label=foo");
 
   Try<Owned<cluster::Master>> master = StartMaster();
   ASSERT_SOME(master);
@@ -1449,17 +1474,21 @@ TEST_F(StorageLocalResourceProviderTest, AgentRegisteredWithNewId)
   EXPECT_CALL(sched, registered(&driver, _, _));
 
   // The framework is expected to see the following offers in sequence:
-  //   1. One containing a RAW disk resource before `CREATE_DISK`.
-  //   2. One containing a MOUNT disk resource after `CREATE_DISK`.
-  //   3. One containing a RAW pre-existing volume after the agent
-  //      is registered with a new ID.
+  //   1. One containing a RAW disk resource before the 1st `CREATE_DISK`.
+  //   2. One containing a MOUNT disk resource after the 1st `CREATE_DISK`.
+  //   3. One containing a RAW preprovisioned volume after the agent is
+  //      registered with a new ID.
+  //   4. One containing the same preprovisioned volume after the 2nd
+  //      `CREATE_DISK` that specifies a wrong profile.
+  //   5. One containing a MOUNT disk resource after the 3rd `CREATE_DISK` that
+  //      specifies the correct profile.
   //
   // We set up the expectations for these offers as the test progresses.
   Future<vector<Offer>> rawDiskOffers;
-  Future<vector<Offer>> volumeCreatedOffers;
+  Future<vector<Offer>> diskCreatedOffers;
   Future<vector<Offer>> slaveRecoveredOffers;
-
-  Sequence offers;
+  Future<vector<Offer>> operationFailedOffers;
+  Future<vector<Offer>> diskRecoveredOffers;
 
   // We use the following filter to filter offers that do not have
   // wanted resources for 365 days (the maximum).
@@ -1470,44 +1499,42 @@ TEST_F(StorageLocalResourceProviderTest, AgentRegisteredWithNewId)
   EXPECT_CALL(sched, resourceOffers(&driver, _))
     .WillRepeatedly(DeclineOffers(declineFilters));
 
-  // Before the agent fails over, we are interested in any storage pool or
-  // volume with a "test" profile.
-  auto hasSourceType = [](
-      const Resource& r,
-      const Resource::DiskInfo::Source::Type& type) {
+  // Before the agent fails over, we are interested in the 'test1' storage pool.
+  auto isStoragePool = [](const Resource& r, const string& profile) {
     return r.has_disk() &&
       r.disk().has_source() &&
+      r.disk().source().type() == Resource::DiskInfo::Source::RAW &&
+      !r.disk().source().has_id() &&
       r.disk().source().has_profile() &&
-      r.disk().source().profile() == "test" &&
-      r.disk().source().type() == type;
+      r.disk().source().profile() == profile;
   };
 
   EXPECT_CALL(sched, resourceOffers(&driver, OffersHaveAnyResource(
-      std::bind(hasSourceType, lambda::_1, Resource::DiskInfo::Source::RAW))))
-    .InSequence(offers)
+      std::bind(isStoragePool, lambda::_1, "test1"))))
     .WillOnce(FutureArg<1>(&rawDiskOffers));
 
   driver.start();
 
   AWAIT_READY(rawDiskOffers);
-  ASSERT_FALSE(rawDiskOffers->empty());
-
-  Option<Resource> source;
+  ASSERT_EQ(1u, rawDiskOffers->size());
 
-  foreach (const Resource& resource, rawDiskOffers->at(0).resources()) {
-    if (hasSourceType(resource, Resource::DiskInfo::Source::RAW)) {
-      source = resource;
-      break;
-    }
-  }
+  Resource raw = *Resources(rawDiskOffers->at(0).resources())
+    .filter(std::bind(isStoragePool, lambda::_1, "test1"))
+    .begin();
 
-  ASSERT_SOME(source);
+  auto isMountDisk = [](const Resource& r, const string& profile) {
+    return r.has_disk() &&
+      r.disk().has_source() &&
+      r.disk().source().type() == Resource::DiskInfo::Source::MOUNT &&
+      r.disk().source().has_id() &&
+      r.disk().source().has_profile() &&
+      r.disk().source().profile() == profile;
+  };
 
-  // Create a volume.
+  // Create a MOUNT disk of profile 'test1'.
   EXPECT_CALL(sched, resourceOffers(&driver, OffersHaveAnyResource(
-      std::bind(hasSourceType, lambda::_1, Resource::DiskInfo::Source::MOUNT))))
-    .InSequence(offers)
-    .WillOnce(FutureArg<1>(&volumeCreatedOffers));
+      std::bind(isMountDisk, lambda::_1, "test1"))))
+    .WillOnce(FutureArg<1>(&diskCreatedOffers));
 
   // We use the following filter so that the resources will not be
   // filtered for 5 seconds (the default).
@@ -1516,34 +1543,27 @@ TEST_F(StorageLocalResourceProviderTest, AgentRegisteredWithNewId)
 
   driver.acceptOffers(
       {rawDiskOffers->at(0).id()},
-      {CREATE_DISK(source.get(), Resource::DiskInfo::Source::MOUNT)},
+      {CREATE_DISK(raw, Resource::DiskInfo::Source::MOUNT)},
       acceptFilters);
 
-  AWAIT_READY(volumeCreatedOffers);
-  ASSERT_FALSE(volumeCreatedOffers->empty());
-
-  Option<Resource> createdVolume;
+  AWAIT_READY(diskCreatedOffers);
+  ASSERT_EQ(1u, diskCreatedOffers->size());
 
-  foreach (const Resource& resource, volumeCreatedOffers->at(0).resources()) {
-    if (hasSourceType(resource, Resource::DiskInfo::Source::MOUNT)) {
-      createdVolume = resource;
-      break;
-    }
-  }
+  Resource created = *Resources(diskCreatedOffers->at(0).resources())
+    .filter(std::bind(isMountDisk, lambda::_1, "test1"))
+    .begin();
 
-  ASSERT_SOME(createdVolume);
-  ASSERT_TRUE(createdVolume->has_provider_id());
-  ASSERT_TRUE(createdVolume->disk().source().has_id());
-  ASSERT_TRUE(createdVolume->disk().source().has_metadata());
-  ASSERT_TRUE(createdVolume->disk().source().has_mount());
-  ASSERT_TRUE(createdVolume->disk().source().mount().has_root());
-  EXPECT_FALSE(path::absolute(createdVolume->disk().source().mount().root()));
+  ASSERT_TRUE(created.has_provider_id());
+  ASSERT_TRUE(created.disk().source().has_id());
+  ASSERT_TRUE(created.disk().source().has_metadata());
+  ASSERT_TRUE(created.disk().source().has_mount());
+  ASSERT_TRUE(created.disk().source().mount().has_root());
+  EXPECT_FALSE(path::absolute(created.disk().source().mount().root()));
 
   // Check if the volume is actually created by the test CSI plugin.
   Option<string> volumePath;
 
-  foreach (const Label& label,
-           createdVolume->disk().source().metadata().labels()) {
+  foreach (const Label& label, created.disk().source().metadata().labels()) {
     if (label.key() == "path") {
       volumePath = label.value();
       break;
@@ -1554,7 +1574,14 @@ TEST_F(StorageLocalResourceProviderTest, AgentRegisteredWithNewId)
   EXPECT_TRUE(os::exists(volumePath.get()));
 
   // Shut down the agent.
-  EXPECT_CALL(sched, offerRescinded(_, _));
+  //
+  // NOTE: In addition to the last offer being rescinded, the master may send
+  // an offer after receiving an `UpdateSlaveMessage` containing only the
+  // preprovisioned volume, and then receive another `UpdateSlaveMessage`
+  // containing both the volume and a 'test1' storage pool of before the offer
+  // gets declined. In this case, the offer will be rescinded as well.
+  EXPECT_CALL(sched, offerRescinded(&driver, _))
+    .Times(Between(1, 2));
 
   slave.get()->terminate();
 
@@ -1562,23 +1589,34 @@ TEST_F(StorageLocalResourceProviderTest, AgentRegisteredWithNewId)
   const string metaDir = slave::paths::getMetaRootDir(slaveFlags.work_dir);
   ASSERT_SOME(os::rm(slave::paths::getLatestSlavePath(metaDir)));
 
+  // NOTE: We setup up the resource provider with an extra storage pool, so that
+  // when the storage pool is offered, we know that the corresponding profile is
+  // known to the resource provider.
+  setupResourceProviderConfig(Gigabytes(4), None(), "label=foo");
+
   // A new registration would trigger another `SlaveRegisteredMessage`.
   slaveRegisteredMessage =
     FUTURE_PROTOBUF(SlaveRegisteredMessage(), _, Not(slave.get()->pid));
 
   // After the agent fails over, any volume created before becomes a
-  // pre-existing volume, which has an ID but no profile.
-  auto isPreExistingVolume = [](const Resource& r) {
+  // preprovisioned volume, which has an ID but no profile.
+  auto isPreprovisionedVolume = [](const Resource& r) {
     return r.has_disk() &&
       r.disk().has_source() &&
+      r.disk().source().type() == Resource::DiskInfo::Source::RAW &&
       r.disk().source().has_id() &&
       !r.disk().source().has_profile();
   };
 
+  // NOTE: Instead of expecting a preprovisioned volume, we expect an offer with
+  // a 'test1' storage pool as an indication that the profile is known to the
+  // resource provider. The offer should also have the preprovisioned volume.
+  // But, an extra offer with the storage pool may be received as a side effect
+  // of this workaround, so we decline it if this happens.
   EXPECT_CALL(sched, resourceOffers(&driver, OffersHaveAnyResource(
-      isPreExistingVolume)))
-    .InSequence(offers)
-    .WillOnce(FutureArg<1>(&slaveRecoveredOffers));
+      std::bind(isStoragePool, lambda::_1, "test1"))))
+    .WillOnce(FutureArg<1>(&slaveRecoveredOffers))
+    .WillRepeatedly(DeclineOffers(declineFilters));
 
   slave = StartSlave(detector.get(), slaveFlags);
   ASSERT_SOME(slave);
@@ -1586,23 +1624,65 @@ TEST_F(StorageLocalResourceProviderTest, AgentRegisteredWithNewId)
   AWAIT_READY(slaveRegisteredMessage);
 
   AWAIT_READY(slaveRecoveredOffers);
-  ASSERT_FALSE(slaveRecoveredOffers->empty());
+  ASSERT_EQ(1u, slaveRecoveredOffers->size());
 
-  Option<Resource> preExistingVolume;
+  Resources _preprovisioned = Resources(slaveRecoveredOffers->at(0).resources())
+    .filter(isPreprovisionedVolume);
 
-  foreach (const Resource& resource, slaveRecoveredOffers->at(0).resources()) {
-    if (isPreExistingVolume(resource) &&
-        resource.disk().source().type() == Resource::DiskInfo::Source::RAW) {
-      preExistingVolume = resource;
-    }
-  }
+  ASSERT_SOME_EQ(Gigabytes(2), _preprovisioned.disk());
 
-  ASSERT_SOME(preExistingVolume);
-  ASSERT_TRUE(preExistingVolume->has_provider_id());
-  ASSERT_NE(createdVolume->provider_id(), preExistingVolume->provider_id());
+  Resource preprovisioned = *_preprovisioned.begin();
+  ASSERT_TRUE(preprovisioned.has_provider_id());
+  ASSERT_NE(created.provider_id(), preprovisioned.provider_id());
+  ASSERT_EQ(created.disk().source().id(), preprovisioned.disk().source().id());
   ASSERT_EQ(
-      createdVolume->disk().source().id(),
-      preExistingVolume->disk().source().id());
+      created.disk().source().metadata(),
+      preprovisioned.disk().source().metadata());
+
+  // Apply profile 'test2' to the preprovisioned volume, which will fail.
+  EXPECT_CALL(
+      sched, resourceOffers(&driver, OffersHaveResource(preprovisioned)))
+    .WillOnce(FutureArg<1>(&operationFailedOffers));
+
+  Future<UpdateOperationStatusMessage> operationFailedStatus =
+    FUTURE_PROTOBUF(UpdateOperationStatusMessage(), _, _);
+
+  driver.acceptOffers(
+      {slaveRecoveredOffers->at(0).id()},
+      {CREATE_DISK(preprovisioned, Resource::DiskInfo::Source::MOUNT, "test2")},
+      acceptFilters);
+
+  AWAIT_READY(operationFailedStatus);
+  EXPECT_EQ(OPERATION_FAILED, operationFailedStatus->status().state());
+
+  AWAIT_READY(operationFailedOffers);
+  ASSERT_EQ(1u, operationFailedOffers->size());
+
+  // Apply profile 'test1' to the preprovisioned volume, which will succeed.
+  EXPECT_CALL(sched, resourceOffers(&driver, OffersHaveAnyResource(
+      std::bind(isMountDisk, lambda::_1, "test1"))))
+    .WillOnce(FutureArg<1>(&diskRecoveredOffers));
+
+  driver.acceptOffers(
+      {operationFailedOffers->at(0).id()},
+      {CREATE_DISK(preprovisioned, Resource::DiskInfo::Source::MOUNT, "test1")},
+      acceptFilters);
+
+  AWAIT_READY(diskRecoveredOffers);
+  ASSERT_EQ(1u, diskRecoveredOffers->size());
+
+  Resource recovered = *Resources(diskRecoveredOffers->at(0).resources())
+    .filter(std::bind(isMountDisk, lambda::_1, "test1"))
+    .begin();
+
+  ASSERT_EQ(preprovisioned.provider_id(), recovered.provider_id());
+
+  ASSERT_EQ(
+      preprovisioned.disk().source().id(), recovered.disk().source().id());
+
+  ASSERT_EQ(
+      preprovisioned.disk().source().metadata(),
+      recovered.disk().source().metadata());
 }
 
 
@@ -1612,7 +1692,10 @@ TEST_F(StorageLocalResourceProviderTest, AgentRegisteredWithNewId)
 TEST_F(StorageLocalResourceProviderTest, ROOT_PublishResources)
 {
   const string profilesPath = path::join(sandbox.get(), "profiles.json");
-  ASSERT_SOME(os::write(profilesPath, createDiskProfileMapping("test")));
+
+  ASSERT_SOME(
+      os::write(profilesPath, createDiskProfileMapping({{"test", None()}})));
+
   loadUriDiskProfileAdaptorModule(profilesPath);
 
   setupResourceProviderConfig(Gigabytes(4));
@@ -1821,7 +1904,10 @@ TEST_F(StorageLocalResourceProviderTest, ROOT_PublishResources)
 TEST_F(StorageLocalResourceProviderTest, ROOT_PublishResourcesRecovery)
 {
   const string profilesPath = path::join(sandbox.get(), "profiles.json");
-  ASSERT_SOME(os::write(profilesPath, createDiskProfileMapping("test")));
+
+  ASSERT_SOME(
+      os::write(profilesPath, createDiskProfileMapping({{"test", None()}})));
+
   loadUriDiskProfileAdaptorModule(profilesPath);
 
   setupResourceProviderConfig(Gigabytes(4));
@@ -2087,7 +2173,10 @@ TEST_F(StorageLocalResourceProviderTest, ROOT_PublishResourcesRecovery)
 TEST_F(StorageLocalResourceProviderTest, ROOT_PublishResourcesReboot)
 {
   const string profilesPath = path::join(sandbox.get(), "profiles.json");
-  ASSERT_SOME(os::write(profilesPath, createDiskProfileMapping("test")));
+
+  ASSERT_SOME(
+      os::write(profilesPath, createDiskProfileMapping({{"test", None()}})));
+
   loadUriDiskProfileAdaptorModule(profilesPath);
 
   setupResourceProviderConfig(Gigabytes(4));
@@ -2394,7 +2483,10 @@ TEST_F(
     ROOT_PublishUnpublishResourcesPluginKilled)
 {
   const string profilesPath = path::join(sandbox.get(), "profiles.json");
-  ASSERT_SOME(os::write(profilesPath, createDiskProfileMapping("test")));
+
+  ASSERT_SOME(
+      os::write(profilesPath, createDiskProfileMapping({{"test", None()}})));
+
   loadUriDiskProfileAdaptorModule(profilesPath);
 
   setupResourceProviderConfig(Gigabytes(4));
@@ -2657,7 +2749,9 @@ TEST_F(
 TEST_F(StorageLocalResourceProviderTest, ImportPreprovisionedVolume)
 {
   const string profilesPath = path::join(sandbox.get(), "profiles.json");
-  ASSERT_SOME(os::write(profilesPath, createDiskProfileMapping("test")));
+
+  ASSERT_SOME(
+      os::write(profilesPath, createDiskProfileMapping({{"test", None()}})));
 
   loadUriDiskProfileAdaptorModule(profilesPath);
 
@@ -2830,7 +2924,10 @@ TEST_F(StorageLocalResourceProviderTest, RetryOperationStatusUpdate)
   Clock::pause();
 
   const string profilesPath = path::join(sandbox.get(), "profiles.json");
-  ASSERT_SOME(os::write(profilesPath, createDiskProfileMapping("test")));
+
+  ASSERT_SOME(
+      os::write(profilesPath, createDiskProfileMapping({{"test", None()}})));
+
   loadUriDiskProfileAdaptorModule(profilesPath);
 
   setupResourceProviderConfig(Gigabytes(4));
@@ -2985,7 +3082,10 @@ TEST_F(
   Clock::pause();
 
   const string profilesPath = path::join(sandbox.get(), "profiles.json");
-  ASSERT_SOME(os::write(profilesPath, createDiskProfileMapping("test")));
+
+  ASSERT_SOME(
+      os::write(profilesPath, createDiskProfileMapping({{"test", None()}})));
+
   loadUriDiskProfileAdaptorModule(profilesPath);
 
   setupResourceProviderConfig(Gigabytes(4));
@@ -3234,7 +3334,10 @@ TEST_F(
 TEST_F(StorageLocalResourceProviderTest, OperationStateMetrics)
 {
   const string profilesPath = path::join(sandbox.get(), "profiles.json");
-  ASSERT_SOME(os::write(profilesPath, createDiskProfileMapping("test")));
+
+  ASSERT_SOME(
+      os::write(profilesPath, createDiskProfileMapping({{"test", None()}})));
+
   loadUriDiskProfileAdaptorModule(profilesPath);
 
   setupResourceProviderConfig(Gigabytes(4));
@@ -3479,7 +3582,10 @@ TEST_F(StorageLocalResourceProviderTest, OperationStateMetrics)
 TEST_F(StorageLocalResourceProviderTest, CsiPluginRpcMetrics)
 {
   const string profilesPath = path::join(sandbox.get(), "profiles.json");
-  ASSERT_SOME(os::write(profilesPath, createDiskProfileMapping("test")));
+
+  ASSERT_SOME(
+      os::write(profilesPath, createDiskProfileMapping({{"test", None()}})));
+
   loadUriDiskProfileAdaptorModule(profilesPath);
 
   setupResourceProviderConfig(Gigabytes(4));
@@ -3768,7 +3874,10 @@ TEST_F(StorageLocalResourceProviderTest, ReconcileDroppedOperation)
   Clock::pause();
 
   const string profilesPath = path::join(sandbox.get(), "profiles.json");
-  ASSERT_SOME(os::write(profilesPath, createDiskProfileMapping("test")));
+
+  ASSERT_SOME(
+      os::write(profilesPath, createDiskProfileMapping({{"test", None()}})));
+
   loadUriDiskProfileAdaptorModule(profilesPath);
 
   setupResourceProviderConfig(Gigabytes(4));
@@ -3968,7 +4077,10 @@ TEST_F(StorageLocalResourceProviderTest, RetryOperationStatusUpdateToScheduler)
   Clock::pause();
 
   const string profilesPath = path::join(sandbox.get(), "profiles.json");
-  ASSERT_SOME(os::write(profilesPath, createDiskProfileMapping("test")));
+
+  ASSERT_SOME(
+      os::write(profilesPath, createDiskProfileMapping({{"test", None()}})));
+
   loadUriDiskProfileAdaptorModule(profilesPath);
 
   setupResourceProviderConfig(Gigabytes(4));
@@ -4154,7 +4266,10 @@ TEST_F(
   Clock::pause();
 
   const string profilesPath = path::join(sandbox.get(), "profiles.json");
-  ASSERT_SOME(os::write(profilesPath, createDiskProfileMapping("test")));
+
+  ASSERT_SOME(
+      os::write(profilesPath, createDiskProfileMapping({{"test", None()}})));
+
   loadUriDiskProfileAdaptorModule(profilesPath);
 
   setupResourceProviderConfig(Gigabytes(4));