Address feedback

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
pull/16249/head
Julien Pivotto 3 months ago
parent 2cf2bf5b8f
commit e57512acfc
  1. 6
      promql/durations_test.go

@ -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…
Cancel
Save