Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix error output in kubernetes_test.go #157

Merged
merged 1 commit into from
Jun 5, 2017

Conversation

concaf
Copy link
Collaborator

@concaf concaf commented Jun 2, 2017

Currently, func TestTransformer_CreateDeployments(t *testing.T)
fails like -

Expected: []runtime.Object{(*v1beta1.Deployment)(0xc420290380)}
Got: []runtime.Object{(*v1beta1.Deployment)(0xc420290a80)}

After, this commit, the fields are printed, which makes it
possible to debug.

@concaf concaf requested review from surajssd and cdrage June 2, 2017 21:37
@concaf concaf self-assigned this Jun 2, 2017
@concaf concaf added size/XS and removed size/S labels Jun 5, 2017
@@ -688,7 +688,7 @@ func TestTransformer_CreateDeployments(t *testing.T) {
}

if !reflect.DeepEqual(kd, test.K8sDeployments) {
t.Errorf("Expected: %#v\nGot: %#v\n", test.K8sDeployments, kd)
t.Errorf("Expected: %#v\nGot: %#v\n", test.K8sDeployments[0], kd[0])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hardcoding the index values is not very good, use something like spew.Sprint to get the string format of the entire object.

I have done something similar in my PR #143 at https://github.com/redhat-developer/opencompose/pull/143/files#diff-c04853213c3b672346e99815d4cf3e55R760

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, didn't about spew :)
TIL 👍
Fixed.

Currently, func TestTransformer_CreateDeployments(t *testing.T)
fails like -

Expected: []runtime.Object{(*v1beta1.Deployment)(0xc420290380)}
Got: []runtime.Object{(*v1beta1.Deployment)(0xc420290a80)}

After, this commit, the fields are printed, which makes it
possible to debug.
@concaf concaf force-pushed the fix_error_test_message branch from 8d209d9 to 3f911e3 Compare June 5, 2017 10:32
@cdrage
Copy link
Member

cdrage commented Jun 5, 2017

LGTM

@cdrage cdrage merged commit 58cfe91 into redhat-developer:master Jun 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants