You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by nn...@apache.org on 2015/06/05 02:08:37 UTC
[4/4] mesos git commit: Added QoS Controller test.
Added QoS Controller test.
Added new QoS Controller test which use the TestQoSController to fill
the correction queue and verify the slave receiving corrections.
Review: https://reviews.apache.org/r/34633
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/3e139c61
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/3e139c61
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/3e139c61
Branch: refs/heads/master
Commit: 3e139c61d2ea7084c2e24e226e0bd8a037f60446
Parents: a2d1515
Author: Niklas Nielsen <ni...@qni.dk>
Authored: Thu Jun 4 14:30:31 2015 -0700
Committer: Niklas Q. Nielsen <ni...@qni.dk>
Committed: Thu Jun 4 16:45:49 2015 -0700
----------------------------------------------------------------------
src/tests/oversubscription_tests.cpp | 44 +++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/3e139c61/src/tests/oversubscription_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/oversubscription_tests.cpp b/src/tests/oversubscription_tests.cpp
index a49cb39..afd7ff4 100644
--- a/src/tests/oversubscription_tests.cpp
+++ b/src/tests/oversubscription_tests.cpp
@@ -16,6 +16,7 @@
* limitations under the License.
*/
+#include <list>
#include <string>
#include <vector>
@@ -23,6 +24,8 @@
#include <mesos/resources.hpp>
+#include <mesos/slave/qos_controller.hpp>
+
#include <process/clock.hpp>
#include <process/future.hpp>
#include <process/gtest.hpp>
@@ -43,6 +46,7 @@
#include "slave/slave.hpp"
#include "tests/flags.hpp"
+#include "tests/containerizer.hpp"
#include "tests/mesos.hpp"
#include "tests/utils.hpp"
@@ -52,6 +56,9 @@ using mesos::internal::master::Master;
using mesos::internal::slave::Slave;
+using mesos::slave::QoSCorrection;
+
+using std::list;
using std::string;
using std::vector;
@@ -388,6 +395,43 @@ TEST_F(OversubscriptionTest, FixedResourceEstimator)
Shutdown();
}
+
+// Tests interactions between QoS Controller and slave. The
+// TestQoSController's correction queue is filled and a mocked slave
+// is checked for receiving the given correction.
+TEST_F(OversubscriptionTest, ReceiveQoSCorrection)
+{
+ StandaloneMasterDetector detector;
+ TestContainerizer containerizer;
+
+ MockQoSController controller;
+
+ Queue<list<QoSCorrection>> corrections;
+
+ EXPECT_CALL(controller, corrections())
+ .WillRepeatedly(Invoke(&corrections, &Queue<list<QoSCorrection>>::get));
+
+ MockSlave slave(CreateSlaveFlags(), &detector, &containerizer, &controller);
+
+ Future<list<QoSCorrection>> qosCorrections;
+ EXPECT_CALL(slave, qosCorrections(_))
+ .WillOnce(FutureArg<0>(&qosCorrections));
+
+ spawn(slave);
+
+ list<QoSCorrection> expected = { QoSCorrection() };
+ corrections.put(expected);
+
+ AWAIT_READY(qosCorrections);
+
+ ASSERT_EQ(qosCorrections.get().size(), 1u);
+
+ // TODO(nnielsen): Test for equality of QoSCorrections.
+
+ terminate(slave);
+ wait(slave);
+}
+
} // namespace tests {
} // namespace internal {
} // namespace mesos {