Skip to content

Commit

Permalink
Merge pull request kubernetes#4250 from PhdLoLi/master
Browse files Browse the repository at this point in the history
Fill in the LastUpdateTime Field of VpaCheckpoint Status with Correct Time.
  • Loading branch information
k8s-ci-robot authored Aug 16, 2021
2 parents cac6d4b + 80cc848 commit 62e79c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ func (a *AggregateContainerState) SaveToCheckpoint() (*vpa_types.VerticalPodAuto
return nil, err
}
return &vpa_types.VerticalPodAutoscalerCheckpointStatus{
LastUpdateTime: metav1.NewTime(time.Now()),
FirstSampleStart: metav1.NewTime(a.FirstSampleStart),
LastSampleStart: metav1.NewTime(a.LastSampleStart),
TotalSamplesCount: a.TotalSamplesCount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ func TestAggregateContainerStateSaveToCheckpoint(t *testing.T) {

assert.NoError(t, err)

assert.True(t, time.Now().Sub(checkpoint.LastUpdateTime.Time) < 10*time.Second)
assert.Equal(t, t1, checkpoint.FirstSampleStart.Time)
assert.Equal(t, t2, checkpoint.LastSampleStart.Time)
assert.Equal(t, 10, checkpoint.TotalSamplesCount)
Expand Down Expand Up @@ -168,6 +169,7 @@ func TestAggregateContainerStateLoadFromCheckpoint(t *testing.T) {

checkpoint := vpa_types.VerticalPodAutoscalerCheckpointStatus{
Version: SupportedCheckpointVersion,
LastUpdateTime: metav1.NewTime(time.Now()),
FirstSampleStart: metav1.NewTime(t1),
LastSampleStart: metav1.NewTime(t2),
TotalSamplesCount: 20,
Expand Down

0 comments on commit 62e79c3

Please sign in to comment.