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

bmahler 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 296db30  Fixed HookTest.VerifyMasterLaunchTaskResourceDecoratorHook.
296db30 is described below

commit 296db3089d2520ed62ee4cd464e07e6ca1028da0
Author: Benjamin Mahler <[email protected]>
AuthorDate: Tue Feb 12 18:50:56 2019 -0500

    Fixed HookTest.VerifyMasterLaunchTaskResourceDecoratorHook.
    
    This test was failing since the task's resources were invalid
    (did not have an allocation info). This ensures the test hook
    uses allocated resources.
---
 src/examples/test_hook_module.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/examples/test_hook_module.cpp 
b/src/examples/test_hook_module.cpp
index 743ac75..3027673 100644
--- a/src/examples/test_hook_module.cpp
+++ b/src/examples/test_hook_module.cpp
@@ -127,7 +127,13 @@ public:
 
     // Add a default value for network bandwidth if absent.
     if (taskResources.names().count("network_bandwidth") == 0) {
-      taskResources += 
CHECK_NOTERROR(Resources::parse("network_bandwidth:10"));
+      Resources bandwidth =
+        CHECK_NOTERROR(Resources::parse("network_bandwidth:10"));
+
+      CHECK(!taskResources.allocations().empty());
+      bandwidth.allocate(taskResources.allocations().begin()->first);
+
+      taskResources += bandwidth;
     }
 
     return taskResources;

Reply via email to