-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add unit tests #46
Add unit tests #46
Conversation
2ae54e3
to
fb32b5b
Compare
pkg/anycast/anycast_test.go
Outdated
var _ = BeforeSuite(func() { | ||
|
||
}) |
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.
rm
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.
Done
pkg/anycast/anycast_test.go
Outdated
} | ||
|
||
var _ = Describe("anycast", func() { | ||
Context("buildRoute() should", func() { |
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 would remove the "should" here. If it's about flow when reading, you can consider replacing Context
with another Describe
, so it can be read as "Describe buildRoute()".
Describe
, Context
and When
all do the same thing, they just exist to make it easier to read as sentences.
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.
Done
pkg/anycast/anycast_test.go
Outdated
|
||
var _ = Describe("anycast", func() { | ||
Context("buildRoute() should", func() { | ||
It("build route", func() { |
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.
nit: should be "builds route", which allows reading it as "It builds route".
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.
Done
pkg/anycast/anycast_test.go
Outdated
"Anycast Suite") | ||
} | ||
|
||
var _ = Describe("anycast", func() { |
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.
not sure if we need this wrapper, we could just have var _ = Describe()
for all the Context()
s that are contained in this one.
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.
Done. Removed also in other tests.
pkg/config/config_test.go
Outdated
var _ = BeforeSuite(func() { | ||
|
||
}) |
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.
rm
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.
Done
pkg/frr/dbus/dbus.go
Outdated
} | ||
|
||
type ConnInterface interface { |
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.
If there is nothing else using the name Connection
, I'd just call it that instead of adding the Interface
suffix. Same for System
.
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.
Done
pkg/nl/manager.go
Outdated
@@ -26,9 +26,14 @@ const ( | |||
var macPrefix = []byte("\x02\x54") | |||
|
|||
type NetlinkManager struct { |
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.
even though this isn't part of the MR, this should be called Manager
since the package is already called netlink (well, nl
).
https://go.dev/doc/effective_go#names
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.
Done
pkg/nl/interface.go
Outdated
LinkSetMaster(link netlink.Link, master netlink.Link) error | ||
} | ||
|
||
type NetlinkToolkit struct{} |
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.
should just be called Toolkit
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.
Done
fb32b5b
to
0473288
Compare
e60c302
to
287038d
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.
Sorry for ignoring this for so long. Could you rebase? Maybe after the other large ones are in. Good from my side, everything was basically just minor or nits anyway.
Signed-off-by: Patryk Strusiewicz-Surmacki <[email protected]>
287038d
to
4d64ff5
Compare
Signed-off-by: Patryk Strusiewicz-Surmacki <[email protected]>
4d64ff5
to
bdab15e
Compare
This is PR for unit tests.
The biggest change here is creation of additional interface in
pkg/nl/interface.go
that will be later used as intermediate layer between our packages and netlink library. This way we can mock netlink calls using gomock.For
pkg/frr
DBus interface was introduced to fulfill the same goal.Current state: