Skip to content

Conversation

bcpeinhardt
Copy link
Contributor

@bcpeinhardt bcpeinhardt commented Aug 20, 2025

fixes coder/internal#559

This test is looking to see that after calling coder schedule extend <workspace> 10h, the scheduled stop time of the workspace is updated appropriately (or at least that the information printed to the terminal indicates that).

By using two time.Now() calls for the current time and the expected time, there was the possibility that the second call just barely crossed over the hour mark. This is shown in the error message when the test would flake: wanted "2025-04-07T22:"; got " 2025-04-07T23:00:00+05:30 \r\n" (the 00:00 letting us know we just barely crossed the hour).

Using the same time object to construct the expected time should fix the issue.

@bcpeinhardt bcpeinhardt changed the title fix(flake): expected time crossing hour boundary with two time.Now() calls fix(flake): fix expected time crossing hour boundary with two time.Now() calls Aug 20, 2025
@bcpeinhardt bcpeinhardt changed the title fix(flake): fix expected time crossing hour boundary with two time.Now() calls fix: fix flake where expected time is crossing the hour boundary due to two time.Now() calls Aug 20, 2025
@bcpeinhardt bcpeinhardt changed the title fix: fix flake where expected time is crossing the hour boundary due to two time.Now() calls fix: fix flake due to two time.Now() calls Aug 20, 2025
@@ -353,7 +353,7 @@ func TestScheduleOverride(t *testing.T) {
ownerClient, _, _, ws := setupTestSchedule(t, sched)
now := time.Now()
// To avoid the likelihood of time-related flakes, only matching up to the hour.
expectedDeadline := time.Now().In(loc).Add(10 * time.Hour).Format("2006-01-02T15:")
expectedDeadline := now.In(loc).Add(10 * time.Hour).Format("2006-01-02T15:")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The culprit

@bcpeinhardt bcpeinhardt requested a review from f0ssel August 20, 2025 16:34
Copy link
Contributor

@f0ssel f0ssel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕙

@bcpeinhardt bcpeinhardt merged commit 02fc173 into main Aug 20, 2025
45 checks passed
@bcpeinhardt bcpeinhardt deleted the bcpeinhardt/TestSchecduleOverride/extend-flakefix branch August 20, 2025 17:12
@github-actions github-actions bot locked and limited conversation to collaborators Aug 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flake: cli TestScheduleOverride/extend
2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy