MCPcopy
hub / github.com/netbirdio/netbird / TestParseIfconfigOutput

Function TestParseIfconfigOutput

client/iface/freebsd/iface_internal_test.go:10–31  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestParseIfconfigOutput(t *testing.T) {
11 testOutput := `wg1: flags=8080<NOARP,MULTICAST> metric 0 mtu 1420
12 options=80000<LINKSTATE>
13 groups: wg
14 nd6 options=109<PERFORMNUD,IFDISABLED,NO_DAD>`
15
16 expected := &iface{
17 Name: "wg1",
18 MTU: 1420,
19 Group: "wg",
20 }
21
22 result, err := parseIfconfigOutput(([]byte)(testOutput))
23 if err != nil {
24 t.Errorf("Error parsing ifconfig output: %v", err)
25 return
26 }
27
28 assert.Equal(t, expected.Name, result.Name, "Name should match")
29 assert.Equal(t, expected.MTU, result.MTU, "MTU should match")
30 assert.Equal(t, expected.Group, result.Group, "Group should match")
31}
32
33func TestParseIFName(t *testing.T) {
34 tests := []struct {

Callers

nothing calls this directly

Calls 3

parseIfconfigOutputFunction · 0.85
ErrorfMethod · 0.80
EqualMethod · 0.65

Tested by

no test coverage detected