csi-addons / kubernetes-csi-addons

CSI-Addons implementation and APIs for Kubernetes
Apache License 2.0
17 stars 33 forks source link

ci: fix TestGetNextSchedule failure #530

Closed karthik-us closed 4 months ago

karthik-us commented 4 months ago

The test case was failing if the test was run at some particular time of the day.

For ex: If the test was triggered @0:15:0, the last scheduled time will be 23:15:0 of the previous day since we are setting it to an hour earlier than the current time. Now when we calculate the getNextSchedule, the next schedule will point to the current day, when the cron job is scheduled to run at midnight every day. So in this case, the lastMissed will be pointing to a valid time. This leads to some test cases to get unexpected value for the lastMissed time which expects it to be time.Time{}. Though we get the expected wantErr in such cases too, since we are comparing the other return values seperately.

To avoid such failures, this patch checks for multiple expected last scheduled times. Also the last scheduled time is aligned with the cron job schedule to keep it relative.

nixpanic commented 4 months ago

@mergifyio requeue

mergify[bot] commented 4 months ago

requeue

✅ The queue state of this pull request has been cleaned. It can be re-embarked automatically

nixpanic commented 4 months ago

@mergifyio refresh

mergify[bot] commented 4 months ago

refresh

✅ Pull request refreshed