MCPcopy Create free account
hub / github.com/coder/coder / Test_generateInterfacesReport

Function Test_generateInterfacesReport

codersdk/healthsdk/interfaces_internal_test.go:16–191  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

14)
15
16func Test_generateInterfacesReport(t *testing.T) {
17 t.Parallel()
18 testCases := []struct {
19 name string
20 state interfaces.State
21 severity health.Severity
22 expectedInterfaces []string
23 expectedWarnings []string
24 }{
25 {
26 name: "Empty",
27 state: interfaces.State{},
28 severity: health.SeverityOK,
29 expectedInterfaces: []string{},
30 },
31 {
32 name: "Normal",
33 state: interfaces.State{
34 Interface: map[string]interfaces.Interface{
35 "en0": {Interface: &net.Interface{
36 MTU: 1500,
37 Name: "en0",
38 Flags: net.FlagUp,
39 }},
40 "lo0": {Interface: &net.Interface{
41 MTU: 65535,
42 Name: "lo0",
43 Flags: net.FlagUp,
44 }},
45 },
46 InterfaceIPs: map[string][]netip.Prefix{
47 "en0": {
48 netip.MustParsePrefix("192.168.100.1/24"),
49 netip.MustParsePrefix("fe80::c13:1a92:3fa5:dd7e/64"),
50 },
51 "lo0": {
52 netip.MustParsePrefix("127.0.0.1/8"),
53 netip.MustParsePrefix("::1/128"),
54 netip.MustParsePrefix("fe80::1/64"),
55 },
56 },
57 },
58 severity: health.SeverityOK,
59 expectedInterfaces: []string{"en0", "lo0"},
60 },
61 {
62 name: "IgnoreDisabled",
63 state: interfaces.State{
64 Interface: map[string]interfaces.Interface{
65 "en0": {Interface: &net.Interface{
66 MTU: 1300,
67 Name: "en0",
68 Flags: 0,
69 }},
70 "lo0": {Interface: &net.Interface{
71 MTU: 65535,
72 Name: "lo0",
73 Flags: net.FlagUp,

Callers

nothing calls this directly

Calls 7

generateInterfacesReportFunction · 0.85
RunMethod · 0.65
EqualMethod · 0.45
LenMethod · 0.45
ContainsMethod · 0.45
StringMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected