Beautify test variables for clarity and remove stray comments.

reviewable/pr2557/r10
Justin Scott 8 years ago
parent e7e9ea0229
commit b9819ee63d

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

@ -135,7 +135,7 @@ func TestDeploymentManifest_WithTLS(t *testing.T) {
if err := yaml.Unmarshal([]byte(o), &d); err != nil {
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 {
t.Errorf("%s: expected tls verify env value %q, got %q", tt.name, tt.verify, got)
}
@ -454,7 +454,6 @@ func TestDeploymentManifest_WithNodeSelectors(t *testing.T) {
if err := yaml.Unmarshal([]byte(o), &d); err != nil {
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
for k, v := range tt.expect {
if got[k] != v {
@ -488,15 +487,6 @@ func TestDeploymentManifest_WithSetValues(t *testing.T) {
"spec.template.spec.activeDeadlineSeconds",
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 {
o, err := DeploymentManifest(&tt.opts)

Loading…
Cancel
Save