[bgp-config] fix bgp_config_get by name#10609
Conversation
|
While writing a unit test for the #10566, I noticed that Apparently we don't expose However, if we were to expose it or try to get by name internally we'd bump into the same problem as delete had with the full scans. This change is fine unless we want I also took the liberty of refactoring it a little. |
bgp_config_get by name
jgallagher
left a comment
There was a problem hiding this comment.
LGTM, just a couple suggestions on a little more test fidelity.
| .expect("create bgp config"); | ||
|
|
||
| datastore | ||
| .bgp_config_get(&opctx, &NameOrId::Name(config_name.clone())) |
There was a problem hiding this comment.
Could we add assertions that the properties of the config we get back match what we expect based on the create?
There was a problem hiding this comment.
Sure. This would expand the test from a regression test into also checking GET functionality.
| &BgpConfigSelector { name_or_id: NameOrId::Name(config_name) }, | ||
| ) | ||
| .await | ||
| .expect("delete bgp config by name"); |
There was a problem hiding this comment.
Could we add another bgp_config_get() after this delete and confirm we get the expected error (presumably a "not found")?
There was a problem hiding this comment.
Sure. This would expand the test from a regression test into also checking GET functionality.
Same here but for DELETE
Adds
.filter(bgp_config::time_deleted.is_null())tobgp_config_get, with some minor refactoring for readability. Also adds a regression test.