mirror of https://github.com/vishvananda/netlink
Mark skipUnlessRoot and minKernelRequired as test helpers
With this, the skip message will display the position of the helper invocation (i.e. the test that caused the skip) instead of the position of the t.Skip call in minKernelRequired the helper.
This commit is contained in:
parent
d18d70b0d9
commit
ccef072df0
|
@ -24,6 +24,8 @@ import (
|
||||||
type tearDownNetlinkTest func()
|
type tearDownNetlinkTest func()
|
||||||
|
|
||||||
func skipUnlessRoot(t *testing.T) {
|
func skipUnlessRoot(t *testing.T) {
|
||||||
|
t.Helper()
|
||||||
|
|
||||||
if os.Getuid() != 0 {
|
if os.Getuid() != 0 {
|
||||||
t.Skip("Test requires root privileges.")
|
t.Skip("Test requires root privileges.")
|
||||||
}
|
}
|
||||||
|
@ -187,6 +189,8 @@ func remountSysfs() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func minKernelRequired(t *testing.T, kernel, major int) {
|
func minKernelRequired(t *testing.T, kernel, major int) {
|
||||||
|
t.Helper()
|
||||||
|
|
||||||
k, m, err := KernelVersion()
|
k, m, err := KernelVersion()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|
Loading…
Reference in New Issue