Skip to content

Commit

Permalink
be consistent in the way we round seconds (#16070)
Browse files Browse the repository at this point in the history
In some cases we only display full seconds, particularly when rendering
the summary event, and when converting the engine event for use in the
API. However we are currently not consistent with that, rounding up in
the display code and rounding down when converting the engine event.

It probably doesn't matter what exactly we are doing here, but for
writing display snapshot tests it does. Let's split the difference here,
and always round up, so we never give the impression that the operation
took no time.

It doesn't look like Pulumi Cloud shows this at all, so it probably
doesn't matter for users, and we could just round up for everyone as
well. I don't have strong opinions about that.
  • Loading branch information
tgummerer committed Apr 29, 2024
1 parent 0063635 commit f3f0b19
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/backend/display/events.go
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"math"
"regexp"
"time"

Expand Down Expand Up @@ -134,7 +135,7 @@ func ConvertEngineEvent(e engine.Event, showSecrets bool) (apitype.EngineEvent,
}
apiEvent.SummaryEvent = &apitype.SummaryEvent{
MaybeCorrupt: p.MaybeCorrupt,
DurationSeconds: int(p.Duration.Seconds()),
DurationSeconds: int(math.Ceil(p.Duration.Seconds())),
ResourceChanges: changes,
PolicyPacks: p.PolicyPacks,
}
Expand Down

0 comments on commit f3f0b19

Please sign in to comment.