def reserve(num): c = Client(addr) # time.sleep(random.randint(0,5)) # simulate varying start times resp = c.register({'node': num}) self.assertEqual(resp, 'OK') c.await_reservations() c.close()
def reserve(num): c = Client(addr) #time.sleep(random.randint(0,5)) # simulate varying start times resp = c.register({'node':num}) self.assertEqual(resp, 'OK') c.await_reservations() c.close()
def test_reservation_server(self): """Test reservation server, expecting 1 reservation""" s = Server(1) addr = s.start() # add first reservation c = Client(addr) resp = c.register({'node': 1}) self.assertEqual(resp, 'OK') # get list of reservations reservations = c.get_reservations() self.assertEqual(len(reservations), 1) # should return immediately with list of reservations reservations = c.await_reservations() self.assertEqual(len(reservations), 1) # request server stop c.request_stop() self.assertEqual(s.done, True)
def test_reservation_server(self): # start reservation server expecting 1 reservation s = Server(1) addr = s.start() # add first reservation c = Client(addr) resp = c.register({'node':1}) self.assertEqual(resp, 'OK') # get list of reservations reservations = c.get_reservations() self.assertEquals(len(reservations), 1) # should return immediately with list of reservations reservations = c.await_reservations() self.assertEquals(len(reservations), 1) # request server stop c.request_stop() self.assertEquals(s.done, True)