-
Notifications
You must be signed in to change notification settings - Fork 0
/
jobinfo_extensions_test.go
62 lines (46 loc) · 1.35 KB
/
jobinfo_extensions_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package gcpbatchtracker_test
import (
"os"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/dgruber/gcpbatchtracker"
"github.com/dgruber/drmaa2interface"
)
var _ = Describe("JobinfoExtensions", func() {
Context("Standard JobInfo extensions", func() {
It("should return the job template and UID from the job info extension", func() {
if !credentialsCheck() {
Skip("Credentials not set")
}
t, err := NewGCPBatchTracker(
"testsession",
os.Getenv("GCPBATCHTRACKER_PROJECT"),
os.Getenv("GCPBATCHTRACKER_LOCATION"))
Expect(err).ToNot(HaveOccurred())
jobTemplate := drmaa2interface.JobTemplate{
RemoteCommand: "/bin/sleep",
CandidateMachines: []string{
"n2-standard-2",
},
Args: []string{"0"},
MinSlots: 1,
MaxSlots: 1,
JobCategory: "busybox",
JobEnvironment: map[string]string{
"SOMEENV": "with some value",
},
}
jobID, err := t.AddJob(jobTemplate)
Expect(err).ToNot(HaveOccurred())
Expect(jobID).ToNot(Equal(""))
jobInfo, err := t.JobInfo(jobID)
Expect(err).ToNot(HaveOccurred())
jt, exists := GetJobTemplateExtensionFromJobInfo(jobInfo)
Expect(exists).To(BeTrue())
Expect(jt).To(Equal(jobTemplate))
uid, exists := GetUIDExtensionFromJobInfo(jobInfo)
Expect(exists).To(BeTrue())
Expect(uid).ToNot(Equal(""))
})
})
})