Improved validation messages for some operations. Review: https://reviews.apache.org/r/66939/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/52ae7f0e Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/52ae7f0e Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/52ae7f0e Branch: refs/heads/master Commit: 52ae7f0e6dd6952d243c37e8b8aa98ce7752a17d Parents: 9d89725 Author: Gaston Kleiman <[email protected]> Authored: Mon May 7 17:33:56 2018 -0700 Committer: Greg Mann <[email protected]> Committed: Mon May 7 18:15:31 2018 -0700 ---------------------------------------------------------------------- src/master/validation.cpp | 8 ++++---- src/tests/master_validation_tests.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/52ae7f0e/src/master/validation.cpp ---------------------------------------------------------------------- diff --git a/src/master/validation.cpp b/src/master/validation.cpp index 0c1c924..798fc79 100644 --- a/src/master/validation.cpp +++ b/src/master/validation.cpp @@ -2507,7 +2507,7 @@ Option<Error> validate(const Offer::Operation::CreateVolume& createVolume) } if (!Resources::hasResourceProvider(source)) { - return Error("Does not have a resource provider"); + return Error("'source' is not managed by a resource provider"); } if (!Resources::isDisk(source, Resource::DiskInfo::Source::RAW)) { @@ -2533,7 +2533,7 @@ Option<Error> validate(const Offer::Operation::DestroyVolume& destroyVolume) } if (!Resources::hasResourceProvider(volume)) { - return Error("Does not have a resource provider"); + return Error("'volume' is not managed by a resource provider"); } if (!Resources::isDisk(volume, Resource::DiskInfo::Source::MOUNT) && @@ -2555,7 +2555,7 @@ Option<Error> validate(const Offer::Operation::CreateBlock& createBlock) } if (!Resources::hasResourceProvider(source)) { - return Error("Does not have a resource provider"); + return Error("'source' is not managed by a resource provider"); } if (!Resources::isDisk(source, Resource::DiskInfo::Source::RAW)) { @@ -2576,7 +2576,7 @@ Option<Error> validate(const Offer::Operation::DestroyBlock& destroyBlock) } if (!Resources::hasResourceProvider(block)) { - return Error("Does not have a resource provider"); + return Error("'block' is not managed by a resource provider"); } if (!Resources::isDisk(block, Resource::DiskInfo::Source::BLOCK)) { http://git-wip-us.apache.org/repos/asf/mesos/blob/52ae7f0e/src/tests/master_validation_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/master_validation_tests.cpp b/src/tests/master_validation_tests.cpp index fb1d8bd..6f2a78e 100644 --- a/src/tests/master_validation_tests.cpp +++ b/src/tests/master_validation_tests.cpp @@ -1795,7 +1795,7 @@ TEST(OperationValidationTest, CreateVolume) ASSERT_SOME(error); EXPECT_TRUE(strings::contains( error->message, - "Does not have a resource provider")); + "'source' is not managed by a resource provider")); createVolume.mutable_source()->CopyFrom(disk1); createVolume.set_target_type(Resource::DiskInfo::Source::BLOCK); @@ -1834,7 +1834,7 @@ TEST(OperationValidationTest, DestroyVolume) ASSERT_SOME(error); EXPECT_TRUE(strings::contains( error->message, - "Does not have a resource provider")); + "'volume' is not managed by a resource provider")); destroyVolume.mutable_volume()->CopyFrom(disk3); @@ -1880,7 +1880,7 @@ TEST(OperationValidationTest, CreateBlock) ASSERT_SOME(error); EXPECT_TRUE(strings::contains( error->message, - "Does not have a resource provider")); + "'source' is not managed by a resource provider")); } @@ -1910,7 +1910,7 @@ TEST(OperationValidationTest, DestroyBlock) ASSERT_SOME(error); EXPECT_TRUE(strings::contains( error->message, - "Does not have a resource provider")); + "'block' is not managed by a resource provider")); destroyBlock.mutable_block()->CopyFrom(disk3);
