(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func 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 | |
| 33 | func TestParseIFName(t *testing.T) { |
| 34 | tests := []struct { |
nothing calls this directly
no test coverage detected