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

contributing guide: add initial section on testing #1468

Merged
merged 1 commit into from
Dec 8, 2017

Conversation

tpepper
Copy link
Member

@tpepper tpepper commented Dec 6, 2017

This commit replaces the "Improvements needed" marker for the testing
topic with an initial section of overview information and jumping off links
to sig-testing, test documentation, and test code.

Part of: #1413

Signed-off-by: Tim Pepper [email protected]

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 6, 2017
@tpepper
Copy link
Member Author

tpepper commented Dec 6, 2017

/assign @guineveresaenger @spiffxp

@k8s-ci-robot
Copy link
Contributor

@tpepper: GitHub didn't allow me to assign the following users: guineveresaenger.

Note that only kubernetes members can be assigned.

In response to this:

/assign @guineveresaenger @spiffxp

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.

Copy link
Member

@cblecker cblecker left a comment

Choose a reason for hiding this comment

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

It might also be worth noting in some place that CI runs these tests either as presubmits on PRs, post submits against master/release branches, or both (maybe even with a link to testgrid (https://testgrid.k8s.io)

_Improvements needed_
* link to testing process
* walkthrough of where to find what in the tests (how to use, how to debug)
Testing is the responsibility of all contributors and is in part owned by all sigs, but is also coordinated by [sig-testing](https://github.com/kubernetes/community/tree/master/sig-testing).
Copy link
Member

Choose a reason for hiding this comment

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

Link should be: /sig-testing

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

* walkthrough of where to find what in the tests (how to use, how to debug)
Testing is the responsibility of all contributors and is in part owned by all sigs, but is also coordinated by [sig-testing](https://github.com/kubernetes/community/tree/master/sig-testing).

The main testing overview document is [here](https://github.com/kubernetes/community/blob/master/contributors/devel/testing.md).
Copy link
Member

Choose a reason for hiding this comment

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

Link should be: /contributors/devel/testing.md

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed


The main testing overview document is [here](https://github.com/kubernetes/community/blob/master/contributors/devel/testing.md).

There are three coarse types of test in kubernetes. The location of the test code varies with type, as does the specifics of the environment needed to successfully run the test:
Copy link
Member

Choose a reason for hiding this comment

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

s/coarse/core/ ?

Copy link
Member Author

Choose a reason for hiding this comment

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

just dropped the word leaving "three types"


There are three coarse types of test in kubernetes. The location of the test code varies with type, as does the specifics of the environment needed to successfully run the test:

* Unit: These confirm that a particular function behaves as intended. Golang includes native ability for unit testing via the [testing](https://golang.org/pkg/testing/) package. Unit test source code can be found adjacent to the corresponding source code within a given package. For example: functions defined in [kubernetes/cmd/kubeadm/app/util/version.go](https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/util/version.go) will have unit tests in [kubernetes/cmd/kubeadm/app/util/version_test.go](https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/util/version_test.go). These are easily run locally be any developer on any OS.
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

There are three coarse types of test in kubernetes. The location of the test code varies with type, as does the specifics of the environment needed to successfully run the test:

* Unit: These confirm that a particular function behaves as intended. Golang includes native ability for unit testing via the [testing](https://golang.org/pkg/testing/) package. Unit test source code can be found adjacent to the corresponding source code within a given package. For example: functions defined in [kubernetes/cmd/kubeadm/app/util/version.go](https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/util/version.go) will have unit tests in [kubernetes/cmd/kubeadm/app/util/version_test.go](https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/util/version_test.go). These are easily run locally be any developer on any OS.
* Integration: These tests cover interactions of package components or interactions between kubernetes components and some other non-kubernetes system resource (eg: etcd). An example would be testing whether a piece of code can correctly store data to or retrieve data from etcd. Integration tests are stored [here](https://github.com/kubernetes/kubernetes/tree/master/test/integration). Running these can require the developer set up additional functionality on their development system.
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed


* Unit: These confirm that a particular function behaves as intended. Golang includes native ability for unit testing via the [testing](https://golang.org/pkg/testing/) package. Unit test source code can be found adjacent to the corresponding source code within a given package. For example: functions defined in [kubernetes/cmd/kubeadm/app/util/version.go](https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/util/version.go) will have unit tests in [kubernetes/cmd/kubeadm/app/util/version_test.go](https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/util/version_test.go). These are easily run locally be any developer on any OS.
* Integration: These tests cover interactions of package components or interactions between kubernetes components and some other non-kubernetes system resource (eg: etcd). An example would be testing whether a piece of code can correctly store data to or retrieve data from etcd. Integration tests are stored [here](https://github.com/kubernetes/kubernetes/tree/master/test/integration). Running these can require the developer set up additional functionality on their development system.
* End-to-end ("e2e"): These are broad tests of overall kubernetes system behavior and coherence. These are more complicated as they require a functional kubernetes cluster built from the sources to be tested. A separate document [here](https://github.com/kubernetes/community/blob/master/contributors/devel/e2e-tests.md) details e2e testing and test cases themselves can be found [here](https://github.com/kubernetes/kubernetes/tree/master/test/e2e).
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

* Integration: These tests cover interactions of package components or interactions between kubernetes components and some other non-kubernetes system resource (eg: etcd). An example would be testing whether a piece of code can correctly store data to or retrieve data from etcd. Integration tests are stored [here](https://github.com/kubernetes/kubernetes/tree/master/test/integration). Running these can require the developer set up additional functionality on their development system.
* End-to-end ("e2e"): These are broad tests of overall kubernetes system behavior and coherence. These are more complicated as they require a functional kubernetes cluster built from the sources to be tested. A separate document [here](https://github.com/kubernetes/community/blob/master/contributors/devel/e2e-tests.md) details e2e testing and test cases themselves can be found [here](https://github.com/kubernetes/kubernetes/tree/master/test/e2e).

Sig-testing is responsible for official infrastructure and its associated automation, which is tracked in the [test-insfra repo](https://github.com/kubernetes/test-infra). If you're looking to run e2e tests on your own infrastructure, [kubetest](https://github.com/kubernetes/test-infra/tree/master/kubetest) is the mechanism.
Copy link
Member

Choose a reason for hiding this comment

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

s/Sig-testing/sig-testing/
s/test-insfra/test-infra/

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@tpepper
Copy link
Member Author

tpepper commented Dec 6, 2017

I think I hit all @cblecker 's comments and added the suggested CI & results blurb.

I thought about also adding a blurb on flakes, especially as a newbie contributor's first touch simple PR's are highly likely to hit job flakes that are clearly unrelated to their PR's (eg: simple comment or link url or typo or otherwise super trivial fixups). The section's already getting long though and @guineveresaenger doesn't want this doc to be large wall of text, so maybe that's better off in a testing FAQ elsewhere.


There are three types of test in kubernetes. The location of the test code varies with type, as does the specifics of the environment needed to successfully run the test:

* Unit: These confirm that a particular function behaves as intended. Golang includes native ability for unit testing via the [testing](https://golang.org/pkg/testing/) package. Unit test source code can be found adjacent to the corresponding source code within a given package. For example: functions defined in [kubernetes/cmd/kubeadm/app/util/version.go](https://git.k8s.io/kubernetes/cmd/kubeadm/app/util/version.go) will have unit tests in [kubernetes/cmd/kubeadm/app/util/version_test.go](https://git.k8s.io/kubernetes/cmd/kubeadm/app/util/version.go). These are easily run locally be any developer on any OS.
Copy link
Member

Choose a reason for hiding this comment

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

the version_test.go link leads to version.go

Copy link
Member Author

Choose a reason for hiding this comment

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

Dang copy paste while sitting in a conference talk multitasking. Refixed.

@cblecker
Copy link
Member

cblecker commented Dec 7, 2017

lgtm other than the one fix above. will leave for others to have a chance to look at
/ok-to-test
/approve

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 7, 2017
This commit replaces the "Improvements needed" marker for the testing
topic with an initial section of overview information and jumping off links
to sig-testing, test documentation, and test code.

Part of: kubernetes#1413

Signed-off-by: Tim Pepper <[email protected]>
@guineveresaenger
Copy link
Contributor

@tpepper this is beautiful! Thank you so much. This is concise, clear, and it helped me pull some bits of knowledge together to understand more, just by reading this PR.

@spiffxp someone with the power should merge this!

@cblecker
Copy link
Member

cblecker commented Dec 8, 2017

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cblecker, tpepper

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

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue.

@k8s-github-robot k8s-github-robot merged commit 1d05904 into kubernetes:master Dec 8, 2017
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. 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.

6 participants