MCPcopy Create free account
hub / github.com/apache/qpid-proton / testBuffering

Method testBuffering

python/tests/proton_tests/engine.py:1839–1895  ·  view source on GitHub ↗
(self, count=32, size=1024, capacity=16 * 1024, max_frame=1024)

Source from the content-addressed store, hash-verified

1837 self.cleanup()
1838
1839 def testBuffering(self, count=32, size=1024, capacity=16 * 1024, max_frame=1024):
1840 snd, rcv = self.link("test-link", max_frame=(max_frame, max_frame))
1841 rcv.session.incoming_capacity = capacity
1842 snd.open()
1843 rcv.open()
1844 rcv.flow(count)
1845 self.pump()
1846
1847 assert count > 0
1848
1849 total_bytes = count * size
1850
1851 assert snd.session.outgoing_bytes == 0, snd.session.outgoing_bytes
1852 assert rcv.session.incoming_bytes == 0, rcv.session.incoming_bytes
1853 assert snd.queued == 0, snd.queued
1854 assert rcv.queued == 0, rcv.queued
1855
1856 data = bytes(bytearray(size))
1857 idx = 0
1858 while snd.credit:
1859 d = snd.delivery("tag%s" % idx)
1860 assert d
1861 n = snd.send(data)
1862 assert n == size, (n, size)
1863 assert snd.advance()
1864 self.pump()
1865 idx += 1
1866
1867 assert idx == count, (idx, count)
1868
1869 assert snd.session.outgoing_bytes < total_bytes, (snd.session.outgoing_bytes, total_bytes)
1870 assert rcv.session.incoming_bytes < capacity, (rcv.session.incoming_bytes, capacity)
1871 assert snd.session.outgoing_bytes + rcv.session.incoming_bytes == total_bytes, \
1872 (snd.session.outgoing_bytes, rcv.session.incoming_bytes, total_bytes)
1873 if snd.session.outgoing_bytes > 0:
1874 available = rcv.session.incoming_capacity - rcv.session.incoming_bytes
1875 assert available < max_frame, (available, max_frame)
1876
1877 for i in range(count):
1878 d = rcv.current
1879 assert d, i
1880 pending = d.pending
1881 before = rcv.session.incoming_bytes
1882 assert rcv.advance()
1883 after = rcv.session.incoming_bytes
1884 assert before - after == pending, (before, after, pending)
1885 snd_before = snd.session.incoming_bytes
1886 self.pump()
1887 snd_after = snd.session.incoming_bytes
1888
1889 assert rcv.session.incoming_bytes < capacity
1890 if snd_before > 0:
1891 assert capacity - after <= max_frame
1892 assert snd_before > snd_after
1893 if snd_after > 0:
1894 available = rcv.session.incoming_capacity - rcv.session.incoming_bytes
1895 assert available < max_frame, available
1896

Callers 8

testBufferingSize16Method · 0.95
testBufferingSize256Method · 0.95
testBufferingSize512Method · 0.95
testBufferingSize2048Method · 0.95
testBufferingSize1025Method · 0.95
testBufferingSize1023Method · 0.95
testBufferingSize989Method · 0.95
testBufferingSize1059Method · 0.95

Calls 8

rangeFunction · 0.85
advanceMethod · 0.80
linkMethod · 0.45
openMethod · 0.45
flowMethod · 0.45
pumpMethod · 0.45
deliveryMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected