MCPcopy Create free account
hub / github.com/FDio/vpp / test_ring_buffer_configuration

Method test_ring_buffer_configuration

test/test_ring_buffer.py:150–178  ·  view source on GitHub ↗

Test ring buffer configuration access

(self)

Source from the content-addressed store, hash-verified

148 assert ts > 0, f"Timestamp should be positive, got {ts}"
149
150 def test_ring_buffer_configuration(self):
151 """Test ring buffer configuration access"""
152 ring_name = "/test/ring_buffer_config"
153
154 # Step 1: Create ring buffer
155 cli_cmd = (
156 f"test stats ring-buffer-gen {ring_name} 10 {INTERVAL_USEC} {RING_SIZE}"
157 )
158 result = self.vapi.cli(cli_cmd)
159 assert "Generated" in result, f"CLI failed: {result}"
160
161 # Step 2: Get ring buffer and check configuration
162 ring_buffer = self.statistics.get_ring_buffer(f"{ring_name}")
163 config = ring_buffer.get_config()
164
165 # Step 3: Validate configuration
166 assert "entry_size" in config, "Config should contain entry_size"
167 assert "ring_size" in config, "Config should contain ring_size"
168 assert "n_threads" in config, "Config should contain n_threads"
169 assert config["entry_size"] > 0, "Entry size should be positive"
170 assert config["ring_size"] > 0, "Ring size should be positive"
171 assert config["n_threads"] > 0, "Number of threads should be positive"
172
173 # Step 4: Check metadata access
174 metadata = ring_buffer._get_thread_metadata(0)
175 assert "head" in metadata, "Metadata should contain head"
176 assert "sequence" in metadata, "Metadata should contain sequence"
177 assert isinstance(metadata["head"], int), "Head should be integer"
178 assert isinstance(metadata["sequence"], int), "Sequence should be integer"
179
180 def test_ring_buffer_error_handling(self):
181 """Test ring buffer error handling"""

Callers

nothing calls this directly

Calls 4

get_ring_bufferMethod · 0.80
get_configMethod · 0.80
_get_thread_metadataMethod · 0.80
cliMethod · 0.45

Tested by

no test coverage detected