Skip to content

Commit

Permalink
fix: remove testing.T from fixture signatures
Browse files Browse the repository at this point in the history
Signed-off-by: Leonardo Luz Almeida <[email protected]>
  • Loading branch information
leoluz committed Oct 25, 2021
1 parent f18f2a8 commit e40fcf5
Show file tree
Hide file tree
Showing 11 changed files with 183 additions and 183 deletions.
78 changes: 39 additions & 39 deletions rollout/analysis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func TestCreateBackgroundAnalysisRun(t *testing.T) {
f.expectUpdateReplicaSetAction(rs2)
index := f.expectPatchRolloutAction(r1)

f.run(t, getKey(r2, t))
f.run(getKey(r2, t))
createdAr := f.getCreatedAnalysisRun(createdIndex)
expectedArName := fmt.Sprintf("%s-%s-%s", r2.Name, rs2PodHash, "2")
assert.Equal(t, expectedArName, createdAr.Name)
Expand Down Expand Up @@ -211,7 +211,7 @@ func TestCreateBackgroundAnalysisRunWithTemplates(t *testing.T) {
f.expectUpdateReplicaSetAction(rs2)
index := f.expectPatchRolloutAction(r1)

f.run(t, getKey(r2, t))
f.run(getKey(r2, t))
createdAr := f.getCreatedAnalysisRun(createdIndex)
expectedArName := fmt.Sprintf("%s-%s-%s", r2.Name, rs2PodHash, "2")
assert.Equal(t, expectedArName, createdAr.Name)
Expand Down Expand Up @@ -271,7 +271,7 @@ func TestCreateBackgroundAnalysisRunWithClusterTemplates(t *testing.T) {
f.expectUpdateReplicaSetAction(rs2)
index := f.expectPatchRolloutAction(r1)

f.run(t, getKey(r2, t))
f.run(getKey(r2, t))
createdAr := f.getCreatedAnalysisRun(createdIndex)
expectedArName := fmt.Sprintf("%s-%s-%s", r2.Name, rs2PodHash, "2")
assert.Equal(t, expectedArName, createdAr.Name)
Expand Down Expand Up @@ -307,7 +307,7 @@ func TestInvalidSpecMissingClusterTemplatesBackgroundAnalysis(t *testing.T) {
f.objects = append(f.objects, r)

patchIndex := f.expectPatchRolloutAction(r)
f.run(t, getKey(r, t))
f.run(getKey(r, t))

expectedPatchWithoutSub := `{
"status": {
Expand Down Expand Up @@ -381,7 +381,7 @@ func TestCreateBackgroundAnalysisRunWithClusterTemplatesAndTemplate(t *testing.T
f.expectUpdateReplicaSetAction(rs2)
index := f.expectPatchRolloutAction(r1)

f.run(t, getKey(r2, t))
f.run(getKey(r2, t))
createdAr := f.getCreatedAnalysisRun(createdIndex)
expectedArName := fmt.Sprintf("%s-%s-%s", r2.Name, rs2PodHash, "2")
assert.Equal(t, expectedArName, createdAr.Name)
Expand Down Expand Up @@ -452,7 +452,7 @@ func TestCreateAnalysisRunWithCollision(t *testing.T) {
f.expectUpdateReplicaSetAction(rs2)
index := f.expectPatchRolloutAction(r1)

f.run(t, getKey(r2, t))
f.run(getKey(r2, t))
createdAr := f.getCreatedAnalysisRun(createdIndex)
assert.Equal(t, expectedAR.Name, createdAr.Name)

Expand Down Expand Up @@ -515,7 +515,7 @@ func TestCreateAnalysisRunWithCollisionAndSemanticEquality(t *testing.T) {
f.expectUpdateReplicaSetAction(rs2)
index := f.expectPatchRolloutAction(r1)

f.run(t, getKey(r2, t))
f.run(getKey(r2, t))

patch := f.getPatchedRollout(index)
expectedPatch := `{
Expand Down Expand Up @@ -571,7 +571,7 @@ func TestCreateAnalysisRunOnAnalysisStep(t *testing.T) {
createdIndex := f.expectCreateAnalysisRunAction(ar)
index := f.expectPatchRolloutAction(r1)

f.run(t, getKey(r2, t))
f.run(getKey(r2, t))
createdAr := f.getCreatedAnalysisRun(createdIndex)
expectedArName := fmt.Sprintf("%s-%s-%s-%s", r2.Name, rs2PodHash, "2", "0")
assert.Equal(t, expectedArName, createdAr.Name)
Expand Down Expand Up @@ -613,7 +613,7 @@ func TestFailCreateStepAnalysisRunIfInvalidTemplateRef(t *testing.T) {
f.objects = append(f.objects, r, at)

patchIndex := f.expectPatchRolloutAction(r)
f.run(t, getKey(r, t))
f.run(getKey(r, t))

expectedPatchWithoutSub := `{
"status": {
Expand Down Expand Up @@ -658,7 +658,7 @@ func TestFailCreateBackgroundAnalysisRunIfInvalidTemplateRef(t *testing.T) {
f.objects = append(f.objects, r, at)

patchIndex := f.expectPatchRolloutAction(r)
f.run(t, getKey(r, t))
f.run(getKey(r, t))

expectedPatchWithoutSub := `{
"status": {
Expand Down Expand Up @@ -705,7 +705,7 @@ func TestFailCreateBackgroundAnalysisRunIfMetricRepeated(t *testing.T) {
f.objects = append(f.objects, r, at)

patchIndex := f.expectPatchRolloutAction(r)
f.run(t, getKey(r, t))
f.run(getKey(r, t))

expectedPatchWithoutSub := `{
"status": {
Expand Down Expand Up @@ -770,7 +770,7 @@ func TestDoNothingWithAnalysisRunsWhileBackgroundAnalysisRunRunning(t *testing.T

f.expectUpdateReplicaSetAction(rs2)
patchIndex := f.expectPatchRolloutAction(r2)
f.run(t, getKey(r2, t))
f.run(getKey(r2, t))
patch := f.getPatchedRollout(patchIndex)
assert.Equal(t, calculatePatch(r2, OnlyObservedGenerationPatch), patch)
}
Expand Down Expand Up @@ -817,7 +817,7 @@ func TestDoNothingWhileStepBasedAnalysisRunRunning(t *testing.T) {
f.objects = append(f.objects, r2, at, ar)

patchIndex := f.expectPatchRolloutAction(r2)
f.run(t, getKey(r2, t))
f.run(getKey(r2, t))
patch := f.getPatchedRollout(patchIndex)
assert.Equal(t, calculatePatch(r2, OnlyObservedGenerationPatch), patch)
}
Expand Down Expand Up @@ -873,7 +873,7 @@ func TestCancelOlderAnalysisRuns(t *testing.T) {
cancelBackgroundAr := f.expectPatchAnalysisRunAction(oldBackgroundAr)
cancelOldAr := f.expectPatchAnalysisRunAction(olderAr)
patchIndex := f.expectPatchRolloutAction(r2)
f.run(t, getKey(r2, t))
f.run(getKey(r2, t))

assert.True(t, f.verifyPatchedAnalysisRun(cancelBackgroundAr, oldBackgroundAr))
assert.True(t, f.verifyPatchedAnalysisRun(cancelOldAr, olderAr))
Expand Down Expand Up @@ -934,7 +934,7 @@ func TestDeleteAnalysisRunsWithNoMatchingRS(t *testing.T) {

deletedIndex := f.expectDeleteAnalysisRunAction(arWithDiffPodHash)
patchIndex := f.expectPatchRolloutAction(r2)
f.run(t, getKey(r2, t))
f.run(getKey(r2, t))

deletedAr := f.getDeletedAnalysisRun(deletedIndex)
assert.Equal(t, deletedAr, arWithDiffPodHash.Name)
Expand Down Expand Up @@ -993,7 +993,7 @@ func TestDeleteAnalysisRunsAfterRSDelete(t *testing.T) {
f.expectDeleteReplicaSetAction(rs1)
deletedIndex := f.expectDeleteAnalysisRunAction(arToDelete)
f.expectPatchRolloutAction(r3)
f.run(t, getKey(r3, t))
f.run(getKey(r3, t))

deletedAr := f.getDeletedAnalysisRun(deletedIndex)
assert.Equal(t, deletedAr, arToDelete.Name)
Expand Down Expand Up @@ -1038,7 +1038,7 @@ func TestIncrementStepAfterSuccessfulAnalysisRun(t *testing.T) {
f.objects = append(f.objects, r2, at, ar)

patchIndex := f.expectPatchRolloutAction(r2)
f.run(t, getKey(r2, t))
f.run(getKey(r2, t))
patch := f.getPatchedRollout(patchIndex)
expectedPatch := `{
"status": {
Expand Down Expand Up @@ -1098,7 +1098,7 @@ func TestPausedOnInconclusiveBackgroundAnalysisRun(t *testing.T) {
f.objects = append(f.objects, r2, at, ar)

patchIndex := f.expectPatchRolloutAction(r2)
f.run(t, getKey(r2, t))
f.run(getKey(r2, t))
patch := f.getPatchedRollout(patchIndex)
now := metav1.Now().UTC().Format(time.RFC3339)
expectedPatch := `{
Expand Down Expand Up @@ -1162,7 +1162,7 @@ func TestPausedStepAfterInconclusiveAnalysisRun(t *testing.T) {
f.objects = append(f.objects, r2, at, ar)

patchIndex := f.expectPatchRolloutAction(r2)
f.run(t, getKey(r2, t))
f.run(getKey(r2, t))
patch := f.getPatchedRollout(patchIndex)
now := metav1.Now().UTC().Format(time.RFC3339)
expectedPatch := `{
Expand Down Expand Up @@ -1229,7 +1229,7 @@ func TestErrorConditionAfterErrorAnalysisRunStep(t *testing.T) {
f.objects = append(f.objects, r2, at, ar)

patchIndex := f.expectPatchRolloutAction(r2)
f.run(t, getKey(r2, t))
f.run(getKey(r2, t))
patch := f.getPatchedRollout(patchIndex)
expectedPatch := `{
"status": {
Expand Down Expand Up @@ -1306,7 +1306,7 @@ func TestErrorConditionAfterErrorAnalysisRunBackground(t *testing.T) {
f.objects = append(f.objects, r2, at, ar)

patchIndex := f.expectPatchRolloutAction(r2)
f.run(t, getKey(r2, t))
f.run(getKey(r2, t))
patch := f.getPatchedRollout(patchIndex)
expectedPatch := `{
"status": {
Expand Down Expand Up @@ -1371,7 +1371,7 @@ func TestCancelAnalysisRunsWhenAborted(t *testing.T) {
cancelCurrentAr := f.expectPatchAnalysisRunAction(ar)
cancelOldAr := f.expectPatchAnalysisRunAction(olderAr)
patchIndex := f.expectPatchRolloutAction(r2)
f.run(t, getKey(r2, t))
f.run(getKey(r2, t))

assert.True(t, f.verifyPatchedAnalysisRun(cancelOldAr, olderAr))
assert.True(t, f.verifyPatchedAnalysisRun(cancelCurrentAr, ar))
Expand Down Expand Up @@ -1430,7 +1430,7 @@ func TestCancelBackgroundAnalysisRunWhenRolloutIsCompleted(t *testing.T) {
f.objects = append(f.objects, r2, at, ar)

patchIndex := f.expectPatchRolloutAction(r2)
f.run(t, getKey(r2, t))
f.run(getKey(r2, t))

patch := f.getPatchedRollout(patchIndex)
assert.Contains(t, patch, `"currentBackgroundAnalysisRunStatus":null`)
Expand Down Expand Up @@ -1483,7 +1483,7 @@ func TestDoNotCreateBackgroundAnalysisRunAfterInconclusiveRun(t *testing.T) {
f.objects = append(f.objects, r2, at)

patchIndex := f.expectPatchRolloutAction(r2)
f.run(t, getKey(r2, t))
f.run(getKey(r2, t))

patch := f.getPatchedRollout(patchIndex)
assert.Equal(t, calculatePatch(r2, OnlyObservedGenerationPatch), patch)
Expand Down Expand Up @@ -1519,7 +1519,7 @@ func TestDoNotCreateBackgroundAnalysisRunOnNewCanaryRollout(t *testing.T) {
f.expectUpdateRolloutStatusAction(r1) // update conditions
f.expectUpdateReplicaSetAction(rs1) // scale replica set
f.expectPatchRolloutAction(r1)
f.run(t, getKey(r1, t))
f.run(getKey(r1, t))
}

// Same as TestDoNotCreateBackgroundAnalysisRunOnNewCanaryRollout but when Status.StableRS is ""
Expand Down Expand Up @@ -1554,7 +1554,7 @@ func TestDoNotCreateBackgroundAnalysisRunOnNewCanaryRolloutStableRSEmpty(t *test
f.expectUpdateRolloutStatusAction(r1) // update conditions
f.expectUpdateReplicaSetAction(rs1) // scale replica set
f.expectPatchRolloutAction(r1)
f.run(t, getKey(r1, t))
f.run(getKey(r1, t))
}

func TestCreatePrePromotionAnalysisRun(t *testing.T) {
Expand Down Expand Up @@ -1597,7 +1597,7 @@ func TestCreatePrePromotionAnalysisRun(t *testing.T) {

f.expectCreateAnalysisRunAction(ar)
patchIndex := f.expectPatchRolloutActionWithPatch(r2, OnlyObservedGenerationPatch)
f.run(t, getKey(r2, t))
f.run(getKey(r2, t))
patch := f.getPatchedRollout(patchIndex)
expectedPatch := fmt.Sprintf(`{
"status": {
Expand Down Expand Up @@ -1649,7 +1649,7 @@ func TestDoNotCreatePrePromotionAnalysisAfterPromotionRollout(t *testing.T) {

patchIndex := f.expectPatchRolloutAction(r1)

f.run(t, getKey(r2, t))
f.run(getKey(r2, t))

newConditions := generateConditionsPatchWithComplete(true, conditions.NewRSAvailableReason, rs2, true, "", true)
expectedPatch := fmt.Sprintf(`{
Expand Down Expand Up @@ -1690,7 +1690,7 @@ func TestDoNotCreatePrePromotionAnalysisRunOnNewRollout(t *testing.T) {
f.expectUpdateRolloutStatusAction(r)
f.expectUpdateReplicaSetAction(rs) // scale RS
f.expectPatchRolloutAction(r)
f.run(t, getKey(r, t))
f.run(getKey(r, t))
}

//TestDoNotCreatePrePromotionAnalysisRunOnNotReadyReplicaSet ensures that a pre-promotion analysis is not created until
Expand Down Expand Up @@ -1730,7 +1730,7 @@ func TestDoNotCreatePrePromotionAnalysisRunOnNotReadyReplicaSet(t *testing.T) {
f.objects = append(f.objects, at)

patchRolloutIndex := f.expectPatchRolloutAction(r2)
f.run(t, getKey(r2, t))
f.run(getKey(r2, t))

patch := f.getPatchedRollout(patchRolloutIndex)
assert.Equal(t, calculatePatch(r2, OnlyObservedGenerationPatch), patch)
Expand Down Expand Up @@ -1779,7 +1779,7 @@ func TestRolloutPrePromotionAnalysisBecomesInconclusive(t *testing.T) {
f.serviceLister = append(f.serviceLister, activeSvc)

patchIndex := f.expectPatchRolloutActionWithPatch(r2, OnlyObservedGenerationPatch)
f.run(t, getKey(r2, t))
f.run(getKey(r2, t))
patch := f.getPatchedRollout(patchIndex)
now := metav1.Now().UTC().Format(time.RFC3339)
expectedPatch := fmt.Sprintf(`{
Expand Down Expand Up @@ -1848,7 +1848,7 @@ func TestRolloutPrePromotionAnalysisSwitchServiceAfterSuccess(t *testing.T) {

f.expectPatchServiceAction(activeSvc, rs2PodHash)
patchIndex := f.expectPatchRolloutActionWithPatch(r2, OnlyObservedGenerationPatch)
f.run(t, getKey(r2, t))
f.run(getKey(r2, t))
patch := f.getPatchedRolloutWithoutConditions(patchIndex)
expectedPatch := fmt.Sprintf(`{
"status": {
Expand Down Expand Up @@ -1915,7 +1915,7 @@ func TestRolloutPrePromotionAnalysisHonorAutoPromotionSeconds(t *testing.T) {

f.expectPatchServiceAction(activeSvc, rs2PodHash)
patchIndex := f.expectPatchRolloutActionWithPatch(r2, OnlyObservedGenerationPatch)
f.run(t, getKey(r2, t))
f.run(getKey(r2, t))
patch := f.getPatchedRolloutWithoutConditions(patchIndex)
expectedPatch := fmt.Sprintf(`{
"status": {
Expand Down Expand Up @@ -1984,7 +1984,7 @@ func TestRolloutPrePromotionAnalysisDoNothingOnInconclusiveAnalysis(t *testing.T
f.serviceLister = append(f.serviceLister, activeSvc)

f.expectPatchRolloutActionWithPatch(r2, OnlyObservedGenerationPatch)
f.run(t, getKey(r2, t))
f.run(getKey(r2, t))
}

func TestAbortRolloutOnErrorPrePromotionAnalysis(t *testing.T) {
Expand Down Expand Up @@ -2031,7 +2031,7 @@ func TestAbortRolloutOnErrorPrePromotionAnalysis(t *testing.T) {
f.serviceLister = append(f.serviceLister, activeSvc)

patchIndex := f.expectPatchRolloutActionWithPatch(r2, OnlyObservedGenerationPatch)
f.run(t, getKey(r2, t))
f.run(getKey(r2, t))
patch := f.getPatchedRollout(patchIndex)
expectedPatch := `{
"status": {
Expand Down Expand Up @@ -2087,7 +2087,7 @@ func TestCreatePostPromotionAnalysisRun(t *testing.T) {

f.expectCreateAnalysisRunAction(ar)
patchIndex := f.expectPatchRolloutActionWithPatch(r2, OnlyObservedGenerationPatch)
f.run(t, getKey(r2, t))
f.run(getKey(r2, t))
patch := f.getPatchedRollout(patchIndex)
expectedPatch := fmt.Sprintf(`{
"status": {
Expand Down Expand Up @@ -2140,7 +2140,7 @@ func TestRolloutPostPromotionAnalysisSuccess(t *testing.T) {
f.serviceLister = append(f.serviceLister, activeSvc)

patchIndex := f.expectPatchRolloutAction(r2)
f.run(t, getKey(r2, t))
f.run(getKey(r2, t))
patch := f.getPatchedRollout(patchIndex)
expectedPatch := fmt.Sprintf(`{
"status": {
Expand Down Expand Up @@ -2203,7 +2203,7 @@ func TestPostPromotionAnalysisRunHandleInconclusive(t *testing.T) {
f.serviceLister = append(f.serviceLister, activeSvc)

patchIndex := f.expectPatchRolloutActionWithPatch(r2, OnlyObservedGenerationPatch)
f.run(t, getKey(r2, t))
f.run(getKey(r2, t))
patch := f.getPatchedRollout(patchIndex)
expectedPatch := fmt.Sprint(`{
"status": {
Expand Down Expand Up @@ -2260,7 +2260,7 @@ func TestAbortRolloutOnErrorPostPromotionAnalysis(t *testing.T) {
f.serviceLister = append(f.serviceLister, activeSvc)

patchIndex := f.expectPatchRolloutActionWithPatch(r2, OnlyObservedGenerationPatch)
f.run(t, getKey(r2, t))
f.run(getKey(r2, t))
patch := f.getPatchedRollout(patchIndex)
expectedPatch := `{
"status": {
Expand Down
Loading

0 comments on commit e40fcf5

Please sign in to comment.