Skip to content

Conversation

vdemeester
Copy link
Member

@vdemeester vdemeester commented Sep 10, 2020

Changes

This tries to fix the test flakiness by making sure the informers for
serviceaccounts are up-to-date when we execute the tests. Otherwise we
may run into failure because the serviceaccount is not found.

Signed-off-by: Vincent Demeester [email protected]

/cc @pritidesai @bobcatfish

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Includes docs (if user facing)
  • Commit messages follow commit message best practices
  • Release notes block has been filled in or deleted (only if no user facing changes)

See the contribution guide for more details.

Double check this list of stuff that's easy to miss:

Reviewer Notes

If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.

/kind misc
/area testing
/release-note-none

@tekton-robot
Copy link
Collaborator

@vdemeester: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot tekton-robot added kind/misc Categorizes issue or PR as a miscellaneuous one. area/testing Issues or PRs related to testing do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 10, 2020
@vdemeester
Copy link
Member Author

/release-note-none

@tekton-robot tekton-robot added release-note-none Denotes a PR that doesnt merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Sep 10, 2020
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
test/controller.go 27.3% 25.8% -1.5

Condition informersv1alpha1.ConditionInformer
Pod coreinformers.PodInformer
ConfigMap coreinformers.ConfigMapInformer
ServiceAccount coreinformers.ServiceAccountInformer
Copy link
Member

Choose a reason for hiding this comment

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

@vdemeester I am trying to understand this, why making this as part of informer? and creating fake service account informer?

Copy link
Member Author

Choose a reason for hiding this comment

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

From https://github.com/tektoncd/pipeline/pull/3189/files#r486827794, this is an "helper" to remove the need to do the clients.Kube.CoreV1().ServiceAccounts(tc.taskRun.Namespace).Create during the test.

t.Fatal(err)
}
}
c.Kube.PrependReactor("*", "serviceaccounts", AddToInformer(t, i.ServiceAccount.Informer().GetIndexer()))
Copy link
Member

@pritidesai pritidesai Sep 11, 2020

Choose a reason for hiding this comment

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

This is similar to the other resources we have pipeline, pipelinerun, etc. and I am guessing this would be needed for all service accounts that a task/pipeline is expecting including default. i.e. update all unit tests to utilize this fake service account? how is it different than what we have today 🤔

clients.Kube.CoreV1().ServiceAccounts(tc.taskRun.Namespace).Create(&corev1.ServiceAccount{

Copy link
Member Author

Choose a reason for hiding this comment

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

As of today, we don't have the reactor, so the informer are/might be out-of-sync. This can cause errors during tests where the serviceaccount is not found. Having this fixes that problem.

Copy link
Member Author

Choose a reason for hiding this comment

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

but indeed, we should update the unit tests that manually create the ServiceAccounts to use this instead

@pritidesai
Copy link
Member

sounds good, thanks @vdemeester lets go with this. Next we will be updating rest of the unit tests in taskrun_test.go and add the same informer update in pipelinerun_test.go
/approve

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pritidesai

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:

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

@tekton-robot tekton-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Sep 14, 2020
@tekton-robot
Copy link
Collaborator

@vdemeester: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

This tries to fix the test flakiness by making sure the informers for
serviceaccounts are up-to-date when we execute the tests. Otherwise we
may run into failure because the serviceaccount is not found.

Signed-off-by: Vincent Demeester <[email protected]>
@tekton-robot tekton-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 15, 2020
@vdemeester vdemeester removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 15, 2020
@piyush-garg
Copy link
Contributor

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 17, 2020
@tekton-robot tekton-robot merged commit 3cf297a into tektoncd:master Sep 17, 2020
@vdemeester vdemeester deleted the 3160-sa-unit-failure branch September 17, 2020 14:02
@bobcatfish
Copy link
Collaborator

Part of #2185 - might need to make same change for other tests as well?

@pritidesai pritidesai mentioned this pull request Sep 28, 2020
4 tasks
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. area/testing Issues or PRs related to testing kind/misc Categorizes issue or PR as a miscellaneuous one. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesnt merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants