Address further code review comment regarding JobExists method

This commit is contained in:
Lawrence Wong 2023-01-26 11:39:28 -08:00
parent b26290d922
commit 7b73930ce5
2 changed files with 19 additions and 9 deletions

View file

@ -1467,10 +1467,15 @@ func TestRealisClient_JobExists(t *testing.T) {
Tier("preemptible").
Priority(0)
err := r.CreateJob(job)
// Check if job exists before creating
exists, err := r.JobExists(job.JobKey())
assert.NoError(t, err)
assert.False(t, exists)
err = r.CreateJob(job)
assert.NoError(t, err)
exists, err := r.JobExists(job.JobKey())
exists, err = r.JobExists(job.JobKey())
assert.NoError(t, err)
assert.True(t, exists)
@ -1486,6 +1491,11 @@ func TestRealisClient_JobExists(t *testing.T) {
Disk(10).
InstanceCount(1)
// Check if job exists before creating
exists, err = r.JobExists(badJob.JobKey())
assert.NoError(t, err)
assert.False(t, exists)
err = r.CreateJob(badJob)
assert.Error(t, err)