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

Print all CRD as YAML on test failure #182

Merged

Conversation

tanner-bruce
Copy link

This code will dump out all build-pipeline CRDs when a test fails to
make debugging easier.

Currently purposely makes the PipelineRun test fail.

Fixes #145.

@knative-prow-robot knative-prow-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 24, 2018
@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 24, 2018
@shashwathi
Copy link
Contributor

/ok-to-test

@knative-prow-robot knative-prow-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 24, 2018
@nader-ziada
Copy link
Member

if the test is purposely failing, we would not be able to merge the PR

@nader-ziada
Copy link
Member

A sample of the output in case of a failing test can be found here: https://gubernator.knative.dev/build/knative-prow/pr-logs/pull/knative_build-pipeline/182/pull-knative-build-pipeline-integration-tests/1055088374320205825/

we will eventually have to make the test pass to be able to merge

@tanner-bruce
Copy link
Author

@pivotal-nader-ziada the purpose of making the test fail was to showcase the output and get feedback on it. If there is no additional output desired, I can update the other existing steps and fix the test to make the PR mergeable.

Copy link
Collaborator

@bobcatfish bobcatfish left a comment

Choose a reason for hiding this comment

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

I just have a couple comments about potentially refactoring the code a bit but very happy with getting this info dumped on test failure! i think this will be super useful :D

Gopkg.lock Show resolved Hide resolved
for _, i := range trs.Items {
printOrAdd("TaskRun", i.Name, i)
}
logger.Info(string(output))
Copy link
Collaborator

Choose a reason for hiding this comment

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

what do you think about making this a bit more compact with something like a for loop that iterates over a bunch of list functions?

Copy link
Author

Choose a reason for hiding this comment

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

Unfortunately all of the List functions are different types, and there is no common interface for Listing between the various clients, so I wasn't able to find a way to shorten this

Copy link
Collaborator

Choose a reason for hiding this comment

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

kk, thanks for looking!

test/pipelinerun_test.go Outdated Show resolved Hide resolved
test/pipelinerun_test.go Outdated Show resolved Hide resolved
test/pipelinerun_test.go Outdated Show resolved Hide resolved
test/pipelinerun_test.go Outdated Show resolved Hide resolved
@tanner-bruce tanner-bruce force-pushed the verbose-test-failure-output branch 3 times, most recently from 596f37a to 6f8a835 Compare October 29, 2018 05:44
@nader-ziada
Copy link
Member

I like the output now without the logs, the CRDs will be helpful in debugging

@tanner-bruce
Copy link
Author

@nader-ziada
Copy link
Member

it was a timeout, lets give it another shot and see if its a flakey test

/test pull-knative-build-pipeline-integration-tests

Tanner Bruce added 2 commits October 29, 2018 14:39
This will cause the `teardown` function to dump all Knative CRD objects
for the currently configured namepsace to YAML. This will make debugging
failed builds easier.

Fixes tektoncd#145.
@tejal29
Copy link
Contributor

tejal29 commented Oct 29, 2018

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 29, 2018
@nader-ziada
Copy link
Member

/approve

@knative-prow-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pivotal-nader-ziada, tanner-bruce

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [pivotal-nader-ziada]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 30, 2018
@knative-prow-robot knative-prow-robot merged commit a4a9277 into tektoncd:master Oct 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants