MCPcopy Index your code
hub / github.com/docker/cli / TestParseSystemPaths

Function TestParseSystemPaths

cli/command/container/opts_test.go:1077–1129  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1075}
1076
1077func TestParseSystemPaths(t *testing.T) {
1078 tests := []struct {
1079 doc string
1080 in, out, masked, readonly []string
1081 }{
1082 {
1083 doc: "not set",
1084 in: []string{},
1085 out: []string{},
1086 },
1087 {
1088 doc: "not set, preserve other options",
1089 in: []string{
1090 "seccomp=unconfined",
1091 "apparmor=unconfined",
1092 "label=user:USER",
1093 "foo=bar",
1094 },
1095 out: []string{
1096 "seccomp=unconfined",
1097 "apparmor=unconfined",
1098 "label=user:USER",
1099 "foo=bar",
1100 },
1101 },
1102 {
1103 doc: "unconfined",
1104 in: []string{"systempaths=unconfined"},
1105 out: []string{},
1106 masked: []string{},
1107 readonly: []string{},
1108 },
1109 {
1110 doc: "unconfined and other options",
1111 in: []string{"foo=bar", "bar=baz", "systempaths=unconfined"},
1112 out: []string{"foo=bar", "bar=baz"},
1113 masked: []string{},
1114 readonly: []string{},
1115 },
1116 {
1117 doc: "unknown option",
1118 in: []string{"foo=bar", "systempaths=unknown", "bar=baz"},
1119 out: []string{"foo=bar", "systempaths=unknown", "bar=baz"},
1120 },
1121 }
1122
1123 for _, tc := range tests {
1124 securityOpts, maskedPaths, readonlyPaths := parseSystemPaths(tc.in)
1125 assert.DeepEqual(t, securityOpts, tc.out)
1126 assert.DeepEqual(t, maskedPaths, tc.masked)
1127 assert.DeepEqual(t, readonlyPaths, tc.readonly)
1128 }
1129}
1130
1131func TestConvertToStandardNotation(t *testing.T) {
1132 valid := map[string][]string{

Callers

nothing calls this directly

Calls 1

parseSystemPathsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…