|
|
@ -5,7 +5,6 @@
|
|
|
|
package yaml
|
|
|
|
package yaml
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"reflect"
|
|
|
|
|
|
|
|
"testing"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
|
|
"gopkg.in/yaml.v2"
|
|
|
|
"gopkg.in/yaml.v2"
|
|
|
@ -15,32 +14,15 @@ func TestParam(t *testing.T) {
|
|
|
|
tests := []struct {
|
|
|
|
tests := []struct {
|
|
|
|
yaml string
|
|
|
|
yaml string
|
|
|
|
value interface{}
|
|
|
|
value interface{}
|
|
|
|
name string
|
|
|
|
from string
|
|
|
|
path string
|
|
|
|
|
|
|
|
}{
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
yaml: "bar",
|
|
|
|
yaml: "bar",
|
|
|
|
value: "bar",
|
|
|
|
value: "bar",
|
|
|
|
name: "",
|
|
|
|
|
|
|
|
path: "",
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
yaml: "[ bar ]",
|
|
|
|
yaml: "from_secret: username",
|
|
|
|
value: []interface{}{"bar"},
|
|
|
|
from: "username",
|
|
|
|
name: "",
|
|
|
|
|
|
|
|
path: "",
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
yaml: "from_secret: username",
|
|
|
|
|
|
|
|
value: nil,
|
|
|
|
|
|
|
|
name: "username",
|
|
|
|
|
|
|
|
path: "",
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
yaml: "from_secret: { path: secret/data/docker, name: username }",
|
|
|
|
|
|
|
|
value: nil,
|
|
|
|
|
|
|
|
name: "username",
|
|
|
|
|
|
|
|
path: "secret/data/docker",
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for _, test := range tests {
|
|
|
|
for _, test := range tests {
|
|
|
@ -51,14 +33,11 @@ func TestParam(t *testing.T) {
|
|
|
|
t.Error(err)
|
|
|
|
t.Error(err)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if got, want := out.Value, test.value; !reflect.DeepEqual(got, want) {
|
|
|
|
if got, want := out.Value, test.value; got != want {
|
|
|
|
t.Errorf("Want value %q of type %T, got %q of type %T", want, want, got, got)
|
|
|
|
t.Errorf("Want value %q, got %q", want, got)
|
|
|
|
}
|
|
|
|
|
|
|
|
if got, want := out.Secret.Name, test.name; got != want {
|
|
|
|
|
|
|
|
t.Errorf("Want from_secret.name %q, got %q", want, got)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if got, want := out.Secret.Path, test.path; got != want {
|
|
|
|
if got, want := out.Secret, test.from; got != want {
|
|
|
|
t.Errorf("Want from_secret.path %q, got %q", want, got)
|
|
|
|
t.Errorf("Want from_secret %q, got %q", want, got)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|