TestDoubleCloseIsSafe verifies Close is idempotent.
(t *testing.T)
| 78 | |
| 79 | // TestDoubleCloseIsSafe verifies Close is idempotent. |
| 80 | func TestDoubleCloseIsSafe(t *testing.T) { |
| 81 | mustBeRoot(t) |
| 82 | b := New(Config{QueueNum: 4243}) |
| 83 | if err := b.Open(context.Background(), safeScope()); err != nil { |
| 84 | t.Fatalf("Open: %v", err) |
| 85 | } |
| 86 | if err := b.Close(); err != nil { |
| 87 | t.Fatalf("first Close: %v", err) |
| 88 | } |
| 89 | if err := b.Close(); err != nil { |
| 90 | t.Fatalf("second Close: %v", err) |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | // TestRawSocketAvailable verifies we can acquire a raw socket + IP_HDRINCL. |
| 95 | // If this fails, Inject() cannot work on this host (missing CAP_NET_RAW). |
nothing calls this directly
no test coverage detected