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

Support integration test framework that brings up a new control plane #87

Closed
pwittrock opened this issue Oct 19, 2017 · 10 comments
Closed
Assignees
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. sig/cli Categorizes an issue or PR as relevant to SIG CLI. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/code-feature

Comments

@pwittrock
Copy link
Member

pwittrock commented Oct 19, 2017

Time commitment: 30-60 hours (assuming knowledge of Go and the Ginkgo test framework)

We need a way to write integration tests for kubectl and point it at a control plane (apiserver, controller-manager, etcd, scheduler) running locally.

As a kubectl developer, when I write an integration test for kubectl, there should be a ginkgo test framework that launches a new control plane, and provides a kubeconfig to the test both as a tmp file and as a datastructure.

Framework should take the control plane binaries as flags instead of compiling them from source.

See example of a test framework that brings up the control plane here.

Link to existing e2e tests

@pwittrock pwittrock added for-new-contributors priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. sig/cli Categorizes an issue or PR as relevant to SIG CLI. 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. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 19, 2017
@kubernetes kubernetes deleted a comment from yland Nov 16, 2017
@apelisse
Copy link
Member

@pwittrock wrote somewhere else:

User story:
As a developer of CLIs that talk to Kubernetes APIs, I want to be able to write integration tests for my commands and libraries that run hermetically and locally in my development environment. I want these tests to experience what happens when run against a real apiserver and control plane, but run fast and locally.

Solution:
Provide a test harness that will bring up the Kubernetes control plane locally (apiserver, etcd, controller-manager) locally for each tests.

Individual steps:

  • Write a library to bring up etcd from a binary
  • Write a library to bring up apiserver from a binary, talk to the local etcd, and provide a kubeconfig file to talk to the apiserver from kubectl or client-go
  • Write a library to bring up the controller-manager from a binary and have it talk to the apiserver
  • Wrap the libraries in a test harness that will bring them up / tear them down for each test suite
  • Setup the pull / merge tests run against kubernetes/kubectl PRs so that the correct binaries are present and flags are provided to support the harness
  • Support brining up other pieces of the system such as the scheduler and faking out nodes
  • Build helper test libraries for forcing error states

As a high level goal, I would like to be able to publish the framework for any Kubernetes clients to use when testing so that tools such as helm could also benefit.

The goal is to deprecate test-cmd.sh for the many reasons that makes it a bad thing (it's very hard to debug, it's monolithic, and much more)

@apelisse
Copy link
Member

apelisse commented Nov 16, 2017

As a developer of CLIs

I think it might be useful to think broader. If I work on nodes, wouldn't I need to test against these components too? Let's just say we should have composable testing components, that lets a kubernetes engineer, or even an engineer working on a kubernetes solution, test his software easily, reliably and quickly.

@pwittrock
Copy link
Member Author

Agreed, the next big step for this is helping folks test their CRDs, which would mean some way of loading the CRD and controller from the harness as well.

@totherme
Copy link
Contributor

This looks awesome. @hoegaarden and I would like to have a crack at it. We chatted with @pwittrock about it on a call, and have a good idea where to start.

cc @seans3 @mengqiy I would like to take this

@shiywang
Copy link

shiywang commented Nov 20, 2017

@totherme cool, since we can't assign to you now, assign myself as a placeholder : )

@shiywang shiywang self-assigned this Nov 20, 2017
@pwittrock
Copy link
Member Author

+1

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 16, 2018
@mengqiy mengqiy removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 16, 2018
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 14, 2018
@nikhita
Copy link
Member

nikhita commented Jul 5, 2018

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 5, 2018
@mengqiy
Copy link
Member

mengqiy commented Jul 10, 2018

This has been done. It's at https://github.com/kubernetes-sigs/testing_frameworks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. sig/cli Categorizes an issue or PR as relevant to SIG CLI. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/code-feature
Projects
None yet
Development

No branches or pull requests

9 participants