Revert "Beautify test variables for clarity and remove stray comments."

This reverts commit b2b2e90eb831f1a712c333faa1cab48dd1d81cd9.
reviewable/pr2557/r11
Justin Scott 8 years ago
parent b9819ee63d
commit da5a523a60

@ -320,8 +320,8 @@ func TestInitCmd_output(t *testing.T) {
}() }()
fc := fake.NewSimpleClientset() fc := fake.NewSimpleClientset()
tests := []struct { tests := []struct {
unmarshal func([]byte, interface{}) error expectF func([]byte, interface{}) error
format string expectName string
}{ }{
{ {
json.Unmarshal, json.Unmarshal,
@ -338,7 +338,7 @@ func TestInitCmd_output(t *testing.T) {
out: &buf, out: &buf,
home: helmpath.Home(home), home: helmpath.Home(home),
kubeClient: fc, kubeClient: fc,
opts: installer.Options{Output: installer.OutputFormat(s.format)}, opts: installer.Options{Output: installer.OutputFormat(s.expectName)},
namespace: v1.NamespaceDefault, namespace: v1.NamespaceDefault,
} }
if err := cmd.run(); err != nil { if err := cmd.run(); err != nil {
@ -348,8 +348,9 @@ func TestInitCmd_output(t *testing.T) {
t.Errorf("expected no server calls, got %d", got) t.Errorf("expected no server calls, got %d", got)
} }
d := &v1beta1.Deployment{} d := &v1beta1.Deployment{}
if err = s.unmarshal(buf.Bytes(), &d); err != nil { if err = s.expectF(buf.Bytes(), &d); err != nil {
t.Errorf("error unmarshalling init %s output %s %s", s.format, err, string(buf.Bytes())) t.Errorf("error unmarshalling init %s output %s %s", s.expectName, err, string(buf.Bytes()))
} }
} }
} }

@ -135,7 +135,7 @@ func TestDeploymentManifest_WithTLS(t *testing.T) {
if err := yaml.Unmarshal([]byte(o), &d); err != nil { if err := yaml.Unmarshal([]byte(o), &d); err != nil {
t.Fatalf("%s: error %q", tt.name, err) t.Fatalf("%s: error %q", tt.name, err)
} }
// verify environment variable in deployment reflect the use of tls being enabled // verify environment variable in deployment reflect the use of tls being enabled.
if got := d.Spec.Template.Spec.Containers[0].Env[1].Value; got != tt.verify { if got := d.Spec.Template.Spec.Containers[0].Env[1].Value; got != tt.verify {
t.Errorf("%s: expected tls verify env value %q, got %q", tt.name, tt.verify, got) t.Errorf("%s: expected tls verify env value %q, got %q", tt.name, tt.verify, got)
} }
@ -454,6 +454,7 @@ func TestDeploymentManifest_WithNodeSelectors(t *testing.T) {
if err := yaml.Unmarshal([]byte(o), &d); err != nil { if err := yaml.Unmarshal([]byte(o), &d); err != nil {
t.Fatalf("%s: error %q", tt.name, err) t.Fatalf("%s: error %q", tt.name, err)
} }
// verify environment variable in deployment reflect the use of tls being enabled.
got := d.Spec.Template.Spec.NodeSelector got := d.Spec.Template.Spec.NodeSelector
for k, v := range tt.expect { for k, v := range tt.expect {
if got[k] != v { if got[k] != v {
@ -487,6 +488,15 @@ func TestDeploymentManifest_WithSetValues(t *testing.T) {
"spec.template.spec.activeDeadlineSeconds", "spec.template.spec.activeDeadlineSeconds",
120, 120,
}, },
/*
// TODO test --set value nested beneath list
{
Options{Namespace: v1.NamespaceDefault, Values: []string{"spec.template.spec.containers[0].image=gcr.io/kubernetes-helm/tiller:v2.4.2"}},
"setValues spec.template.spec.containers[0].image=gcr.io/kubernetes-helm/tiller:v2.4.2",
"spec.template.spec.containers[0].image",
"gcr.io/kubernetes-helm/tiller:v2.4.2",
},
*/
} }
for _, tt := range tests { for _, tt := range tests {
o, err := DeploymentManifest(&tt.opts) o, err := DeploymentManifest(&tt.opts)

Loading…
Cancel
Save