Test ring buffer configuration access
(self)
| 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""" |
nothing calls this directly
no test coverage detected