You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2019/05/20 19:18:18 UTC
[mesos] 02/02: Added unit tests for 'framework::validateUpdate()'.
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
commit 1f83bfc2877004e0e3ddd1e7a15902a6b471d7ee
Author: Andrei Sekretenko <as...@mesosphere.io>
AuthorDate: Mon May 20 14:57:57 2019 -0400
Added unit tests for 'framework::validateUpdate()'.
Review: https://reviews.apache.org/r/70667/
---
src/tests/master_validation_tests.cpp | 41 +++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/src/tests/master_validation_tests.cpp b/src/tests/master_validation_tests.cpp
index 1b7a827..f102906 100644
--- a/src/tests/master_validation_tests.cpp
+++ b/src/tests/master_validation_tests.cpp
@@ -4763,6 +4763,47 @@ TEST_F(FrameworkInfoValidationTest, ValidateOfferFilters)
}
+// This tests validation of FrameworkInfo updates.
+TEST_F(FrameworkInfoValidationTest, ValidateUpdate)
+{
+ {
+ FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
+ frameworkInfo.add_roles("bar");
+
+ EXPECT_NONE(framework::validateUpdate(
+ DEFAULT_FRAMEWORK_INFO, frameworkInfo));
+ }
+
+ {
+ FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
+ *frameworkInfo.mutable_principal() += "_foo";
+
+ EXPECT_SOME(framework::validateUpdate(
+ DEFAULT_FRAMEWORK_INFO, frameworkInfo));
+ }
+
+
+ // TODO(asekretenko): The validate function currently does not check
+ // 'user' and 'checkpoint', which are both immutable! Update this to
+ // test that these fields are also validated.
+ {
+ FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
+ *frameworkInfo.mutable_user() += "_foo";
+
+ EXPECT_NONE(framework::validateUpdate(
+ DEFAULT_FRAMEWORK_INFO, frameworkInfo));
+ }
+
+ {
+ FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO;
+ frameworkInfo.set_checkpoint(!frameworkInfo.checkpoint());
+
+ EXPECT_NONE(framework::validateUpdate(
+ DEFAULT_FRAMEWORK_INFO, frameworkInfo));
+ }
+}
+
+
// This test ensures that ia framework cannot use the
// `FrameworkInfo.roles` field without providing the
// MULTI_ROLE capability.