MCPcopy Create free account
hub / github.com/containers/common / TestMergeCapabilitiesAddAll

Function TestMergeCapabilitiesAddAll

pkg/capabilities/capabilities_test.go:58–74  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

56}
57
58func TestMergeCapabilitiesAddAll(t *testing.T) {
59 base := []string{"CAP_SYS_ADMIN", "CAP_NET_ADMIN", "CAP_CHOWN"}
60 adds := []string{"all"}
61 drops := []string{}
62 caps, err := MergeCapabilities(base, adds, drops)
63 require.Nil(t, err)
64 allCaps, err := BoundingSet()
65 require.Nil(t, err)
66 assert.Equal(t, caps, allCaps)
67
68 drops = []string{"CAP_SETUID", "CAP_CHOWN"}
69 caps, err = MergeCapabilities(base, adds, drops)
70 require.Nil(t, err)
71 assert.NotEqual(t, caps, allCaps)
72 assert.False(t, stringInSlice("CAP_SETUID", caps))
73 assert.False(t, stringInSlice("CAP_CHOWN", caps))
74}
75
76func TestMergeCapabilitiesAddAllDropAll(t *testing.T) {
77 base := []string{"CAP_SYS_ADMIN", "CAP_NET_ADMIN", "CAP_CHOWN"}

Callers

nothing calls this directly

Calls 3

MergeCapabilitiesFunction · 0.85
BoundingSetFunction · 0.85
stringInSliceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…