Skip to content

Commit

Permalink
Fix e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
Hui Kang committed Apr 21, 2021
1 parent 609d52a commit b161324
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 28 deletions.
32 changes: 9 additions & 23 deletions pkg/kubectl-argo-rollouts/info/info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"time"

"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"

Expand Down Expand Up @@ -176,28 +175,15 @@ func TestExperimentInfo(t *testing.T) {
}

func TestRolloutStatusDegraded(t *testing.T) {
{
ro := newCanaryRollout()
ro.Status.Conditions = append(ro.Status.Conditions, v1alpha1.RolloutCondition{
Type: v1alpha1.RolloutProgressing,
Reason: "ProgressDeadlineExceeded",
Message: "timed out",
})
status, message := RolloutStatusString(ro)
assert.Equal(t, "Degraded", status)
assert.Equal(t, "ProgressDeadlineExceeded: timed out", message)
}
{
ro := newCanaryRollout()
ro.Status.Conditions = append(ro.Status.Conditions, v1alpha1.RolloutCondition{
Type: v1alpha1.RolloutProgressing,
Status: corev1.ConditionFalse,
Reason: "RolloutCompleted",
})
status, message := RolloutStatusString(ro)
assert.Equal(t, "Degraded", status)
assert.Equal(t, "RolloutCompleted: rollout coompleted, but analysis failed", message)
}
ro := newCanaryRollout()
ro.Status.Conditions = append(ro.Status.Conditions, v1alpha1.RolloutCondition{
Type: v1alpha1.RolloutProgressing,
Reason: "ProgressDeadlineExceeded",
Message: "timed out",
})
status, message := RolloutStatusString(ro)
assert.Equal(t, "Degraded", status)
assert.Equal(t, "ProgressDeadlineExceeded: timed out", message)
}

func TestRolloutStatusInvalidSpec(t *testing.T) {
Expand Down
4 changes: 0 additions & 4 deletions pkg/kubectl-argo-rollouts/info/rollout_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,6 @@ func RolloutStatusString(ro *v1alpha1.Rollout) (string, string) {
case conditions.RolloutAbortedReason, conditions.TimedOutReason:
return "Degraded", fmt.Sprintf("%s: %s", cond.Reason, cond.Message)
}

if cond.Status == corev1.ConditionFalse && cond.Reason == conditions.RolloutCompletedReason {
return "Degraded", fmt.Sprintf("%s: %s", cond.Reason, "rollout coompleted, but analysis failed")
}
}
if ro.Spec.Paused {
return "Paused", "manually paused"
Expand Down
2 changes: 1 addition & 1 deletion rollout/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ func (c *rolloutContext) calculateRolloutConditions(newStatus v1alpha1.RolloutSt
// In such a case, we should simply not estimate any progress for this rollout.
currentCond := conditions.GetRolloutCondition(c.rollout.Status, v1alpha1.RolloutProgressing)

isCompleteRollout := newStatus.Replicas == newStatus.AvailableReplicas && currentCond != nil && currentCond.Reason == conditions.NewRSAvailableReason
isCompleteRollout := newStatus.Replicas == newStatus.AvailableReplicas && currentCond != nil && currentCond.Reason == conditions.NewRSAvailableReason && currentCond.Type != v1alpha1.RolloutProgressing
// Check for progress only if the latest rollout hasn't completed yet.
if !isCompleteRollout {
switch {
Expand Down

0 comments on commit b161324

Please sign in to comment.