def setUp(self): self.nodes = [] for s in largenetwork_setup.makeNodes(): newNode = node.Node(s) newNode.start() self.nodes.append(newNode) #Allow links to connect time.sleep(3)
def test_payerSide(self): 'Test behavior when no route is found on the payer side' log.log('\n\n\n\nSCENARIO TEST: largenetwork_haveNoRoute.py test_payerSide\n') #Make a copy, where the link between 2 and 4 is broken: linkDefinitions = copy.deepcopy(largenetwork_setup.linkDefinitions_global) linkDefinitions[2].remove(4) linkDefinitions[4].remove(2) for s in largenetwork_setup.makeNodes(linkDefinitions): newNode = node.Node(s) newNode.start() self.nodes.append(newNode) #Allow links to connect time.sleep(3) self.checkCancelledState()
def test_payerSide(self): 'Test behavior when no route is found on the payer side' log.log( '\n\n\n\nSCENARIO TEST: largenetwork_haveNoRoute.py test_payerSide\n' ) #Make a copy, where the link between 2 and 4 is broken: linkDefinitions = copy.deepcopy( largenetwork_setup.linkDefinitions_global) linkDefinitions[2].remove(4) linkDefinitions[4].remove(2) for s in largenetwork_setup.makeNodes(linkDefinitions): newNode = node.Node(s) newNode.start() self.nodes.append(newNode) #Allow links to connect time.sleep(3) self.checkCancelledState()
def test_payerSide(self): 'Test behavior when route times out on the payer side' log.log('\n\n\n\nSCENARIO TEST: largenetwork_routeTimeout.py test_payerSide\n') settings = largenetwork_setup.makeNodes() #Let node 2 ignore MakeRoute: with open(settings[2].stateFile, 'rb') as f: stateData = f.read() stateData = stateData.replace('NodeState', 'NodeState_IgnoreMakeRoute') with open(settings[2].stateFile, 'wb') as f: f.write(stateData) for s in settings: newNode = node.Node(s) newNode.start() self.nodes.append(newNode) #Allow links to connect time.sleep(3) self.checkCancelledState()
def test_lockDelay(self): 'Test behavior when the lock is delayed until after reservation time-out' log.log('\n\n\n\nSCENARIO TEST: largenetwork_lockDelay.py\n') settings = largenetwork_setup.makeNodes() #Let node 2 delay the Lock: with open(settings[2].stateFile, 'rb') as f: stateData = f.read() stateData = stateData.replace('NodeState', 'NodeState_LockDelay') with open(settings[2].stateFile, 'wb') as f: f.write(stateData) for s in settings: newNode = node.Node(s) newNode.start() self.nodes.append(newNode) #Allow links to connect time.sleep(3) self.checkCancelledState()
def test_noLock(self): 'Test behavior when no lock happens' log.log('\n\n\n\nSCENARIO TEST: largenetwork_noLock.py\n') settings = largenetwork_setup.makeNodes() #Let node 0 (the paying node) generate no lock: with open(settings[0].stateFile, 'rb') as f: stateData = f.read() stateData = stateData.replace('NodeState', 'NodeState_NoLock') with open(settings[0].stateFile, 'wb') as f: f.write(stateData) for s in settings: newNode = node.Node(s) newNode.start() self.nodes.append(newNode) #Allow links to connect time.sleep(3) self.checkCancelledState()
def test_noCommit(self): 'Test behavior when no commit happens' log.log('\n\n\n\nSCENARIO TEST: largenetwork_noCommit.py\n') settings = largenetwork_setup.makeNodes() #Let node 7 (the receiving node) generate no commit: with open(settings[7].stateFile, 'rb') as f: stateData = f.read() stateData = stateData.replace('NodeState', 'NodeState_NoCommit') with open(settings[7].stateFile, 'wb') as f: f.write(stateData) for s in settings: s.timeoutIncrement = 3 newNode = node.Node(s) newNode.start() self.nodes.append(newNode) #Allow links to connect time.sleep(3) self.checkCancelledState()