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