Skip to content

Commit

Permalink
Unit test 2
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Qian <[email protected]>
  • Loading branch information
kevinqian-db committed Jan 24, 2024
1 parent a7acb51 commit 6612838
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions analysis/analysis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2375,3 +2375,29 @@ func TestMaybeGarbageCollectAnalysisRunNoGCIfWithDeletionTimestamp(t *testing.T)
assert.NoError(t, err)
assert.Empty(t, f.client.Fake.Actions())
}

func TestMaybeGarbageCollectAnalysisRunNoGCIfNoCompletedAt(t *testing.T) {
f := newFixture(t)
defer f.Close()
c, _, _ := f.newController(noResyncPeriodFunc)

origRun := &v1alpha1.AnalysisRun{
ObjectMeta: metav1.ObjectMeta{
Name: "run" + string(uuid.NewUUID()),
Namespace: metav1.NamespaceDefault,
},
Spec: v1alpha1.AnalysisRunSpec{
TtlStrategy: &v1alpha1.TtlStrategy{
SecondsAfterCompletion: pointer.Int32Ptr(1),
},
},
Status: v1alpha1.AnalysisRunStatus{
Phase: v1alpha1.AnalysisPhaseSuccessful,
},
}
logger := logutil.WithAnalysisRun(origRun)
err := c.maybeGarbageCollectAnalysisRun(origRun, logger)
// No error, no deletion issued.
assert.NoError(t, err)
assert.Empty(t, f.client.Fake.Actions())
}

0 comments on commit 6612838

Please sign in to comment.