MCPcopy Index your code
hub / github.com/linuxkit/linuxkit / TestIdMap

Function TestIdMap

src/cmd/linuxkit/moby/config_test.go:79–109  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

77}
78
79func TestIdMap(t *testing.T) {
80 idMap := map[string]uint32{"test": 199}
81
82 var uid interface{} = "test"
83 var gid interface{} = 76
84
85 yaml := Image{
86 Name: "test",
87 Image: "testimage",
88 ImageConfig: ImageConfig{
89 UID: &uid,
90 GID: &gid,
91 },
92 }
93
94 var label = ImageConfig{}
95
96 inspect := setupInspect(t, label)
97
98 oci, _, err := ConfigToOCI(&yaml, inspect, idMap)
99 if err != nil {
100 t.Error(err)
101 }
102
103 if oci.Process.User.UID != 199 {
104 t.Error("Expected named uid to work")
105 }
106 if oci.Process.User.GID != 76 {
107 t.Error("Expected numerical gid to work")
108 }
109}

Callers

nothing calls this directly

Calls 3

setupInspectFunction · 0.85
ConfigToOCIFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected