+ self.assertIn("Not enough compute", e.message)
+ exception = True
+ self.assertTrue(exception)
+
+ def testAllocationMemLimit(self):
+ """
+ Test MEM allocation limit
+ :return:
+ """
+ # config
+ E_CPU = 1.0
+ MAX_CU = 500
+ E_MEM = 512
+ MAX_MU = 2048
+ # create dummy resource model environment
+ reg = ResourceModelRegistrar(dc_emulation_max_cpu=E_CPU, dc_emulation_max_mem=E_MEM)
+ rm = UpbSimpleCloudDcRM(max_cu=MAX_CU, max_mu=MAX_MU)
+ reg.register("test_dc", rm)
+
+ # test over provisioning exeption
+ exception = False
+ try:
+ rm.allocate("c6", "xlarge") # calculate allocation
+ rm.allocate("c7", "xlarge") # calculate allocation
+ rm.allocate("c8", "xlarge") # calculate allocation
+ except Exception as e:
+ self.assertIn("Not enough memory", e.message)