MCPcopy Create free account
hub / github.com/SamNet-dev/snix / TestDoubleCloseIsSafe

Function TestDoubleCloseIsSafe

platform/linux/nfqueue_integration_test.go:80–92  ·  view source on GitHub ↗

TestDoubleCloseIsSafe verifies Close is idempotent.

(t *testing.T)

Source from the content-addressed store, hash-verified

78
79// TestDoubleCloseIsSafe verifies Close is idempotent.
80func 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).

Callers

nothing calls this directly

Calls 5

mustBeRootFunction · 0.85
safeScopeFunction · 0.85
NewFunction · 0.70
OpenMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected