Skip to content

Commit

Permalink
Merge pull request volcano-sh#15 from k82cn/fixed_e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
Klaus Ma authored Feb 10, 2019
2 parents 6795ef2 + 4bf4183 commit 5320f97
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
10 changes: 6 additions & 4 deletions pkg/controllers/job/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,12 @@ func (jc *jobCache) Delete(obj *v1alpha1.Job) error {
defer jc.Unlock()

key := JobKey(obj)
if _, found := jc.jobs[key]; !found {
if jobInfo, found := jc.jobs[key]; !found {
return fmt.Errorf("failed to find job <%v>", key)
} else {
jc.deleteJob(jobInfo)
}

delete(jc.jobs, key)

return nil
}

Expand Down Expand Up @@ -279,6 +279,8 @@ func (jc *jobCache) DeletePod(pod *v1.Pod) error {
delete(pods, pod.Name)
}

jc.deleteJob(job)

return nil
}

Expand Down Expand Up @@ -326,7 +328,7 @@ func (jc *jobCache) deleteJob(job *apis.JobInfo) {
glog.V(3).Infof("Try to delete Job <%v/%v>",
job.Job.Namespace, job.Job.Name)

time.AfterFunc(5*time.Second, func() {
time.AfterFunc(1*time.Second, func() {
jc.deletedJobs.AddIfNotPresent(job)
})
}
10 changes: 9 additions & 1 deletion test/e2e/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ func deleteQueues(cxt *context) {
}

type taskSpec struct {
name string
min, rep int32
img string
hostport int32
Expand Down Expand Up @@ -288,8 +289,15 @@ func createJob(context *context, jobSpec *jobSpec) *vkv1.Job {
}

var min int32
for _, task := range jobSpec.tasks {
for i, task := range jobSpec.tasks {
name := task.name

if len(name) == 0 {
name = fmt.Sprintf("%s-task-%d", jobSpec.name, i)
}

ts := vkv1.TaskSpec{
Name: name,
Replicas: task.rep,
Template: v1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Expand Down

0 comments on commit 5320f97

Please sign in to comment.