Skip to content

Commit

Permalink
Formatting files
Browse files Browse the repository at this point in the history
Signed-off-by: shivam <[email protected]>
  • Loading branch information
Bharadwajshivam28 committed Mar 8, 2024
1 parent 11d44d4 commit cb1ca31
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
5 changes: 2 additions & 3 deletions internal/executor/job/submit.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ type FailedSubmissionDetails struct {

func (submitService *SubmitService) SubmitJobs(jobsToSubmit []*SubmitJob) []*FailedSubmissionDetails {
return submitService.submitJobs(jobsToSubmit)
}

}
func (submitService *SubmitService) submitJobs(jobsToSubmit []*SubmitJob) []*FailedSubmissionDetails {
wg := &sync.WaitGroup{}
submitJobsChannel := make(chan *SubmitJob)
Expand Down Expand Up @@ -110,7 +109,7 @@ func (submitService *SubmitService) submitWorker(wg *sync.WaitGroup, jobsToSubmi
// submitPod submits a pod to k8s together with any services and ingresses bundled with the Armada job.
// This function may fail partly, i.e., it may successfully create a subset of the requested objects before failing.
// In case of failure, any already created objects are not cleaned up.
func (submitService *SubmitService) submitPod(job *SubmitJob) (*v1.Pod, error) { //iska krna h
func (submitService *SubmitService) submitPod(job *SubmitJob) (*v1.Pod, error) {
pod := job.Pod
// Ensure the K8SService and K8SIngress fields are populated
submitService.applyExecutorSpecificIngressDetails(job)
Expand Down
12 changes: 5 additions & 7 deletions internal/executor/job/submit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,13 @@ func newArmadaErrCreateResource() error {
return &armadaerrors.ErrCreateResource{}
}

func TestSubmitJobs(t *testing.T){
submitService := &SubmitService{
}
func TestSubmitJobs(t *testing.T) {
submitService := &SubmitService{}
job1 := &SubmitJob{}
job2 := &SubmitJob{}

jobsToSubmit := []*SubmitJob{job1, job2}

submitJobsChannel := make(chan *SubmitJob)
failedJobsChannel := make(chan *FailedSubmissionDetails, len(jobsToSubmit))

Expand All @@ -111,13 +110,12 @@ func TestSubmitJobs(t *testing.T){

submitService.submitWorker = func(wg *sync.WaitGroup, submitJobs chan *SubmitJob, failedJobs chan *FailedSubmissionDetails) {
for job := range submitJobs {
failedJobs <- &FailedSubmissionDetails{
}
failedJobs <- &FailedSubmissionDetails{}
}
wg.Done()
}
failedJobs := submitService.submitJobs(jobsToSubmit)

assert.NotNil(t, failedJobs, "Function did not returned slice of FailedSubmissionDetails")
assert.Len(t, failedJobs, len(jobsToSubmit), "Unexpected length of failedJobs")
}
}

0 comments on commit cb1ca31

Please sign in to comment.