Skip to content

Commit

Permalink
Comment to explain why test is done on STS ownerRef
Browse files Browse the repository at this point in the history
  • Loading branch information
dbenque committed Jan 31, 2024
1 parent a5cae3b commit 4f9f840
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ func TestGetMatchingVpa(t *testing.T) {
vpaLister.On("VerticalPodAutoscalers", "default").Return(vpaNamespaceLister)

mockSelectorFetcher.EXPECT().Fetch(gomock.Any()).AnyTimes().Return(parseLabelSelector(tc.labelSelector), nil)
// This test is using a FakeControllerFetcher which returns the same ownerRef that is passed to it.
// In other words, it cannot go through the hierarchy of controllers like "ReplicaSet => Deployment"
// For this reason we are using "StatefulSet" as the ownerRef kind in the test, since it is a direct link.
// The hierarchy part is being test in the "TestControllerFetcher" test.
matcher := NewMatcher(vpaLister, mockSelectorFetcher, controllerfetcher.FakeControllerFetcher{})

vpa := matcher.GetMatchingVPA(tc.pod)
Expand Down

0 comments on commit 4f9f840

Please sign in to comment.