-
Notifications
You must be signed in to change notification settings - Fork 163
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
BS: Add fast recovery unit test #2694
Conversation
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.
Reviewed 3 of 3 files at r1.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @oncilla)
go/beacon_srv/internal/beaconing/originator_test.go, line 144 at r1 (raw file):
// 3. Run where no beacon is sent. -> no call // 4. Run where beacons are sent on all interfaces. -> 2 calls conn.EXPECT().WriteTo(gomock.Any(), gomock.Any()).Times(5).DoAndReturn(
See comment below, maybe this could be simplified.
go/beacon_srv/internal/beaconing/propagator_test.go, line 245 at r1 (raw file):
} g := graph.NewDefaultGraph(mctrl) // We call run 4 times in this test
according to the explanation below and the code I wouldn't expect a call in run 3. Why is there one?
go/beacon_srv/internal/beaconing/propagator_test.go, line 260 at r1 (raw file):
// 3. Run where no beacon is sent. -> no call // 4. Run where beacons are sent on all interfaces. -> 2 calls conn.EXPECT().WriteTo(gomock.Any(), gomock.Any()).Times(5).DoAndReturn(
you could do this more explicit and concise I think:
firstCall := conn.EXPECT().WriteTo(gomock.Any(), gomock.Any())
secondCall := conn.EXPECT().WriteTo(gomock.Any(), gomock.Any()).After(firstCall).Return(errors.New("fail"))
conn.EXPECT().WriteTo(gomock.Any(), gomock.Any()).After(secondCall).Times(3)
(didn't test it though)
go/beacon_srv/internal/beaconing/propagator_test.go, line 276 at r1 (raw file):
// Second run. One write expected. p.Run(nil) // Third run. No write expected
hm this can't really be verified, but the total is good enough -ish
The added tests check that the fast recovery mechanism works as expected. fixes scionproto#2685
91b8af4
to
6eb4c35
Compare
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.
Reviewable status: 1 of 3 files reviewed, 3 unresolved discussions (waiting on @lukedirtwalker)
go/beacon_srv/internal/beaconing/originator_test.go, line 144 at r1 (raw file):
Previously, lukedirtwalker (Lukas Vogel) wrote…
See comment below, maybe this could be simplified.
Done.
go/beacon_srv/internal/beaconing/propagator_test.go, line 245 at r1 (raw file):
Previously, lukedirtwalker (Lukas Vogel) wrote…
according to the explanation below and the code I wouldn't expect a call in run 3. Why is there one?
Done.
go/beacon_srv/internal/beaconing/propagator_test.go, line 260 at r1 (raw file):
Previously, lukedirtwalker (Lukas Vogel) wrote…
you could do this more explicit and concise I think:
firstCall := conn.EXPECT().WriteTo(gomock.Any(), gomock.Any()) secondCall := conn.EXPECT().WriteTo(gomock.Any(), gomock.Any()).After(firstCall).Return(errors.New("fail")) conn.EXPECT().WriteTo(gomock.Any(), gomock.Any()).After(secondCall).Times(3)(didn't test it though)
Nice.
go/beacon_srv/internal/beaconing/propagator_test.go, line 276 at r1 (raw file):
Previously, lukedirtwalker (Lukas Vogel) wrote…
hm this can't really be verified, but the total is good enough -ish
Sure, but its good enough I think.
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.
Reviewed 2 of 2 files at r2.
Reviewable status:complete! all files reviewed, all discussions resolved
The added tests check that the fast recovery mechanism works as
expected.
fixes #2685
This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)