Repository: aurora
Updated Branches:
  refs/heads/master a5b9603f0 -> 7e30ebe34


http://git-wip-us.apache.org/repos/asf/aurora/blob/7e30ebe3/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
 
b/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
index acc68ae..ecdc62a 100644
--- 
a/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
+++ 
b/src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java
@@ -59,7 +59,6 @@ import org.apache.aurora.gen.PulseJobUpdateResult;
 import org.apache.aurora.gen.QueryRecoveryResult;
 import org.apache.aurora.gen.Range;
 import org.apache.aurora.gen.ReadOnlyScheduler;
-import org.apache.aurora.gen.Resource;
 import org.apache.aurora.gen.ResourceAggregate;
 import org.apache.aurora.gen.Response;
 import org.apache.aurora.gen.ResponseDetail;
@@ -114,6 +113,9 @@ import org.junit.Test;
 import static org.apache.aurora.gen.MaintenanceMode.DRAINING;
 import static org.apache.aurora.gen.MaintenanceMode.NONE;
 import static org.apache.aurora.gen.MaintenanceMode.SCHEDULED;
+import static org.apache.aurora.gen.Resource.diskMb;
+import static org.apache.aurora.gen.Resource.numCpus;
+import static org.apache.aurora.gen.Resource.ramMb;
 import static org.apache.aurora.gen.ResponseCode.INVALID_REQUEST;
 import static org.apache.aurora.gen.ResponseCode.LOCK_ERROR;
 import static org.apache.aurora.gen.ResponseCode.OK;
@@ -507,9 +509,9 @@ public class SchedulerThriftInterfaceTest extends 
EasyMockTest {
         .setConstraints(ImmutableSet.of())
         .setMaxTaskFailures(0)
         .setResources(ImmutableSet.of(
-            Resource.numCpus(1.0),
-            Resource.ramMb(1024),
-            Resource.diskMb(1024)));
+            numCpus(1.0),
+            ramMb(1024),
+            diskMb(1024)));
 
     lockManager.assertNotLocked(LOCK_KEY);
     storageUtil.expectTaskFetch(Query.jobScoped(JOB_KEY).active());
@@ -653,7 +655,8 @@ public class SchedulerThriftInterfaceTest extends 
EasyMockTest {
         .setRamMb(200);
     quotaManager.saveQuota(
         ROLE,
-        IResourceAggregate.build(resourceAggregate),
+        IResourceAggregate.build(resourceAggregate.deepCopy()
+            .setResources(ImmutableSet.of(numCpus(10), ramMb(200), 
diskMb(100)))),
         storageUtil.mutableStoreProvider);
 
     control.replay();
@@ -669,7 +672,8 @@ public class SchedulerThriftInterfaceTest extends 
EasyMockTest {
         .setRamMb(200);
     quotaManager.saveQuota(
         ROLE,
-        IResourceAggregate.build(resourceAggregate),
+        IResourceAggregate.build(resourceAggregate.deepCopy()
+            .setResources(ImmutableSet.of(numCpus(10), ramMb(200), 
diskMb(100)))),
         storageUtil.mutableStoreProvider);
 
     expectLastCall().andThrow(new QuotaManager.QuotaException("fail"));

http://git-wip-us.apache.org/repos/asf/aurora/blob/7e30ebe3/src/test/java/org/apache/aurora/scheduler/thrift/ThriftIT.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/thrift/ThriftIT.java 
b/src/test/java/org/apache/aurora/scheduler/thrift/ThriftIT.java
index d5648c9..9cce641 100644
--- a/src/test/java/org/apache/aurora/scheduler/thrift/ThriftIT.java
+++ b/src/test/java/org/apache/aurora/scheduler/thrift/ThriftIT.java
@@ -34,7 +34,6 @@ import org.apache.aurora.gen.Container._Fields;
 import org.apache.aurora.gen.DockerContainer;
 import org.apache.aurora.gen.DockerParameter;
 import org.apache.aurora.gen.JobConfiguration;
-import org.apache.aurora.gen.ResourceAggregate;
 import org.apache.aurora.gen.ScheduleStatus;
 import org.apache.aurora.gen.ScheduledTask;
 import org.apache.aurora.gen.ServerInfo;
@@ -53,6 +52,7 @@ import org.apache.aurora.scheduler.mesos.DriverFactory;
 import org.apache.aurora.scheduler.mesos.DriverSettings;
 import org.apache.aurora.scheduler.mesos.TestExecutorSettings;
 import org.apache.aurora.scheduler.quota.QuotaModule;
+import org.apache.aurora.scheduler.resources.ResourceTestUtil;
 import org.apache.aurora.scheduler.stats.StatsModule;
 import org.apache.aurora.scheduler.storage.Storage;
 import org.apache.aurora.scheduler.storage.Storage.NonVolatileStorage;
@@ -72,8 +72,7 @@ import static org.junit.Assert.assertEquals;
 public class ThriftIT extends EasyMockTest {
 
   private static final String USER = "someuser";
-  private static final IResourceAggregate QUOTA =
-      IResourceAggregate.build(new ResourceAggregate(1, 1, 1));
+  private static final IResourceAggregate QUOTA = 
ResourceTestUtil.aggregate(1, 1, 1);
   private static final IServerInfo SERVER_INFO = IServerInfo.build(new 
ServerInfo());
 
   private AuroraAdmin.Iface thrift;

http://git-wip-us.apache.org/repos/asf/aurora/blob/7e30ebe3/src/test/python/apache/aurora/client/api/test_api.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/api/test_api.py 
b/src/test/python/apache/aurora/client/api/test_api.py
index 9e2e2fa..7a0797d 100644
--- a/src/test/python/apache/aurora/client/api/test_api.py
+++ b/src/test/python/apache/aurora/client/api/test_api.py
@@ -32,6 +32,7 @@ from gen.apache.aurora.api.ttypes import (
     JobUpdateRequest,
     JobUpdateSettings,
     JobUpdateStatus,
+    Resource,
     Response,
     ResponseCode,
     ResponseDetail,
@@ -190,3 +191,12 @@ class TestJobUpdateApis(unittest.TestCase):
     key = JobUpdateKey(job=JobKey(role="role", environment="env", 
name="name"), id="id")
     api.get_job_update_details(key)
     mock_proxy.getJobUpdateDetails.assert_called_once_with(key)
+
+  def test_set_quota(self):
+    """Test setting quota."""
+    api, mock_proxy = self.mock_api()
+    api.set_quota("role", 1.0, 32, 64)
+    actual = list(mock_proxy.setQuota.mock_calls[0][1][1].resources)
+    assert Resource(numCpus=1.0) in actual
+    assert Resource(ramMb=32) in actual
+    assert Resource(diskMb=64) in actual

Reply via email to