FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: Prevent parser startup before scanner job is visible by mvanhorn · Pull Request #3795 · secureCodeBox/secureCodeBox · GitHub

Repository navigation

Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .go  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
    • job.go
    • job_test.go
4 changes: 4 additions & 0 deletions operator/controllers/execution/scans/job.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ const (

// checkIfAllJobsCompleted returns `completed` if all jobs of the given jobList are in a successful state, incompleted otherwise.
func checkIfAllJobsCompleted(jobs *batch.JobList) jobCompletionType {
if len(jobs.Items) == 0 {
return incomplete
}

hasCompleted := true

for _, job := range jobs.Items {
Expand Down
11 changes: 11 additions & 0 deletions operator/controllers/execution/scans/job_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ func TestScanControllers(t *testing.T) {

var _ = Describe("ScanControllers", func() {
Context("checkIfAllJobsCompleted", func() {
It("should return incomplete if no jobs were found", func() {
jobs := &batch.JobList{}

Expect(checkIfAllJobsCompleted(jobs)).To(Equal(incomplete))
})

It("should return completed if all jobs succeeded", func() {
jobs := &batch.JobList{
Items: []batch.Job{
Expand Down Expand Up @@ -61,6 +67,11 @@ var _ = Describe("ScanControllers", func() {
It("should return failed if any job exceeded backoff limit", func() {
jobs := &batch.JobList{
Items: []batch.Job{
{
Status: batch.JobStatus{
Succeeded: 1,
},
},
{
Status: batch.JobStatus{
Failed: 1,
Expand Down

Back | FazBrowse Home | New Git URL