MCPcopy Index your code
hub / github.com/google/gvisor / TestCreateNICWithOptions

Function TestCreateNICWithOptions

pkg/tcpip/stack/stack_test.go:2459–2552  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2457}
2458
2459func TestCreateNICWithOptions(t *testing.T) {
2460 type callArgsAndExpect struct {
2461 nicID tcpip.NICID
2462 opts stack.NICOptions
2463 err tcpip.Error
2464 }
2465
2466 tests := []struct {
2467 desc string
2468 calls []callArgsAndExpect
2469 }{
2470 {
2471 desc: "InvalidNICID",
2472 calls: []callArgsAndExpect{
2473 {
2474 nicID: tcpip.NICID(0),
2475 opts: stack.NICOptions{Name: "eth0"},
2476 err: &tcpip.ErrInvalidNICID{},
2477 },
2478 },
2479 },
2480 {
2481 desc: "DuplicateNICID",
2482 calls: []callArgsAndExpect{
2483 {
2484 nicID: tcpip.NICID(1),
2485 opts: stack.NICOptions{Name: "eth1"},
2486 err: nil,
2487 },
2488 {
2489 nicID: tcpip.NICID(1),
2490 opts: stack.NICOptions{Name: "eth2"},
2491 err: &tcpip.ErrDuplicateNICID{},
2492 },
2493 },
2494 },
2495 {
2496 desc: "DuplicateName",
2497 calls: []callArgsAndExpect{
2498 {
2499 nicID: tcpip.NICID(1),
2500 opts: stack.NICOptions{Name: "lo"},
2501 err: nil,
2502 },
2503 {
2504 nicID: tcpip.NICID(2),
2505 opts: stack.NICOptions{Name: "lo"},
2506 err: &tcpip.ErrDuplicateNICID{},
2507 },
2508 },
2509 },
2510 {
2511 desc: "Unnamed",
2512 calls: []callArgsAndExpect{
2513 {
2514 nicID: tcpip.NICID(1),
2515 opts: stack.NICOptions{},
2516 err: nil,

Callers

nothing calls this directly

Calls 6

NICIDTypeAlias · 0.92
NewFunction · 0.92
NewFunction · 0.92
CreateNICWithOptionsMethod · 0.80
RunMethod · 0.65
FatalfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…