Skip to content

Commit

Permalink
add unit test for issue 6808
Browse files Browse the repository at this point in the history
  • Loading branch information
itonyli committed May 14, 2024
1 parent 825ac30 commit 495f895
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ func TestLoopInit(t *testing.T) {
Get()
vpaToPodMap := map[*v1.VerticalPodAutoscaler][]*corev1.Pod{testVPA: {pod, pod2}}

t.Run("it should not require UpdateMode and EvictionRequirements.", func(t *testing.T) {
sdpea := NewScalingDirectionPodEvictionAdmission()
sdpea.LoopInit(nil, vpaToPodMap)

newTestVPA := test.VerticalPodAutoscaler().
WithName("test-vpa").
WithContainer(container1Name).
Get()

newVpaToPodMap := map[*v1.VerticalPodAutoscaler][]*corev1.Pod{newTestVPA: {pod, pod2}}

sdpea.LoopInit(nil, newVpaToPodMap)
assert.Len(t, sdpea.(*scalingDirectionPodEvictionAdmission).EvictionRequirements, 0)
})

t.Run("it should store EvictionRequirements from VPA in a map per Pod", func(t *testing.T) {
sdpea := NewScalingDirectionPodEvictionAdmission()
sdpea.LoopInit(nil, vpaToPodMap)
Expand Down

0 comments on commit 495f895

Please sign in to comment.