Skip to content

Commit

Permalink
Refactor bitbucket reporter to use comments
Browse files Browse the repository at this point in the history
  • Loading branch information
prymitive committed Nov 2, 2023
1 parent 1d943a6 commit 1866cb9
Show file tree
Hide file tree
Showing 21 changed files with 893 additions and 337 deletions.
17 changes: 9 additions & 8 deletions cmd/pint/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"net/http"
"os"
"path"
"regexp"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -84,7 +85,7 @@ func httpServer(ts *testscript.TestScript, _ bool, args []string) {
ts.Fatalf("! http response command requires '$NAME $PATH $CODE $BODY' args, got [%s]", strings.Join(args, " "))
}
name := args[1]
path := args[2]
path := regexp.MustCompile(args[2])
code, err := strconv.Atoi(args[3])
ts.Check(err)
body := strings.Join(args[4:], " ")
Expand All @@ -99,7 +100,7 @@ func httpServer(ts *testscript.TestScript, _ bool, args []string) {
}
name := args[1]
meth := args[2]
path := args[3]
path := regexp.MustCompile(args[3])
code, err := strconv.Atoi(args[4])
ts.Check(err)
body := strings.Join(args[5:], " ")
Expand All @@ -114,7 +115,7 @@ func httpServer(ts *testscript.TestScript, _ bool, args []string) {
ts.Fatalf("! http response command requires '$NAME $PATH $USER $PASS $CODE $BODY' args, got [%s]", strings.Join(args, " "))
}
name := args[1]
path := args[2]
path := regexp.MustCompile(args[2])
user := args[3]
pass := args[4]
code, err := strconv.Atoi(args[5])
Expand All @@ -136,7 +137,7 @@ func httpServer(ts *testscript.TestScript, _ bool, args []string) {
ts.Fatalf("! http response command requires '$NAME $PATH $DELAY $CODE $BODY' args, got [%s]", strings.Join(args, " "))
}
name := args[1]
path := args[2]
path := regexp.MustCompile(args[2])
delay, err := time.ParseDuration(args[3])
ts.Check(err)
code, err := strconv.Atoi(args[4])
Expand All @@ -154,7 +155,7 @@ func httpServer(ts *testscript.TestScript, _ bool, args []string) {
ts.Fatalf("! http redirect command requires '$NAME $SRCPATH $DSTPATH' args, got [%s]", strings.Join(args, " "))
}
name := args[1]
srcpath := args[2]
srcpath := regexp.MustCompile(args[2])
dstpath := args[3]
mocks.add(name, httpMock{pattern: srcpath, handler: func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Location", dstpath)
Expand All @@ -181,10 +182,10 @@ func httpServer(ts *testscript.TestScript, _ bool, args []string) {
for n, mockList := range mocks.responses() {
if n == name {
for _, mock := range mockList {
if mock.pattern != "/" && (r.URL.Path != mock.pattern || !strings.HasPrefix(r.URL.Path, mock.pattern)) {
if mock.method != "" && mock.method != r.Method {
continue
}
if mock.method != "" && mock.method != r.Method {
if !mock.pattern.MatchString(r.URL.Path) {
continue
}
mock.handler(w, r)
Expand Down Expand Up @@ -226,7 +227,7 @@ func httpServer(ts *testscript.TestScript, _ bool, args []string) {
}

type httpMock struct {
pattern string
pattern *regexp.Regexp
method string
handler func(http.ResponseWriter, *http.Request)
}
Expand Down
11 changes: 6 additions & 5 deletions cmd/pint/tests/0031_ci_bitbucket.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
http response bitbucket / 200 OK
http response bitbucket /rest/insights/1.0/projects/prometheus/repos/rules/commits/.*/reports/pint 200 OK
http response bitbucket /rest/api/1.0/projects/prometheus/repos/rules/commits/.*/pull-requests 200 {}
http start bitbucket 127.0.0.1:6031

mkdir testrepo
Expand All @@ -21,10 +22,10 @@ exec git commit -am 'v2'
env BITBUCKET_AUTH_TOKEN="12345"
pint.ok -l debug --no-color ci
! stdout .
stderr 'level=DEBUG msg="Sending a request to BitBucket" method=PUT'
stderr 'level=DEBUG msg="BitBucket request completed" status=200'
stderr 'level=DEBUG msg="Sending a request to BitBucket" method=DELETE'
stderr 'level=DEBUG msg="BitBucket request completed" status=200'
stderr 'msg="Sending a request to BitBucket" method=PUT'
stderr 'msg="BitBucket request completed" status=200'
stderr 'msg="Sending a request to BitBucket" method=DELETE'
stderr 'msg="BitBucket request completed" status=200'

-- src/v1.yml --
- alert: rule1
Expand Down
11 changes: 6 additions & 5 deletions cmd/pint/tests/0068_skip_ci.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
http response bitbucket / 200 OK
http response bitbucket /rest/insights/1.0/projects/prometheus/repos/rules/commits/.*/reports/pint 200 OK
http response bitbucket /rest/api/1.0/projects/prometheus/repos/rules/commits/.*/pull-requests 200 {}
http start bitbucket 127.0.0.1:6068

mkdir testrepo
Expand All @@ -22,10 +23,10 @@ env BITBUCKET_AUTH_TOKEN="12345"
pint.ok -l debug --no-color ci
! stdout .
stderr 'level=INFO msg="Found a commit with ''\[skip ci\]'', skipping all checks" commit=.*'
stderr 'level=DEBUG msg="Sending a request to BitBucket" method=PUT'
stderr 'level=DEBUG msg="BitBucket request completed" status=200'
stderr 'level=DEBUG msg="Sending a request to BitBucket" method=DELETE'
stderr 'level=DEBUG msg="BitBucket request completed" status=200'
stderr 'msg="Sending a request to BitBucket" method=PUT'
stderr 'msg="BitBucket request completed" status=200'
stderr 'msg="Sending a request to BitBucket" method=DELETE'
stderr 'msg="BitBucket request completed" status=200'

-- src/v1.yml --
- alert: rule1
Expand Down
3 changes: 2 additions & 1 deletion cmd/pint/tests/0069_bitbucket_skip_unmodified.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
http response bitbucket / 200 OK
http response bitbucket /rest/insights/1.0/projects/prometheus/repos/rules/commits/.*/reports/pint 200 OK
http response bitbucket /rest/api/1.0/projects/prometheus/repos/rules/commits/.*/pull-requests 200 {}
http start bitbucket 127.0.0.1:6069

mkdir testrepo
Expand Down
11 changes: 6 additions & 5 deletions cmd/pint/tests/0070_bitbucket_strict.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
http response bitbucket / 200 OK
http response bitbucket /rest/insights/1.0/projects/prometheus/repos/rules/commits/.*/reports/pint 200 OK
http response bitbucket /rest/api/1.0/projects/prometheus/repos/rules/commits/.*/pull-requests 200 {}
http start bitbucket 127.0.0.1:6070

mkdir testrepo
Expand All @@ -23,10 +24,10 @@ pint.error -l debug --no-color ci
! stdout .
stderr 'result":"FAIL"'
stderr ',"line":3,'
stderr 'level=DEBUG msg="Sending a request to BitBucket" method=PUT'
stderr 'level=DEBUG msg="BitBucket request completed" status=200'
stderr 'level=DEBUG msg="Sending a request to BitBucket" method=DELETE'
stderr 'level=DEBUG msg="BitBucket request completed" status=200'
stderr 'msg="Sending a request to BitBucket" method=PUT'
stderr 'msg="BitBucket request completed" status=200'
stderr 'msg="Sending a request to BitBucket" method=DELETE'
stderr 'msg="BitBucket request completed" status=200'

-- src/v1.yml --
- alert: rule1
Expand Down
3 changes: 2 additions & 1 deletion cmd/pint/tests/0071_ci_owner.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
http response bitbucket / 200 OK
http response bitbucket /rest/insights/1.0/projects/prometheus/repos/rules/commits/.*/reports/pint 200 OK
http response bitbucket /rest/api/1.0/projects/prometheus/repos/rules/commits/.*/pull-requests 200 {}
http start bitbucket 127.0.0.1:6071

mkdir testrepo
Expand Down
11 changes: 6 additions & 5 deletions cmd/pint/tests/0072_bitbucket_move_bug_to_modified.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
http response bitbucket / 200 OK
http response bitbucket /rest/insights/1.0/projects/prometheus/repos/rules/commits/.*/reports/pint 200 OK
http response bitbucket /rest/api/1.0/projects/prometheus/repos/rules/commits/.*/pull-requests 200 {}
http start bitbucket 127.0.0.1:6072

mkdir testrepo
Expand All @@ -24,10 +25,10 @@ pint.error --no-color -l debug ci
stderr 'level=INFO msg="Problems found" Fatal=1'
stderr 'result":"FAIL"'
stderr ',"line":3,'
stderr 'level=DEBUG msg="Sending a request to BitBucket" method=PUT'
stderr 'level=DEBUG msg="BitBucket request completed" status=200'
stderr 'level=DEBUG msg="Sending a request to BitBucket" method=DELETE'
stderr 'level=DEBUG msg="BitBucket request completed" status=200'
stderr 'msg="Sending a request to BitBucket" method=PUT'
stderr 'msg="BitBucket request completed" status=200'
stderr 'msg="Sending a request to BitBucket" method=DELETE'
stderr 'msg="BitBucket request completed" status=200'

-- src/v1.yml --
- alert: rule1
Expand Down
11 changes: 6 additions & 5 deletions cmd/pint/tests/0075_ci_strict.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
http response bitbucket / 200 OK
http response bitbucket /rest/insights/1.0/projects/prometheus/repos/rules/commits/.*/reports/pint 200 OK
http response bitbucket /rest/api/1.0/projects/prometheus/repos/rules/commits/.*/pull-requests 200 {}
http start bitbucket 127.0.0.1:6075

mkdir testrepo
Expand All @@ -21,10 +22,10 @@ exec git commit -am 'v2'
env BITBUCKET_AUTH_TOKEN="12345"
pint.error -l debug --no-color ci --require-owner
! stdout .
stderr 'level=DEBUG msg="Sending a request to BitBucket" method=PUT'
stderr 'level=DEBUG msg="BitBucket request completed" status=200'
stderr 'level=DEBUG msg="Sending a request to BitBucket" method=DELETE'
stderr 'level=DEBUG msg="BitBucket request completed" status=200'
stderr 'msg="Sending a request to BitBucket" method=PUT'
stderr 'msg="BitBucket request completed" status=200'
stderr 'msg="Sending a request to BitBucket" method=DELETE'
stderr 'msg="BitBucket request completed" status=200'
stderr 'level=INFO msg="Problems found" Fatal=1 Bug=1'
! stderr 'parse error: unclosed left parenthesis'

Expand Down
2 changes: 1 addition & 1 deletion cmd/pint/tests/0076_ci_group_errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -334,4 +334,4 @@ rules.yml:39 Warning: alert query doesn't have any condition, it will always fir
rules.yml:39 Warning: aggregation using without() can be fragile when used inside binary expression because both sides must have identical sets of labels to produce any results, adding or removing labels to metrics used here can easily break the query, consider aggregating using by() to ensure consistent labels (promql/fragile)
39 | expr: errors / sum(requests) without(rack)

level=ERROR msg="Fatal error" err="submitting reports: fatal error(s) reported"
level=ERROR msg="Fatal error" err="submitting reports: failed to get open pull requests from BitBucket: invalid character 'O' looking for beginning of value"
11 changes: 6 additions & 5 deletions cmd/pint/tests/0093_ci_bitbucket_ignore_file.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
http response bitbucket / 200 OK
http response bitbucket /rest/insights/1.0/projects/prometheus/repos/rules/commits/.*/reports/pint 200 OK
http response bitbucket /rest/api/1.0/projects/prometheus/repos/rules/commits/.*/pull-requests 200 {}
http start bitbucket 127.0.0.1:6093

mkdir testrepo
Expand All @@ -25,10 +26,10 @@ stderr 'level=INFO msg="Problems found" Information=1'
stderr 'result":"PASS"'
stderr ',"line":7,'
stderr '"message":"ignore/file:'
stderr 'level=DEBUG msg="Sending a request to BitBucket" method=PUT'
stderr 'level=DEBUG msg="BitBucket request completed" status=200'
stderr 'level=DEBUG msg="Sending a request to BitBucket" method=DELETE'
stderr 'level=DEBUG msg="BitBucket request completed" status=200'
stderr 'msg="Sending a request to BitBucket" method=PUT'
stderr 'msg="BitBucket request completed" status=200'
stderr 'msg="Sending a request to BitBucket" method=DELETE'
stderr 'msg="BitBucket request completed" status=200'

-- src/v1.yml --
# pint ignore/file
Expand Down
3 changes: 2 additions & 1 deletion cmd/pint/tests/0094_rule_file_symlink_bb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ http response prometheus5m /api/v1/query_range 200 {"status":"success","data":{"
http response prometheus5m /api/v1/query 200 {"status":"success","data":{"resultType":"vector","result":[]}}
http start prometheus5m 127.0.0.1:2094

http response bitbucket / 200 OK
http response bitbucket /rest/insights/1.0/projects/prometheus/repos/rules/commits/.*/reports/pint 200 OK
http response bitbucket /rest/api/1.0/projects/prometheus/repos/rules/commits/.*/pull-requests 200 {}
http start bitbucket 127.0.0.1:6094

mkdir testrepo
Expand Down
3 changes: 2 additions & 1 deletion cmd/pint/tests/0100_ci_alerts_count.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ http response prometheus /api/v1/query_range 200 {"status":"success","data":{"re
http response prometheus /api/v1/query 200 {"status":"success","data":{"resultType":"vector","result":[]}}
http start prometheus 127.0.0.1:2100

http response bitbucket / 200 OK
http response bitbucket /rest/insights/1.0/projects/prometheus/repos/rules/commits/.*/reports/pint 200 OK
http response bitbucket /rest/api/1.0/projects/prometheus/repos/rules/commits/.*/pull-requests 200 {}
http start bitbucket 127.0.0.1:6100

mkdir testrepo
Expand Down
3 changes: 2 additions & 1 deletion cmd/pint/tests/0123_ci_owner_allowed.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
http response bitbucket / 200 OK
http response bitbucket /rest/insights/1.0/projects/prometheus/repos/rules/commits/.*/reports/pint 200 OK
http response bitbucket /rest/api/1.0/projects/prometheus/repos/rules/commits/.*/pull-requests 200 {}
http start bitbucket 127.0.0.1:6123

mkdir testrepo
Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
github.com/google/go-github/v55 v55.0.0
github.com/hashicorp/hcl/v2 v2.19.1
github.com/klauspost/compress v1.17.2
github.com/neilotoole/slogt v1.1.0
github.com/prometheus/client_golang v1.17.0
github.com/prometheus/client_model v0.5.0
github.com/prometheus/common v0.45.0
Expand Down Expand Up @@ -89,10 +90,10 @@ require (
go.uber.org/goleak v1.2.1 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sync v0.4.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/tools v0.11.0 // indirect
golang.org/x/tools v0.14.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
14 changes: 8 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8m
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/neilotoole/slogt v1.1.0 h1:c7qE92sq+V0yvCuaxph+RQ2jOKL61c4hqS1Bv9W7FZE=
github.com/neilotoole/slogt v1.1.0/go.mod h1:RCrGXkPc/hYybNulqQrMHRtvlQ7F6NktNVLuLwk6V+w=
github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
Expand Down Expand Up @@ -388,8 +390,8 @@ golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1/go.mod h1:FXUEEKJgO7OQYeo8N0
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -419,8 +421,8 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -465,8 +467,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.11.0 h1:EMCa6U9S2LtZXLAMoWiR/R8dAQFRqbAitmbJ2UKhoi8=
golang.org/x/tools v0.11.0/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8=
golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc=
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
5 changes: 3 additions & 2 deletions internal/checks/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ import (
"testing"
"time"

"github.com/neilotoole/slogt"
v1 "github.com/prometheus/client_golang/api/prometheus/v1"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
"github.com/stretchr/testify/require"

"github.com/cloudflare/pint/internal/checks"
"github.com/cloudflare/pint/internal/discovery"
"github.com/cloudflare/pint/internal/log"
"github.com/cloudflare/pint/internal/output"
"github.com/cloudflare/pint/internal/parser"
"github.com/cloudflare/pint/internal/promapi"
Expand Down Expand Up @@ -105,10 +105,11 @@ type checkTest struct {
}

func runTests(t *testing.T, testCases []checkTest) {
log.Level.Set(slog.LevelError)
for _, tc := range testCases {
// original test
t.Run(tc.description, func(t *testing.T) {
slog.SetDefault(slogt.New(t))

var uri string
if len(tc.mocks) > 0 {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
Expand Down
Loading

0 comments on commit 1866cb9

Please sign in to comment.