mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-27 22:49:40 -08:00
retrieval: Reduce flakiness of target tests
Bump timeouts of tests where we don't want I/O timeouts. Adjust the full channel test to be much more reliable, by reducing the ingestion timeout from 1ms to 0.
This commit is contained in:
parent
cac6eea434
commit
93145b960a
|
@ -30,7 +30,6 @@ type slowAppender struct{}
|
||||||
|
|
||||||
func (a slowAppender) Append(*model.Sample) {
|
func (a slowAppender) Append(*model.Sample) {
|
||||||
time.Sleep(time.Millisecond)
|
time.Sleep(time.Millisecond)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type collectResultAppender struct {
|
type collectResultAppender struct {
|
||||||
|
|
|
@ -103,7 +103,7 @@ func TestOverwriteLabels(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
target := newTestTarget(server.URL, 10*time.Millisecond, nil)
|
target := newTestTarget(server.URL, time.Second, nil)
|
||||||
|
|
||||||
target.honorLabels = false
|
target.honorLabels = false
|
||||||
app := &collectResultAppender{}
|
app := &collectResultAppender{}
|
||||||
|
@ -154,7 +154,9 @@ func TestTargetScrapeWithFullChannel(t *testing.T) {
|
||||||
)
|
)
|
||||||
defer server.Close()
|
defer server.Close()
|
||||||
|
|
||||||
testTarget := newTestTarget(server.URL, 10*time.Millisecond, model.LabelSet{"dings": "bums"})
|
testTarget := newTestTarget(server.URL, time.Second, model.LabelSet{"dings": "bums"})
|
||||||
|
// Affects full channel but not HTTP fetch
|
||||||
|
testTarget.deadline = 0
|
||||||
|
|
||||||
testTarget.scrape(slowAppender{})
|
testTarget.scrape(slowAppender{})
|
||||||
if testTarget.status.Health() != HealthBad {
|
if testTarget.status.Health() != HealthBad {
|
||||||
|
@ -176,7 +178,7 @@ func TestTargetScrapeMetricRelabelConfigs(t *testing.T) {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
defer server.Close()
|
defer server.Close()
|
||||||
testTarget := newTestTarget(server.URL, 10*time.Millisecond, model.LabelSet{})
|
testTarget := newTestTarget(server.URL, time.Second, model.LabelSet{})
|
||||||
testTarget.metricRelabelConfigs = []*config.RelabelConfig{
|
testTarget.metricRelabelConfigs = []*config.RelabelConfig{
|
||||||
{
|
{
|
||||||
SourceLabels: model.LabelNames{"__name__"},
|
SourceLabels: model.LabelNames{"__name__"},
|
||||||
|
@ -337,7 +339,7 @@ func TestTargetScrape404(t *testing.T) {
|
||||||
)
|
)
|
||||||
defer server.Close()
|
defer server.Close()
|
||||||
|
|
||||||
testTarget := newTestTarget(server.URL, 10*time.Millisecond, model.LabelSet{})
|
testTarget := newTestTarget(server.URL, time.Second, model.LabelSet{})
|
||||||
appender := nopAppender{}
|
appender := nopAppender{}
|
||||||
|
|
||||||
want := errors.New("server returned HTTP status 404 Not Found")
|
want := errors.New("server returned HTTP status 404 Not Found")
|
||||||
|
@ -380,7 +382,7 @@ func BenchmarkScrape(b *testing.B) {
|
||||||
)
|
)
|
||||||
defer server.Close()
|
defer server.Close()
|
||||||
|
|
||||||
testTarget := newTestTarget(server.URL, 100*time.Millisecond, model.LabelSet{"dings": "bums"})
|
testTarget := newTestTarget(server.URL, time.Second, model.LabelSet{"dings": "bums"})
|
||||||
appender := nopAppender{}
|
appender := nopAppender{}
|
||||||
|
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
|
|
Loading…
Reference in a new issue