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

Function TestSecrets

cli/compose/convert/compose_test.go:123–152  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

121}
122
123func TestSecrets(t *testing.T) {
124 namespace := Namespace{name: "foo"}
125
126 secretText := "this is the first secret"
127 secretFile := fs.NewFile(t, "convert-secrets", fs.WithContent(secretText))
128 defer secretFile.Remove()
129
130 source := map[string]composetypes.SecretConfig{
131 "one": {
132 File: secretFile.Path(),
133 Labels: map[string]string{"monster": "mash"},
134 },
135 "ext": {
136 External: composetypes.External{
137 External: true,
138 },
139 },
140 }
141
142 specs, err := Secrets(namespace, source)
143 assert.NilError(t, err)
144 assert.Assert(t, is.Len(specs, 1))
145 secret := specs[0]
146 assert.Check(t, is.Equal("foo_one", secret.Name))
147 assert.Check(t, is.DeepEqual(map[string]string{
148 "monster": "mash",
149 LabelNamespace: "foo",
150 }, secret.Labels))
151 assert.Check(t, is.DeepEqual([]byte(secretText), secret.Data))
152}
153
154func TestConfigs(t *testing.T) {
155 namespace := Namespace{name: "foo"}

Callers

nothing calls this directly

Calls 4

SecretsFunction · 0.85
RemoveMethod · 0.65
PathMethod · 0.65
LenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…