Skip to content

Commit

Permalink
test(replicaset): add test case for IsActive function
Browse files Browse the repository at this point in the history
Signed-off-by: Andy Chen <[email protected]>
  • Loading branch information
amazingandyyy authored and yohanb committed Aug 12, 2023
1 parent 4994548 commit d42be54
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions utils/replicaset/replicaset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,18 @@ func TestFindOldReplicaSets(t *testing.T) {
}
}

func TestIsActive(t *testing.T) {
rs1 := generateRS(generateRollout("foo"))
*(rs1.Spec.Replicas) = 1

rs2 := generateRS(generateRollout("foo"))
*(rs2.Spec.Replicas) = 0

assert.False(t, IsActive(nil))
assert.True(t, IsActive(&rs1))
assert.False(t, IsActive(&rs2))
}

func TestGetReplicaCountForReplicaSets(t *testing.T) {
rs1 := generateRS(generateRollout("foo"))
*(rs1.Spec.Replicas) = 1
Expand Down

0 comments on commit d42be54

Please sign in to comment.