From 3a0145c09e0f6adbb080027cf7f93eac9c74d926 Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Sat, 22 Aug 2015 09:47:57 +0200 Subject: [PATCH] Reenable blocked appending tests --- retrieval/target_test.go | 52 ++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/retrieval/target_test.go b/retrieval/target_test.go index 3578b3756..477ac66f4 100644 --- a/retrieval/target_test.go +++ b/retrieval/target_test.go @@ -17,7 +17,7 @@ import ( "crypto/tls" "crypto/x509" "errors" - // "fmt" + "fmt" "io/ioutil" "net/http" "net/http/httptest" @@ -140,31 +140,31 @@ func TestTargetScrapeUpdatesState(t *testing.T) { } } -// func TestTargetScrapeWithFullChannel(t *testing.T) { -// server := httptest.NewServer( -// http.HandlerFunc( -// func(w http.ResponseWriter, r *http.Request) { -// w.Header().Set("Content-Type", `text/plain; version=0.0.4`) -// for i := 0; i < 2*ingestedSamplesCap; i++ { -// w.Write([]byte( -// fmt.Sprintf("test_metric_%d{foo=\"bar\"} 123.456\n", i), -// )) -// } -// }, -// ), -// ) -// defer server.Close() - -// testTarget := newTestTarget(server.URL, 10*time.Millisecond, model.LabelSet{"dings": "bums"}) - -// testTarget.scrape(slowAppender{}) -// if testTarget.status.Health() != HealthBad { -// t.Errorf("Expected target state %v, actual: %v", HealthBad, testTarget.status.Health()) -// } -// if testTarget.status.LastError() != errIngestChannelFull { -// t.Errorf("Expected target error %q, actual: %q", errIngestChannelFull, testTarget.status.LastError()) -// } -// } +func TestTargetScrapeWithFullChannel(t *testing.T) { + server := httptest.NewServer( + http.HandlerFunc( + func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", `text/plain; version=0.0.4`) + for i := 0; i < 2*ingestedSamplesCap; i++ { + w.Write([]byte( + fmt.Sprintf("test_metric_%d{foo=\"bar\"} 123.456\n", i), + )) + } + }, + ), + ) + defer server.Close() + + testTarget := newTestTarget(server.URL, 10*time.Millisecond, model.LabelSet{"dings": "bums"}) + + testTarget.scrape(slowAppender{}) + if testTarget.status.Health() != HealthBad { + t.Errorf("Expected target state %v, actual: %v", HealthBad, testTarget.status.Health()) + } + if testTarget.status.LastError() != errIngestChannelFull { + t.Errorf("Expected target error %q, actual: %q", errIngestChannelFull, testTarget.status.LastError()) + } +} func TestTargetScrapeMetricRelabelConfigs(t *testing.T) { server := httptest.NewServer(