mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-31 10:13:14 -04:00 
			
		
		
		
	Add some sleeps to make it less flaky
Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
		| @@ -53,6 +53,7 @@ func TestMetricsRefused(t *testing.T) { | |||||||
| 	if _, err = dns.Exchange(m, udp); err != nil { | 	if _, err = dns.Exchange(m, udp); err != nil { | ||||||
| 		t.Fatalf("Could not send message: %s", err) | 		t.Fatalf("Could not send message: %s", err) | ||||||
| 	} | 	} | ||||||
|  | 	time.Sleep(100 * time.Millisecond) // sleep a bit to allow actual metrics to be updated for sure. | ||||||
|  |  | ||||||
| 	data := test.Scrape("http://" + metrics.ListenAddr + "/metrics") | 	data := test.Scrape("http://" + metrics.ListenAddr + "/metrics") | ||||||
| 	got, labels := test.MetricValue(metricName, data) | 	got, labels := test.MetricValue(metricName, data) | ||||||
| @@ -87,6 +88,7 @@ func TestMetricsPlugin(t *testing.T) { | |||||||
| 	if _, err = dns.Exchange(m, udp); err != nil { | 	if _, err = dns.Exchange(m, udp); err != nil { | ||||||
| 		t.Fatalf("Could not send message: %s", err) | 		t.Fatalf("Could not send message: %s", err) | ||||||
| 	} | 	} | ||||||
|  | 	time.Sleep(100 * time.Millisecond) // sleep a bit to allow actual metrics to be updated for sure. | ||||||
|  |  | ||||||
| 	data := test.Scrape("http://" + metrics.ListenAddr + "/metrics") | 	data := test.Scrape("http://" + metrics.ListenAddr + "/metrics") | ||||||
| 	_, labels := test.MetricValue(metricName, data) | 	_, labels := test.MetricValue(metricName, data) | ||||||
| @@ -134,6 +136,7 @@ func TestMetricsAuto(t *testing.T) { | |||||||
| 	if _, err := dns.Exchange(m, udp); err != nil { | 	if _, err := dns.Exchange(m, udp); err != nil { | ||||||
| 		t.Fatalf("Could not send message: %s", err) | 		t.Fatalf("Could not send message: %s", err) | ||||||
| 	} | 	} | ||||||
|  | 	time.Sleep(100 * time.Millisecond) // sleep a bit to allow actual metrics to be updated for sure. | ||||||
|  |  | ||||||
| 	metricName := "coredns_dns_requests_total" // {zone, proto, family, type} | 	metricName := "coredns_dns_requests_total" // {zone, proto, family, type} | ||||||
|  |  | ||||||
| @@ -192,6 +195,7 @@ func TestMetricsSeveralBlocs(t *testing.T) { | |||||||
| 	if _, err = dns.Exchange(m, udp); err != nil { | 	if _, err = dns.Exchange(m, udp); err != nil { | ||||||
| 		t.Fatalf("Could not send message: %s", err) | 		t.Fatalf("Could not send message: %s", err) | ||||||
| 	} | 	} | ||||||
|  | 	time.Sleep(100 * time.Millisecond) // sleep a bit to allow actual metrics to be updated for sure. | ||||||
|  |  | ||||||
| 	beginCacheSize := test.ScrapeMetricAsInt(addrMetrics, cacheSizeMetricName, "", 0) | 	beginCacheSize := test.ScrapeMetricAsInt(addrMetrics, cacheSizeMetricName, "", 0) | ||||||
|  |  | ||||||
| @@ -277,6 +281,7 @@ func TestMetricsAvailable(t *testing.T) { | |||||||
| 	if _, _, err := cl.Exchange(m, tcp); err != nil { | 	if _, _, err := cl.Exchange(m, tcp); err != nil { | ||||||
| 		t.Fatalf("Could not send message: %s", err) | 		t.Fatalf("Could not send message: %s", err) | ||||||
| 	} | 	} | ||||||
|  | 	time.Sleep(100 * time.Millisecond) // sleep a bit to allow actual metrics to be updated for sure. | ||||||
|  |  | ||||||
| 	// we should have metrics from forward, cache, and metrics itself | 	// we should have metrics from forward, cache, and metrics itself | ||||||
| 	if err := collectMetricsInfo(metrics.ListenAddr, procMetric, procCache, procCacheMiss, procForward); err != nil { | 	if err := collectMetricsInfo(metrics.ListenAddr, procMetric, procCache, procCacheMiss, procForward); err != nil { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user