Skip to content

Add tests to watch.go #151

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

Merged
merged 3 commits into from
Mar 22, 2021

Conversation

atoato88
Copy link
Contributor

@atoato88 atoato88 commented Feb 9, 2021

This PR adds unit tests for watch.go
As of now part of tests are implemented, I'll add additional tests.

related to: #150

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 9, 2021
@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 9, 2021
This commit adds unit tests for watch.go
As of now part of tests are implemented, I'll add additional tests.
@atoato88 atoato88 force-pushed the add-unit-test-watch-go branch from 7814ba1 to 27795a3 Compare February 15, 2021 03:59
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 15, 2021
@atoato88
Copy link
Contributor Author

/retitle Add tests to watch.go

I'd like to add more tests, but it's difficult on unit test. It may need k8s cluster and it's not unit test, I think.
So I remove [WIP] tag from PR title.

@k8s-ci-robot k8s-ci-robot changed the title [WIP] Add tests to watch.go Add tests to watch.go Feb 16, 2021
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 16, 2021
@atoato88
Copy link
Contributor Author

/assign @justinsb
Could you review this?

@atoato88
Copy link
Contributor Author

atoato88 commented Mar 5, 2021

/assign @pwittrock
Could you review this PR?

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
actualSchema := uniqueGroupVersionKind(tt.inputObjects)
assert.Equal(t, tt.expectedSchema, actualSchema)
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI, the google go style guide says to avoid assertion libraries, and to use e.g.

if diff := cmp.Diff(got, want); diff != "" {
  t.Errorf("unexpected result from watch; diff %s", diff)
}

(or something along those lines)

@justinsb
Copy link
Contributor

Thanks @atoato88 . A suggestion to avoid assertion libraries, but that's more based on my code style guide from work, and I don't know that kubernetes has made the same statement.

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 21, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: atoato88, justinsb

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 21, 2021
@justinsb
Copy link
Contributor

/retest

Test failure was unrelated, should have been fixed by #155

@k8s-ci-robot k8s-ci-robot merged commit 196f208 into kubernetes-sigs:master Mar 22, 2021
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. 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.

4 participants