def tearDown(self): super(NetworkLoadTestCase, self).tearDown() # The only engine have to tear down stacks after all workers have done if self.engine: console.terse("Clearing netem rules\n") netem.clear() # clear network emulation rules if netem.check() != 0: console.terse("Error removing netem rules! Check it manually!")
def tearDown(self): super(NetworkLoadTestCase, self).tearDown() # The only engine have to tear down stacks after all workers have done if self.engine: console.terse("Clearing netem rules\n") netem.clear() # clear network emulation rules if netem.check() != 0: console.terse("Error removing netem rules! Check it manually!")
def testNetemWorks(self): ''' Check if system configured to run sudo tc without password If this test fail add the following in visudo: username ALL=NOPASSWD: /usr/sbin/tc This allow user 'username' to run 'sudo tc' without password prompt that is needed for netem module ''' console.terse("{0}\n".format(self.testNetemWorks.__doc__)) self.assertTrue(netem.delay()) self.assertEqual(netem.check(), 1)
def testNetemWorks(self): ''' Check if system configured to run sudo tc without password If this test fail add the following in visudo: username ALL=NOPASSWD: /usr/sbin/tc This allow user 'username' to run 'sudo tc' without password prompt that is needed for netem module ''' console.terse("{0}\n".format(self.testNetemWorks.__doc__)) self.assertTrue(netem.delay()) self.assertEqual(netem.check(), 1)
def testLossOneToOneToMaster(self): ''' One slave sends messages to one master with packet loss ''' console.terse("{0}\n".format(self.testLossOneToOneToMaster.__doc__)) self.assertTrue(netem.loss(percent=30, correlation=25)) self.assertEqual(netem.check(), 1) self.messagingMultiPeers(masterCount=1, minionCount=1, msgSize=testing.MSG_SIZE_MED, msgCount=testing.MSG_COUNT_MED, duration=100.0, direction=testing.DIR_TO_MASTER)
def testDelayOneToOneToMaster(self): ''' One slave sends messages to one master with network delays ''' console.terse("{0}\n".format(self.testDelayOneToOneToMaster.__doc__)) self.assertTrue(netem.delay(time=200, jitter=100, correlation=30)) self.assertEqual(netem.check(), 1) self.messagingMultiPeers(masterCount=1, minionCount=1, msgSize=testing.MSG_SIZE_MED, msgCount=testing.MSG_COUNT_MED, duration=100.0, direction=testing.DIR_TO_MASTER)
def testDuplicateOneToOneToMaster(self): ''' One slave sends messages to one master with packet duplication ''' console.terse("{0}\n".format(self.testDuplicateOneToOneToMaster.__doc__)) self.assertTrue(netem.duplicate(percent=50, correlation=25)) self.assertEqual(netem.check(), 1) self.messagingMultiPeers(masterCount=1, minionCount=1, msgSize=testing.MSG_SIZE_MED, msgCount=testing.MSG_COUNT_MED, duration=100.0, direction=testing.DIR_TO_MASTER)
def testDelayOneToOneToMaster(self): ''' One slave sends messages to one master with network delays ''' console.terse("{0}\n".format(self.testDelayOneToOneToMaster.__doc__)) self.assertTrue(netem.delay(time=200, jitter=100, correlation=30)) self.assertEqual(netem.check(), 1) self.messagingMultiPeers(masterCount=1, minionCount=1, msgSize=testing.MSG_SIZE_MED, msgCount=testing.MSG_COUNT_MED, duration=100.0, direction=testing.DIR_TO_MASTER)
def testCorruptManyToManyBidirectional(self): ''' Bidirectional messaging between many masters and many slaves with packet corruption ''' console.terse("{0}\n".format(self.testCorruptManyToManyBidirectional.__doc__)) self.assertTrue(netem.corrupt(percent=20, correlation=25)) self.assertEqual(netem.check(), 1) self.messagingMultiPeers(masterCount=testing.MULTI_MASTER_COUNT, minionCount=testing.MULTI_MINION_COUNT, msgSize=testing.MSG_SIZE_MED, msgCount=testing.MSG_COUNT_MED, duration=100.0, direction=testing.DIR_BIDIRECTIONAL)
def testDelayManyToManyBidirectional(self): ''' Bidirectional messaging between many masters and many slaves with network delay ''' console.terse("{0}\n".format(self.testDelayManyToManyBidirectional.__doc__)) self.assertTrue(netem.delay(time=200, jitter=100, correlation=30)) self.assertEqual(netem.check(), 1) self.messagingMultiPeers(masterCount=testing.MULTI_MASTER_COUNT, minionCount=testing.MULTI_MINION_COUNT, msgSize=testing.MSG_SIZE_MED, msgCount=testing.MSG_COUNT_MED, duration=100.0, direction=testing.DIR_BIDIRECTIONAL)
def testCorruptManyToManyBidirectional(self): ''' Bidirectional messaging between many masters and many slaves with packet corruption ''' console.terse("{0}\n".format( self.testCorruptManyToManyBidirectional.__doc__)) self.assertTrue(netem.corrupt(percent=20, correlation=25)) self.assertEqual(netem.check(), 1) self.messagingMultiPeers(masterCount=testing.MULTI_MASTER_COUNT, minionCount=testing.MULTI_MINION_COUNT, msgSize=testing.MSG_SIZE_MED, msgCount=testing.MSG_COUNT_MED, duration=100.0, direction=testing.DIR_BIDIRECTIONAL)
def testDelayManyToManyBidirectional(self): ''' Bidirectional messaging between many masters and many slaves with network delay ''' console.terse("{0}\n".format( self.testDelayManyToManyBidirectional.__doc__)) self.assertTrue(netem.delay(time=200, jitter=100, correlation=30)) self.assertEqual(netem.check(), 1) self.messagingMultiPeers(masterCount=testing.MULTI_MASTER_COUNT, minionCount=testing.MULTI_MINION_COUNT, msgSize=testing.MSG_SIZE_MED, msgCount=testing.MSG_COUNT_MED, duration=100.0, direction=testing.DIR_BIDIRECTIONAL)