Skip to content

Commit c450973

Browse files
committed
chore(e2e/recommender): Reuse test namespace in VPA observer controller
This commit instruments the `observer`, used within the `recommender` e2e tests, reuse the test framework namespace. The main reason behind this change is to allow running the test suite against an existing cluster that already has `VPA` resources in other namespaces. Currently, the test is considering all `namespaces` when it builds it's `observer`'s controller, which makes the test fail when trying to validate the recommendations for components outside of the test scope. This behavior was discovered while running the e2e tests against a cluster with VPA setup that uses Prometheus as history storage provider.
1 parent afc3eaf commit c450973

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

vertical-pod-autoscaler/e2e/v1/recommender.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ func (o *observer) OnUpdate(oldObj, newObj interface{}) {
102102
go func() { o.channel <- result }()
103103
}
104104

105-
func getVpaObserver(vpaClientSet vpa_clientset.Interface) *observer {
106-
vpaListWatch := cache.NewListWatchFromClient(vpaClientSet.AutoscalingV1().RESTClient(), "verticalpodautoscalers", apiv1.NamespaceAll, fields.Everything())
105+
func getVpaObserver(vpaClientSet vpa_clientset.Interface, namespace string) *observer {
106+
vpaListWatch := cache.NewListWatchFromClient(vpaClientSet.AutoscalingV1().RESTClient(), "verticalpodautoscalers", namespace, fields.Everything())
107107
vpaObserver := observer{channel: make(chan recommendationChange)}
108108
_, controller := cache.NewIndexerInformer(vpaListWatch,
109109
&vpa_types.VerticalPodAutoscaler{},
@@ -232,7 +232,7 @@ var _ = RecommenderE2eDescribe("VPA CRD object", func() {
232232

233233
ginkgo.It("doesn't drop lower/upper after recommender's restart", func() {
234234

235-
o := getVpaObserver(vpaClientSet)
235+
o := getVpaObserver(vpaClientSet, f.Namespace.Name)
236236

237237
ginkgo.By("Waiting for recommendation to be filled")
238238
_, err := WaitForRecommendationPresent(vpaClientSet, vpaCRD)

0 commit comments

Comments
 (0)