Make use of time.After convenience function
This commit is contained in:
		
							parent
							
								
									3495977a8d
								
							
						
					
					
						commit
						9d4e937aef
					
				| @ -78,7 +78,7 @@ func TestLookup(t *testing.T) { | |||||||
| 
 | 
 | ||||||
| 	// Got to wait for aggragation coroutine to finish | 	// Got to wait for aggragation coroutine to finish | ||||||
| 	// XXX: Sleep is no good for testing. Need to come up with a better solution | 	// XXX: Sleep is no good for testing. Need to come up with a better solution | ||||||
| 	time.Sleep(10 * time.Millisecond) | 	time.Sleep(100 * time.Millisecond) | ||||||
| 
 | 
 | ||||||
| 	var ( | 	var ( | ||||||
| 		res map[string]*influxdb.Series | 		res map[string]*influxdb.Series | ||||||
| @ -203,12 +203,10 @@ func TestAggregate(t *testing.T) { | |||||||
| 		}, | 		}, | ||||||
| 	) | 	) | ||||||
| 
 | 
 | ||||||
| 	timer := time.NewTimer(time.Second) |  | ||||||
| 
 |  | ||||||
| 	var series []*influxdb.Series | 	var series []*influxdb.Series | ||||||
| 	select { | 	select { | ||||||
| 	case series = <-res: | 	case series = <-res: | ||||||
| 	case <-timer.C: | 	case <-time.After(100 * time.Millisecond): | ||||||
| 		t.Error("Flushing did not happen") | 		t.Error("Flushing did not happen") | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user