kubernetes/pkg
Rodrigo Campos 466c4d24a9 pkg/kubelet: skip long test on short mode
When adding functionality to the kubelet package and a test file, is
kind of painful to run unit tests today locally.

We usually can't run specifying the test file, as if xx_test.go and
xx.go use the same package, we need to specify all the dependencies. As
soon as xx.go uses the Kuebelet type (we need to do that to fake a
kubelet in the unit tests), this is completely impossible to do in
practice.

So the other option is to run the unit tests for the whole package or
run only a specific funtion. Running a single function can work in some
cases, but it is painful when we want to test all the functions we
wrote. On the other hand, running the test for the whole package is very
slow.

Today some unit tests try to connect to the API server (with retries)
create and list lot of pods/volumes, etc. This makes running the unit
test for the kubelet package slow.

This patch tries to make running the unit test for the whole package
more palatable. This patch adds a skip if the short version was
requested (go test -short ...), so we don't try to connect
to the API server or skip other slow tests.

Before this patch running the unit tests took in my computer (I've run
it several times so the compilation is already done):

	$ time go test -v
	real	0m21.303s
	user	0m9.033s
	sys	0m2.052s

With this patch it takes ~1/3 of the time:

	$ time go test -short -v
	real	0m7.825s
	user	0m9.588s
	sys	0m1.723s

Around 8 seconds is something I can wait to run the tests :)

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2022-06-24 18:00:21 +02:00
..
api kubelet: Mark ready condition as false explicitly for terminal pods 2022-06-08 16:19:16 -07:00
apis Merge pull request #110410 from Jiawei0227/master 2022-06-22 04:05:48 -07:00
auth Merge pull request #105598 from gy95/match 2022-01-05 09:22:38 -08:00
capabilities
client Cleanup: defer to close server in tests (#110367) 2022-06-21 08:00:38 -07:00
cloudprovider run update-yamlfmt.sh 2022-01-10 08:14:37 -05:00
cluster/ports e2e_node/{service,util}: use kubelet healthz port. 2022-04-22 16:14:31 -07:00
controller Merge pull request #110639 from aojea/slice_no_node 2022-06-22 10:43:42 -07:00
controlplane Clean shutdown of storageversion integration tests 2022-06-06 20:33:20 +02:00
credentialprovider fix image pulling failure when IMDS is unavailalbe in kubelet startup 2022-06-12 04:57:42 +00:00
features Merge pull request #110411 from trierra/px-beta-125 2022-06-24 07:02:58 -07:00
fieldpath
generated logs: make LoggingConfiguration an unversioned API 2022-06-17 20:22:13 +02:00
kubeapiserver Remove PodSecurityPolicy admission plugin 2022-05-04 16:00:56 -04:00
kubectl add server-side validation support to kubectl 2022-03-26 03:45:13 +00:00
kubelet pkg/kubelet: skip long test on short mode 2022-06-24 18:00:21 +02:00
kubemark Merge pull request #108066 from marseel/dont_check_type_in_hostvolule_in_kubemark 2022-02-18 00:38:24 -08:00
printers apiserver: printers should use int64 2022-06-07 12:04:33 -04:00
probe remove TODOs from http package and prober 2022-04-28 16:51:11 +00:00
proxy fix comments in pkg/proxy/types.go 2022-06-24 09:50:02 +08:00
quota/v1 Merge pull request #101997 from shawnhanx/pvcquota 2022-06-01 15:49:46 -07:00
registry Merge pull request #110410 from Jiawei0227/master 2022-06-22 04:05:48 -07:00
routes Switch to v3 of github.com/emicklei/go-restful 2022-06-09 14:11:41 -04:00
scheduler Merge pull request #110410 from Jiawei0227/master 2022-06-22 04:05:48 -07:00
security Remove PodSecurityPolicy admission plugin 2022-05-04 16:00:56 -04:00
securitycontext Add missing test cases for RunAsGroup and SetRunAsGroup methods 2021-12-24 17:13:45 +08:00
serviceaccount Switch to v3 of github.com/emicklei/go-restful 2022-06-09 14:11:41 -04:00
util Merge pull request #109844 from danwinship/iptables-tests-new 2022-06-10 14:27:44 -07:00
volume Merge pull request #110719 from xakdwch/master 2022-06-24 03:40:57 -07:00
windows/service Fix typo at pkg/windows/service/service.go:94 2022-03-24 07:25:33 -04:00
.import-restrictions
OWNERS OWNERS cleanup - Jan 2021 Week 1 2022-01-10 08:14:29 -05:00