kubernetes/pkg/kubelet
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
..
apis logs: replace config methods with functions 2022-06-17 20:22:13 +02:00
cadvisor Regen mocks using go 1.18 2022-03-23 10:19:38 -07:00
certificate fix copylock vet errors in component-base metrics 2022-03-31 15:07:11 +00:00
checkpointmanager remove fakefs to drop spf13/afero dependency 2021-06-24 09:51:34 -04:00
client Merge pull request #96004 from serathius/datapolicy-kubelet-pkg 2022-03-04 15:34:51 -08:00
cloudresource
cm Merge pull request #109692 from yxxhero/remove_ioutil_in_kubelet 2022-06-03 09:30:51 -07:00
config Mark pod-infra-container-image flag as deprecated 2022-02-14 09:11:51 +02:00
configmap Migrate to k8s.io/utils/clock in pkg/kubelet 2021-09-10 12:20:09 +02:00
container Regen mocks using go 1.18 2022-03-23 10:19:38 -07:00
cri Switch to v3 of github.com/emicklei/go-restful 2022-06-09 14:11:41 -04:00
custommetrics
envvars
events kubelet: add shutdown events 2021-06-23 16:44:19 -05:00
eviction Regen mocks using go 1.18 2022-03-23 10:19:38 -07:00
images Move from k8s.gcr.io to registry.k8s.io 2022-05-31 10:16:53 -04:00
kubeletconfig remove DynamicKubeletConfig logic from kubelet 2022-01-19 22:38:04 +00:00
kuberuntime Merge pull request #109692 from yxxhero/remove_ioutil_in_kubelet 2022-06-03 09:30:51 -07:00
leaky
lifecycle Check taint/toleration before accepting pods, except for static pods 2022-02-10 19:39:26 +09:00
logs remove ioutil in kubelet 2022-04-27 21:08:42 +08:00
metrics Merge pull request #108758 from fengzixu/improvement-volume-health 2022-03-29 17:35:34 -07:00
network kubelet: parseResolvConf: Handle "search ." 2022-04-12 15:39:31 -04:00
nodeshutdown kubelet: Pod probes should be handled by pod worker 2022-06-06 17:00:54 -05:00
nodestatus Move from k8s.gcr.io to registry.k8s.io 2022-05-31 10:16:53 -04:00
oom generated: Run hack/update-gofmt.sh 2021-08-24 15:47:49 -04:00
pleg enhance and fix log calls 2022-03-24 11:13:50 +01:00
pluginmanager Fix typo in pkg/kubelet/pluginmanager/cache/actual_state_of_world 2022-02-24 16:20:24 -05:00
pod Regen mocks using go 1.18 2022-03-23 10:19:38 -07:00
preemption migrated preemption.go, stateful.go, resource_allocation.go to structured logging 2021-11-08 22:52:47 +05:30
prober kubelet: add e2e test to verify probe readiness 2022-06-06 17:00:55 -05:00
qos
runtimeclass
secret Migrate to k8s.io/utils/clock in pkg/kubelet 2021-09-10 12:20:09 +02:00
server Switch to v3 of github.com/emicklei/go-restful 2022-06-09 14:11:41 -04:00
stats Revert "filter out terminated containers in cadvisor_stats_provider" 2022-06-15 16:09:37 -07:00
status kubelet: Mark ready condition as false explicitly for terminal pods 2022-06-08 16:19:16 -07:00
sysctl Remove PodSecurityPolicy admission plugin 2022-05-04 16:00:56 -04:00
token Merge pull request #99685 from yangjunmyfm192085/run-test24 2022-05-03 17:16:47 -07:00
types Clean up dockershim flags in the kubelet 2022-01-14 16:02:50 +02:00
util Fix leaking goroutines in kubelet integration test 2022-05-23 11:50:29 +02:00
volumemanager typo in comments pkg/kubelet/volumemanager/volume_manager.go 2022-06-20 09:59:01 +08:00
winstats add bootid support for windows node. 2022-03-18 02:17:52 +00:00
active_deadline_test.go Migrate to k8s.io/utils/clock in pkg/kubelet 2021-09-10 12:20:09 +02:00
active_deadline.go Migrate to k8s.io/utils/clock in pkg/kubelet 2021-09-10 12:20:09 +02:00
doc.go
errors.go
kubelet_getters_test.go
kubelet_getters.go remove ioutil in kubelet 2022-04-27 21:08:42 +08:00
kubelet_network_linux.go Create a KUBE-IPTABLES-HINT chain for other components 2022-03-27 14:12:36 -04:00
kubelet_network_others.go generated: Run hack/update-gofmt.sh 2021-08-24 15:47:49 -04:00
kubelet_network_test.go generated: Run hack/update-gofmt.sh 2021-08-24 15:47:49 -04:00
kubelet_network.go Move iptables consts to kubelet_network_linux.go. 2022-03-26 11:22:51 -04:00
kubelet_node_status_others.go generated: Run hack/update-gofmt.sh 2021-08-24 15:47:49 -04:00
kubelet_node_status_test.go pkg/kubelet: skip long test on short mode 2022-06-24 18:00:21 +02:00
kubelet_node_status_windows.go generated: Run hack/update-gofmt.sh 2021-08-24 15:47:49 -04:00
kubelet_node_status.go migrate --register-with-taints to KubeletConfiguration 2021-11-16 19:10:36 +08:00
kubelet_pods_linux_test.go Clean up logic for deprecated flag --container-runtime in kubelet 2022-02-10 13:26:59 +02:00
kubelet_pods_test.go Revert "Field status.hostIPs added for Pod (#101566)" 2022-03-31 12:39:45 +00:00
kubelet_pods_windows_test.go Clean up logic for deprecated flag --container-runtime in kubelet 2022-02-10 13:26:59 +02:00
kubelet_pods.go kubelet: only shutdown probes for pods that are terminated 2022-06-06 17:00:54 -05:00
kubelet_resources_test.go
kubelet_resources.go
kubelet_test.go pkg/kubelet: skip long test on short mode 2022-06-24 18:00:21 +02:00
kubelet_volumes_linux_test.go pkg/kubelet: skip long test on short mode 2022-06-24 18:00:21 +02:00
kubelet_volumes_test.go pkg/kubelet: skip long test on short mode 2022-06-24 18:00:21 +02:00
kubelet_volumes.go remove ioutil in kubelet 2022-04-27 21:08:42 +08:00
kubelet.go kubelet: add e2e test to verify probe readiness 2022-06-06 17:00:55 -05:00
OWNERS Check in OWNERS modified by update-yamlfmt.sh 2021-12-09 21:31:26 -05:00
pod_container_deletor_test.go
pod_container_deletor.go
pod_workers_test.go pkg/kubelet: skip long test on short mode 2022-06-24 18:00:21 +02:00
pod_workers.go kubelet: Delay writing a terminal phase until the pod is terminated 2022-03-16 13:15:00 -04:00
reason_cache_test.go
reason_cache.go
runonce_test.go kubelet: Remove the deprecated flag --experimental-check-node-capabilities-before-mount 2022-01-06 11:47:11 +08:00
runonce.go kubelet: Delay writing a terminal phase until the pod is terminated 2022-03-16 13:15:00 -04:00
runtime.go
time_cache_test.go
time_cache.go
volume_host.go use node informer to check volumes attachment status before backoff 2021-12-20 11:57:05 -05:00