mirror of
https://github.com/intel/intel-device-plugins-for-kubernetes.git
synced 2025-06-03 03:59:37 +00:00
envtest: disable controller metrics in tests
to mitigate spurious errors with: E0515 15:28:06.626887 1995892 listener.go:48] "controller-runtime/metrics: metrics server failed to listen. You may want to disable the metrics server or use another port if it is due to conflicts" err="error lis tening on :8080: listen tcp :8080: bind: address already in use" disable metrics completely. Moreover, check for error value from NewManager() before proceeding with the tests to avoid crashes. This makes envtest more robust but the up()/down() logic needs careful review to ensure there are no race conditions. Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
This commit is contained in:
parent
d90aeda75d
commit
4d238959a8
@ -56,7 +56,6 @@ import (
|
|||||||
var (
|
var (
|
||||||
cfg *rest.Config
|
cfg *rest.Config
|
||||||
k8sClient client.Client
|
k8sClient client.Client
|
||||||
k8sManager ctrl.Manager
|
|
||||||
testEnv *envtest.Environment
|
testEnv *envtest.Environment
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
cancel context.CancelFunc
|
cancel context.CancelFunc
|
||||||
@ -108,7 +107,8 @@ var _ = AfterEach(func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
func up() {
|
func up() {
|
||||||
k8sManager, _ = ctrl.NewManager(cfg, ctrl.Options{Scheme: scheme.Scheme})
|
k8sManager, managerErr := ctrl.NewManager(cfg, ctrl.Options{Scheme: scheme.Scheme, MetricsBindAddress: "0"})
|
||||||
|
Expect(managerErr).To(BeNil())
|
||||||
|
|
||||||
withWebhook := true
|
withWebhook := true
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user