-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Can't run tests locally #90
Comments
You'll need a certain set of components (kube-apiserver, kubectl, etc) to run the tests, and they either have to be in a certain location, or you have to set the I've got a PR up that makes some improvements to this process (#86), and will gladly attempt to make it easier |
Probably the easiest way to make it easier is to document how to do it :) Is there a way to just run unit tests locally and leave the e2e tests for CI? |
The tests in controller-runtime are hybrid unit/integration tests -- most of them don't use mocks or stubs, and instead just use a real API server, but not the rest of the kubernetes cluster. It makes the tests a lot easier to read and write, and means that we're more likely to be testing real behavior... ... which is a really long way of saying "no", since running just the tests that didn't require an API server instance would skip almost all of the useful tests. The In the mean time, if you already have a kubernetes release hanging around, just set |
In Now there's probably plenty we haven't hit yet that you folks have, but I would expect that the set of tests that need such heavy machinery to be the exception not the rule. :( |
So, IMO, the problem with reactor tests is that one of two things often happen -- either you end up testing the actions that occur, and not the desired state (which is often suboptimal when testing kubernetes, and makes it harder to refactor), or you end up replicating the API server with maps, and as you end up using more API server functionality, you end up with more and more code to mock out the API server. Occasionally, you end up with both. If you just use an actual API server, you get that functionality without too much mess or extra work. (also, note that we don't need a full cluster -- just an single etcd instance and API server, and that the test harness actually takes care of starting these for you). |
Ultimately I was able to run tests locally on a different machine that had previously installed kubebuilder. Yes this should be documented but that's a different issue. 😄 |
I saw the same error when I ran
The following steps resolved the error for me and then
|
When I run
go test ./pkg/...
, I get a bunch of errors that seem to be complaining about a missing/usr/local/bin/kubebuilder/bin/etcd
executable:So I try to run
./test.sh
but that exits immediately:Are there any docs on how to run tests?
The text was updated successfully, but these errors were encountered: