Commit efad10d1 authored by Adam Hegyi's avatar Adam Hegyi

Fix flaky VSA tests

- Make sure issue creation happens within rubocop freeze.
- Make sure the time part of endDate is at the end of the day.
parent a3bf7440
......@@ -193,9 +193,12 @@ export const getDurationChartData = (data, startDate, endDate) => {
const flattenedData = flattenDurationChartData(data);
const eventData = [];
const endOfDay = newDate(endDate);
endOfDay.setHours(23, 59, 59); // make sure we're at the end of the day
for (
let currentDate = newDate(startDate);
currentDate <= endDate;
currentDate <= endOfDay;
currentDate = dayAfter(currentDate)
) {
const currentISODate = dateFormat(newDate(currentDate), dateFormats.isoDate);
......
......@@ -281,13 +281,14 @@ RSpec.describe 'Group value stream analytics filters and data', :js do
end
context 'with lots of data', :js do
let_it_be(:issue) { create(:issue, project: project, created_at: 5.days.ago) }
let_it_be(:issue) { create(:issue, project: project) }
around do |example|
freeze_time { example.run }
end
before do
issue.update!(created_at: 5.days.ago)
create_cycle(user, project, issue, mr, milestone, pipeline)
create(:labeled_issue, created_at: 5.days.ago, project: create(:project, group: group), labels: [group_label1])
create(:labeled_issue, created_at: 3.days.ago, project: create(:project, group: group), labels: [group_label2])
......
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