-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(connlib): react to config updates #4322
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Terraform Cloud Plan Output
|
Performance Test ResultsTCP
UDP
|
fn add_resources(&mut self, resources: &[ResourceDescription]) { | ||
for resource_description in resources { | ||
if let Some(resource) = self.resource_ids.get(&resource_description.id()) { | ||
if resource.has_different_address(resource_description) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks god for unit tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thank you for adding all these tests!
I've left some comments on how I think we could cover more ground with them but that is not a blocker for merging.
rust/connlib/tunnel/src/client.rs
Outdated
let mut client_state = ClientState::for_test(); | ||
client_state.add_resources(&[cidr_resource("10.0.0.0/24"), dns_resource("baz.com")]); | ||
|
||
assert_eq!( | ||
HashSet::<&ResourceDescription>::from_iter(client_state.resources().iter()), | ||
HashSet::from_iter([cidr_resource("10.0.0.0/24"), dns_resource("baz.com")].iter()) | ||
); | ||
assert_eq!( | ||
HashSet::<IpNetwork>::from_iter(client_state.routes()), | ||
expected_routes(vec![IpNetwork::from_str("10.0.0.0/24").unwrap()]) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think "having routes for CIDR resources" should be a separate test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for now, it's a good idea to leave them here until we have better tests for routes in general, we could repeat all tests with these assertions.
But for now, it's the only way we have to know that the internal state is consistent, it has caught some bugs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I skimmed through it
338b63f
to
c524eda
Compare
Tested the
Right now there's a bug on the portal that prevents testing that the upstream dns are updated in real-time, there's a fix on the way, will merge after that is tested. |
With fab9548 in I tested that the DNS updates works on all platforms Merging :) |
ClientState
to unit test easierFixes: #2728