Fix TestTrigger_Error using deterministic inputs #798
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TestTrigger_Error had an error test case that was expecting failure due to a
bad kubeconfig input. The kubeconfig was passed in via a flag/global variable
which means in the test its value is "". This is a problem since if the
kubeconfig is an empty string, one of the underlying functions will try to
authenticate using inClusterConfig which means that the test behaves
differently depending on whether in runs in a k8s pod with access to the
apiserver or not. In local and CI runs, the test passes since its either out of
a k8s cluster or running in a pod which cannot talk to the apiserver directly.
But in our nightly tests running in a tekton cluster, it fails.
The test was also using a golden input to exactly match errors. I modified it
to only match the part of errors which we return from our code.
Fixes #795
/kind bug
Verified this fix by running the golang-test task with Triggers on master (fails), and with this patch(pass)!
Changes
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide for more details.
Release Notes