Skip to content

Commit 7ec186d

Browse files
committed
address comments
1 parent ffeb9be commit 7ec186d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

obsreport/obsreporttest/otelprometheuschecker_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"net/http"
1919
"os"
2020
"path/filepath"
21+
"strings"
2122
"testing"
2223

2324
"github.com/stretchr/testify/assert"
@@ -27,17 +28,17 @@ import (
2728
"go.opentelemetry.io/collector/config"
2829
)
2930

30-
const testFolder = "testdata"
31-
3231
func newStubPromChecker() (prometheusChecker, error) {
33-
promResponse, err := os.ReadFile(filepath.Join(testFolder, "prometheus_response"))
32+
promBytes, err := os.ReadFile(filepath.Join("testdata", "prometheus_response"))
3433
if err != nil {
3534
return prometheusChecker{}, err
3635
}
3736

37+
promResponse := strings.ReplaceAll(string(promBytes), "\r\n", "\n")
38+
3839
return prometheusChecker{
3940
promHandler: http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
40-
_, _ = w.Write(promResponse)
41+
_, _ = w.Write([]byte(promResponse))
4142
}),
4243
}, nil
4344
}

0 commit comments

Comments
 (0)