Skip to content

fix switchover schedule tests#2995

Merged
FxKu merged 7 commits into
zalando:masterfrom
berler:improve-switchover-tests
Dec 11, 2025
Merged

fix switchover schedule tests#2995
FxKu merged 7 commits into
zalando:masterfrom
berler:improve-switchover-tests

Conversation

@berler

@berler berler commented Nov 19, 2025

Copy link
Copy Markdown
Contributor

Previously the tests would fail depending on the local time zone and the time of day the test was being run (even if you set the machine to UTC it would fail if run within an hour of midnight; similarly the tests would fail any time the date component of the local time and UTC was different as the schedule would not match on the right day). Changes the tests to pass in a consistent specific time for now so that the tests no longer have different behavior based on when (or where) they are run.

Previously the tests would fail depending on the local time zone and the
time of day the test was being run.
@zalando-robot

Copy link
Copy Markdown

Cannot start a pipeline due to:

No accountable user for this pipeline: no Zalando employee associated to this GitHub username

Click on pipeline status check Details link below for more information.


func TestGetSwitchoverSchedule(t *testing.T) {
now := time.Now()
now, _ := time.Parse(time.RFC3339, "2025-11-11T12:35:00Z")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

note that you can reproduce the test failures I had when running locally by passing in some other times here like

  • 2025-11-11T20:35:00-08:00
  • 2025-11-11T23:35:00Z

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

jup, could reproduce. Thanks for the pointer

@FxKu FxKu added the bugfix label Nov 24, 2025
@FxKu FxKu added this to the 1.15.1 milestone Nov 24, 2025
@FxKu
FxKu requested a review from mikkeloscar as a code owner December 6, 2025 16:44
Comment thread pkg/cluster/cluster.go Outdated
@FxKu

FxKu commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

@berler can you reflect Mikkel's comment. Then we can merge the PR.

Edit: Committed the suggestions myself via Gh.

Comment thread pkg/cluster/cluster.go Outdated
Comment thread pkg/cluster/cluster_test.go Outdated
@FxKu

FxKu commented Dec 11, 2025

Copy link
Copy Markdown
Contributor

👍

1 similar comment
@idanovinda

Copy link
Copy Markdown
Collaborator

👍

@FxKu
FxKu merged commit cd05682 into zalando:master Dec 11, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants