def test_partition_one_closed(self): pattern_args = { 'partid': 'creamtest1', 'state': 'down', 'cpuinfo': '0/2/0/2', 'maxcput': '30:00', 'defcput': 'n/a', 'jsize': '1-infinite', 'nodes': '0/1/0/1', 'maxcpun': 'UNLIMITED', 'sct': '2:1:1' } tmpfile = self.workspace.createFile(self.partPattern % pattern_args) pattern_args['partid'] = 'creamtest2*' pattern_args['state'] = 'up' self.workspace.appendToFile(self.partPattern % pattern_args, tmpfile) self.workspace.appendToFile(self.partPattern % pattern_args, tmpfile) config = DummyConfig() container = SInfoHandler.parsePartInfo(tmpfile) result = container['creamtest1'].state == 'Closed' result = result and container['creamtest2'].state == 'Production' self.assertTrue(result)
def test_maxslot_undef_ok(self): pattern_args = { 'partid': 'creamtest1', 'state': 'up', 'cpuinfo': '2/2/0/4', 'maxcput': '30:00', 'defcput': 'n/a', 'jsize': '1-unlimited', 'nodes': '0/1/0/1', 'maxcpun': 'UNLIMITED', 'sct': '2:2:1' } tmpfile = self.workspace.createFile(self.partPattern % pattern_args) pattern_args['partid'] = 'creamtest2' pattern_args['jsize'] = '2' self.workspace.appendToFile(self.partPattern % pattern_args, tmpfile) config = DummyConfig() config.slotType = 'CPU' container = SInfoHandler.parsePartInfo(tmpfile) result = container['creamtest1'].slotsPerJob == -1 result = result and container['creamtest2'].slotsPerJob == 8 self.assertTrue(result)
def test_partition_one_closed(self): pattern_args = {'partid' : 'creamtest1', 'state' : 'down', 'cpuinfo' : '0/2/0/2', 'maxcput' : '30:00', 'defcput' : 'n/a', 'jsize' : '1-infinite', 'nodes' : '0/1/0/1', 'maxcpun' : 'UNLIMITED', 'sct' : '2:1:1'} tmpfile = self.workspace.createFile(self.partPattern % pattern_args) pattern_args['partid'] = 'creamtest2*' pattern_args['state'] = 'up' self.workspace.appendToFile(self.partPattern % pattern_args, tmpfile) self.workspace.appendToFile(self.partPattern % pattern_args, tmpfile) config = DummyConfig() container = SInfoHandler.parsePartInfo(tmpfile) result = container['creamtest1'].state == 'Closed' result = result and container['creamtest2'].state == 'Production' self.assertTrue(result)
def test_maxslot_undef_ok(self): pattern_args = {'partid' : 'creamtest1', 'state' : 'up', 'cpuinfo' : '2/2/0/4', 'maxcput' : '30:00', 'defcput' : 'n/a', 'jsize' : '1-unlimited', 'nodes' : '0/1/0/1', 'maxcpun' : 'UNLIMITED', 'sct' : '2:2:1'} tmpfile = self.workspace.createFile(self.partPattern % pattern_args) pattern_args['partid'] = 'creamtest2' pattern_args['jsize'] = '2' self.workspace.appendToFile(self.partPattern % pattern_args, tmpfile) config = DummyConfig() config.slotType = 'CPU' container = SInfoHandler.parsePartInfo(tmpfile) result = container['creamtest1'].slotsPerJob == -1 result = result and container['creamtest2'].slotsPerJob == 8 self.assertTrue(result)
def test_partition_cpucount_ok(self): pattern_args = {'partid' : 'creamtest1', 'state' : 'up', 'cpuinfo' : '2/2/0/4', 'maxcput' : '30:00', 'defcput' : 'n/a', 'jsize' : '1-infinite', 'nodes' : '0/1/0/1', 'maxcpun' : 'UNLIMITED', 'sct' : '2:1:1'} tmpfile = self.workspace.createFile(self.partPattern % pattern_args) config = DummyConfig() container = SInfoHandler.parsePartInfo(tmpfile) result = container['creamtest1'].freeCPU == 2 result = result and container['creamtest1'].totalCPU == 4 self.assertTrue(result)
def test_partition_cpucount_ok(self): pattern_args = { 'partid': 'creamtest1', 'state': 'up', 'cpuinfo': '2/2/0/4', 'maxcput': '30:00', 'defcput': 'n/a', 'jsize': '1-infinite', 'nodes': '0/1/0/1', 'maxcpun': 'UNLIMITED', 'sct': '2:1:1' } tmpfile = self.workspace.createFile(self.partPattern % pattern_args) config = DummyConfig() container = SInfoHandler.parsePartInfo(tmpfile) result = container['creamtest1'].freeCPU == 2 result = result and container['creamtest1'].totalCPU == 4 self.assertTrue(result)