Commit 8b7cf773 authored by Harsh Chouraria's avatar Harsh Chouraria

Fix flaky test failure in charts_spec

The timezone based tests in ci/charts_spec will
fail when executed close to midnight, as witnessed
in https://gitlab.com/gitlab-org/gitlab/-/jobs/1019524415

This change addresses the stability of the test by
specifying an explicit time for an object that is being
queried in a sensitive time window

This is a follow-up fix for just the tests originally added
via https://gitlab.com/gitlab-org/gitlab/-/merge_requests/52971
parent 1fc58917
......@@ -98,7 +98,12 @@ RSpec.describe Gitlab::Ci::Charts do
subject { chart.total }
before do
create(:ci_empty_pipeline, project: project, duration: 120)
# The created_at time used by the following execution
# can end up being after the creation of the 'today' time
# objects created above, and cause the queried counts to
# go to zero when the test executes close to midnight on the
# CI system, so we explicitly set it to a day earlier
create(:ci_empty_pipeline, project: project, duration: 120, created_at: today - 1.day)
end
it 'uses a utc time zone for range times' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment