Skip to content

Commit bcb258c

Browse files
committed
fixup: Respond to review feedback
1 parent b2d0d3d commit bcb258c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/fixture/tmpnet/check_monitoring.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"errors"
1111
"fmt"
1212
"io"
13+
"math"
1314
"net/http"
1415
"net/url"
1516
"strconv"
@@ -63,6 +64,9 @@ func CheckLogsExist(ctx context.Context, log logging.Logger, networkUUID string)
6364
}
6465

6566
url := getLokiURL()
67+
if !strings.HasPrefix(url, "https") {
68+
return fmt.Errorf("loki URL must be https for basic auth to be secure: %s", url)
69+
}
6670

6771
selectors, err := getSelectors(networkUUID)
6872
if err != nil {
@@ -155,7 +159,7 @@ func queryLoki(
155159
return 0, fmt.Errorf("parsing count value: %w", err)
156160
}
157161
// Round to nearest integer
158-
return int(floatVal + 0.5), nil
162+
return int(math.Round(floatVal)), nil
159163
}
160164

161165
// CheckMetricsExist checks if metrics exist for the given network. Github labels are also
@@ -167,6 +171,9 @@ func CheckMetricsExist(ctx context.Context, log logging.Logger, networkUUID stri
167171
}
168172

169173
url := getPrometheusURL()
174+
if !strings.HasPrefix(url, "https") {
175+
return fmt.Errorf("prometheus URL must be https for basic auth to be secure: %s", url)
176+
}
170177

171178
selectors, err := getSelectors(networkUUID)
172179
if err != nil {

0 commit comments

Comments
 (0)