mirror of
https://github.com/prometheus/prometheus.git
synced 2026-05-04 20:06:12 +02:00
Address feedback
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
This commit is contained in:
parent
2cf2bf5b8f
commit
e57512acfc
@ -104,7 +104,7 @@ func TestCalculateDuration(t *testing.T) {
|
||||
expr parser.Expr
|
||||
expected time.Duration
|
||||
errorMessage string
|
||||
requirePositive bool
|
||||
allowedNegative bool
|
||||
}{
|
||||
{
|
||||
name: "addition",
|
||||
@ -193,7 +193,7 @@ func TestCalculateDuration(t *testing.T) {
|
||||
Op: parser.SUB,
|
||||
},
|
||||
expected: -5 * time.Second,
|
||||
requirePositive: true,
|
||||
allowedNegative: true,
|
||||
},
|
||||
{
|
||||
name: "division by zero",
|
||||
@ -225,7 +225,7 @@ func TestCalculateDuration(t *testing.T) {
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
result, err := calculateDuration(tt.expr, tt.requirePositive)
|
||||
result, err := calculateDuration(tt.expr, tt.allowedNegative)
|
||||
if tt.errorMessage != "" {
|
||||
require.Error(t, err)
|
||||
require.Contains(t, err.Error(), tt.errorMessage)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user