Skip to content

fix: when case isSuspended, should assign Message: message, not failMsg #750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LinPr
Copy link

@LinPr LinPr commented Jul 30, 2025

	failed := false
	var failMsg string
	complete := false
	var message string
	isSuspended := false
	for _, condition := range job.Status.Conditions {
		switch condition.Type {
		case batchv1.JobFailed:
			failed = true
			complete = true
			failMsg = condition.Message
		case batchv1.JobComplete:
			complete = true
			message = condition.Message
		case batchv1.JobSuspended:
			complete = true
			message = condition.Message
			if condition.Status == corev1.ConditionTrue {
				isSuspended = true
			}
		}
	}
	switch {
	case !complete:
		return &HealthStatus{
			Status:  HealthStatusProgressing,
			Message: message,
		}, nil
	case failed:
		return &HealthStatus{
			Status:  HealthStatusDegraded,
			Message: failMsg,
		}, nil
	case isSuspended:
		return &HealthStatus{
			Status:  HealthStatusSuspended,
			Message: message,
		}, nil
	default:
		return &HealthStatus{
			Status:  HealthStatusHealthy,
			Message: message,
		}, nil
	}

we can see when isSuspended = true, the message = condition.Message was executed, so the under case should be

case isSuspended:
    return &HealthStatus{
	    Status:  HealthStatusSuspended,
	    Message: message,
    }, nil

@LinPr LinPr requested a review from a team as a code owner July 30, 2025 11:57
Copy link

codecov bot commented Jul 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47.22%. Comparing base (8849c3f) to head (5be3057).
⚠️ Report is 55 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #750      +/-   ##
==========================================
- Coverage   54.26%   47.22%   -7.05%     
==========================================
  Files          64       64              
  Lines        6164     6529     +365     
==========================================
- Hits         3345     3083     -262     
- Misses       2549     3191     +642     
+ Partials      270      255      -15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant