def testSetNumInstances_CurrentModule(self):
     self.request_data.get_dispatcher().AndReturn(self.dispatcher)
     self.request_data.get_module(None).AndReturn('default')
     self.dispatcher.set_num_instances('default', '1', 2)
     self.mox.ReplayAll()
     modules.set_num_instances(version='1', instances=2)
     self.mox.VerifyAll()
 def testSetNumInstances_CurrentVersionDifferentModule(self):
     self.request_data.get_dispatcher().AndReturn(self.dispatcher)
     self.request_data.get_version(None).AndReturn('1')
     self.dispatcher.get_versions('other').AndReturn(['1'])
     self.dispatcher.set_num_instances('other', '1', 2)
     self.mox.ReplayAll()
     modules.set_num_instances(module='other', instances=2)
     self.mox.VerifyAll()
Ejemplo n.º 3
0
 def testSetNumInstances_AllDefaults(self):
   """Test we return the expected results when no args are passed."""
   expected_request = modules_service_pb2.SetNumInstancesRequest()
   expected_request.instances = 15
   service_response = modules_service_pb2.SetNumInstancesResponse()
   self.SetSuccessExpectations('SetNumInstances',
                               expected_request,
                               service_response)
   modules.set_num_instances(15)
Ejemplo n.º 4
0
 def testSetNumInstances_NoModule(self):
   """Test we return the expected results when no module is passed."""
   expected_request = modules_service_pb2.SetNumInstancesRequest()
   expected_request.version = 'v1'
   expected_request.instances = 14
   service_response = modules_service_pb2.SetNumInstancesResponse()
   self.SetSuccessExpectations('SetNumInstances',
                               expected_request,
                               service_response)
   modules.set_num_instances(14, version='v1')
Ejemplo n.º 5
0
 def testSetNumInstances_NoVersion(self):
   """Test we return the expected results when no version is passed."""
   expected_request = modules_service_pb2.SetNumInstancesRequest()
   expected_request.module = 'module1'
   expected_request.instances = 13
   service_response = modules_service_pb2.SetNumInstancesResponse()
   self.SetSuccessExpectations('SetNumInstances',
                               expected_request,
                               service_response)
   modules.set_num_instances(13, 'module1')
Ejemplo n.º 6
0
 def testSetNumInstances(self):
   """Test we return the expected results."""
   expected_request = modules_service_pb2.SetNumInstancesRequest()
   expected_request.module = 'module1'
   expected_request.version = 'v1'
   expected_request.instances = 12
   service_response = modules_service_pb2.SetNumInstancesResponse()
   self.SetSuccessExpectations('SetNumInstances',
                               expected_request,
                               service_response)
   modules.set_num_instances(12, 'module1', 'v1')
 def testSetNumInstances(self):
     self.request_data.get_dispatcher().AndReturn(self.dispatcher)
     self.dispatcher.set_num_instances('default', '1', 2)
     self.mox.ReplayAll()
     modules.set_num_instances(2, 'default', '1')
     self.mox.VerifyAll()