
The worker now gets the bytes-in/bytes-out for the specified protocol (http or tcp). For now, these values are only logged, and then only in debug mode. Added a test for setting these values in the new LBStatistics class. Updated README for the 'socat' requirement and to mention that the PID file directory must be writable by the user. Change-Id: I79f218747255cba84b25c4a69d0b210c9d1dfee5
27 lines
736 B
Python
27 lines
736 B
Python
import unittest
|
|
from libra.common.lbstats import LBStatistics
|
|
|
|
|
|
class TestLBStatistics(unittest.TestCase):
|
|
def setUp(self):
|
|
self.stats = LBStatistics()
|
|
|
|
def tearDown(self):
|
|
pass
|
|
|
|
def testInitValues(self):
|
|
self.assertEquals(self.stats.bytes_out, 0)
|
|
self.assertEquals(self.stats.bytes_in, 0)
|
|
|
|
def testSetBytesIn(self):
|
|
self.stats.bytes_in = 99
|
|
self.assertEquals(self.stats.bytes_in, 99)
|
|
with self.assertRaises(TypeError):
|
|
self.stats.bytes_in = "NaN"
|
|
|
|
def testSetBytesOut(self):
|
|
self.stats.bytes_out = 100
|
|
self.assertEquals(self.stats.bytes_out, 100)
|
|
with self.assertRaises(TypeError):
|
|
self.stats.bytes_out = "NaN"
|