Commit Graph

12 Commits

Author SHA1 Message Date
inosato
3b95d3b076 Remove ioutil in kubelet and its tests
Signed-off-by: inosato <si17_21@yahoo.co.jp>
2022-07-30 12:35:26 +09:00
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
yxxhero
4fac7486d4 remove ioutil in kubelet
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-27 21:08:42 +08:00
Stephen Augustus
481cf6fbe7
generated: Run hack/update-gofmt.sh
Signed-off-by: Stephen Augustus <foo@auggie.dev>
2021-08-24 15:47:49 -04:00
Jonathan Dobson
484eb01822 kubelet: do not call RemoveAll on volumes directory for orphaned pods 2021-06-08 13:57:35 -06:00
Lorenz Brun
ea27d9225c Add tests for populated volumes 2021-02-01 20:10:34 +01:00
Lorenz Brun
670452cfc5 Fix tests to test for new behavior 2020-12-21 20:20:54 +01:00
Michelle Au
25edb8bc69
Revert "check volume directories instead of mounts for cleanupOrphanedPodDirs" 2020-11-20 09:06:09 -08:00
Mucahit Kurt
6748570724 Change the logic of pod volumes existence check during kubelet cleanupOrphanedPodDirs, cleanupOrphanedPodCgroups and PodResourcesAreReclaimed
check in-memory cache whether volumes are still mounted and check disk directory for the volume paths instead of mounted volumes check

Signed-off-by: Mucahit Kurt <mucahitkurt@gmail.com>
2020-11-10 17:33:01 +03:00
Srini Brahmaroutu
fbe5daed73 Change code to use staging/k8s.io/mount-utils 2020-09-16 21:51:24 -07:00
Jing Xu
7012994a61 Fix issue in kubelet getMountedVolumePathListFromDisk
This PR fixes issue #74650. It adds the extra check for /mount dir under
pod volume dir. It also adds the unit test for this function
2020-06-22 10:00:43 -07:00
Michelle Au
8724b46623 Check for volume-subpaths directory in orpahaned pod cleanup 2018-12-26 10:49:28 -08:00