Skip to content

Commit

Permalink
[receiver/purefa] Add the check to the return of the mock response
Browse files Browse the repository at this point in the history
  • Loading branch information
dgoscn committed May 23, 2023
1 parent 92fe200 commit ad288f1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion receiver/purefareceiver/internal/scraper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"time"
"net/http"
"net/http/httptest"
"log"

"github.com/prometheus/common/model"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -55,7 +56,12 @@ func TestToPrometheusConfig(t *testing.T) {
mockServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// Serve mock response for the test
w.WriteHeader(http.StatusOK)
w.Write([]byte("Mock response"))
_, err := w.Write([]byte("Mock response"))
if err != nil {
log.Println("Error on the response:", err)

return
}
}))
defer mockServer.Close()

Expand Down

0 comments on commit ad288f1

Please sign in to comment.