@@ -25,34 +25,35 @@ var _ = Describe("File", func() {
2525
2626 It ("returns a channel that emits JobDetail objects for 10 jobs" , func () {
2727
28+ jobDetailsChan , err := qacct .WatchFile (context .Background (),
29+ qacct .GetDefaultQacctFile (), 0 )
30+ Expect (err ).NotTo (HaveOccurred ())
31+ Expect (jobDetailsChan ).NotTo (BeNil ())
32+
2833 qs , err := qsub .NewCommandLineQSub (qsub.CommandLineQSubConfig {})
2934 Expect (err ).NotTo (HaveOccurred ())
3035
3136 jobIDs := make ([]int , 10 )
3237 for i := 0 ; i < 10 ; i ++ {
33- jobID , _ , err := qs .Submit (context .Background (), qsub.JobOptions {
34- Command : "echo" ,
35- CommandArgs : []string {fmt .Sprintf ("job %d" , i + 1 )},
36- Binary : qsub .ToPtr (true ),
37- })
38+ jobID , _ , err := qs .Submit (context .Background (),
39+ qsub.JobOptions {
40+ Command : "/bin/bash" ,
41+ CommandArgs : []string {"-c" , fmt .Sprintf ("echo job %d; sleep 0" , i + 1 )},
42+ Binary : qsub .ToPtr (true ),
43+ })
3844 Expect (err ).NotTo (HaveOccurred ())
3945 log .Printf ("jobID: %d" , jobID )
4046 jobIDs [i ] = int (jobID )
4147 }
4248
43- jobDetailsChan , err := qacct .WatchFile (context .Background (),
44- qacct .GetDefaultQacctFile (), 0 )
45- Expect (err ).NotTo (HaveOccurred ())
46- Expect (jobDetailsChan ).NotTo (BeNil ())
47-
4849 receivedJobs := make (map [int ]bool )
4950 Eventually (func () bool {
5051 select {
5152 case jd := <- jobDetailsChan :
5253 log .Printf ("job: %+v" , jd .JobNumber )
5354 // check if jobID is in the jobIDs list
5455 if slices .Contains (jobIDs , int (jd .JobNumber )) {
55- Expect (jd .SubmitCommandLine ).To (ContainSubstring ("echo 'job " ))
56+ Expect (jd .SubmitCommandLine ).To (ContainSubstring ("bash " ))
5657 Expect (jd .JobUsage .Usage .Memory ).To (BeNumerically (">=" , 0 ))
5758 receivedJobs [int (jd .JobNumber )] = true
5859 }
0 commit comments