tweaking
This commit is contained in:
		
							parent
							
								
									568c70b083
								
							
						
					
					
						commit
						6582ef79a5
					
				| @ -11,6 +11,7 @@ package gearman | |||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
|     "time" |     "time" | ||||||
|  |     "sync" | ||||||
|     "testing" |     "testing" | ||||||
|     "strings" |     "strings" | ||||||
|     "github.com/mikespook/gearman-go/client" |     "github.com/mikespook/gearman-go/client" | ||||||
| @ -66,24 +67,31 @@ func TestJobs(t *testing.T) { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     { |     { | ||||||
|  |         var w sync.WaitGroup | ||||||
|         jobHandler := func(job *client.Job) { |         jobHandler := func(job *client.Job) { | ||||||
|             upper := strings.ToUpper(STR) |             upper := strings.ToUpper(STR) | ||||||
|             if (string(job.Data) != upper) { |             if (string(job.Data) != upper) { | ||||||
|                 t.Error("%s expected, got %s", []byte(upper), job.Data) |                 t.Error("%s expected, got %s", []byte(upper), job.Data) | ||||||
|             } |             } | ||||||
|  |             w.Done() | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         w.Add(1) | ||||||
|         handle := c.Do("ToUpper", []byte(STR), client.JOB_NORMAL, jobHandler) |         handle := c.Do("ToUpper", []byte(STR), client.JOB_NORMAL, jobHandler) | ||||||
|  |         w.Wait() | ||||||
|         status, err := c.Status(handle, time.Second) |         status, err := c.Status(handle, time.Second) | ||||||
|         if err != nil { |         if err != nil { | ||||||
|             t.Error(err) |             t.Error(err) | ||||||
|             return |             return | ||||||
|         } |         } | ||||||
| 
 |         if status.Known { | ||||||
|         if !status.Known { |             t.Errorf("%s shouldn't be known", status.Handle) | ||||||
|             t.Errorf("%s should be known", status.Handle) |  | ||||||
|             return |             return | ||||||
|         } |         } | ||||||
|  | 
 | ||||||
|  |         if status.Running { | ||||||
|  |             t.Errorf("%s shouldn't be running", status.Handle) | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|     { |     { | ||||||
|         handle := c.DoBg("Sleep", nil, client.JOB_NORMAL) |         handle := c.DoBg("Sleep", nil, client.JOB_NORMAL) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user