mirror of
https://github.com/vishvananda/netlink.git
synced 2025-09-26 20:01:13 +08:00

Refactors test setup and teardown logic to use `t.Cleanup` instead of `defer`. This ensures that cleanup functions are correctly scoped to each subtest's lifecycle, improving test isolation and reliability. The `setUpNetlinkTest` helper function is also improved to correctly save and restore the original network namespace, ensuring that tests do not leak state. To support this, a `Close()` method that returns an error is added to the `Handle` struct, allowing for proper cleanup of underlying netlink sockets. The test helpers are updated to use this new method, preventing resource leaks between tests. Additionally, a bug in the `netns` tests is fixed where a large namespace ID could overflow a 32-bit integer, causing spurious failures on some systems.
27 lines
498 B
Go
27 lines
498 B
Go
//go:build !linux
|
|
// +build !linux
|
|
|
|
package netlink
|
|
|
|
type GenlOp struct{}
|
|
|
|
type GenlMulticastGroup struct{}
|
|
|
|
type GenlFamily struct{}
|
|
|
|
func (h *Handle) GenlFamilyList() ([]*GenlFamily, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
|
|
func GenlFamilyList() ([]*GenlFamily, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
|
|
func (h *Handle) GenlFamilyGet(name string) (*GenlFamily, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
|
|
func GenlFamilyGet(name string) (*GenlFamily, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|