Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix journal creation race condition with P-1D timestamp

Dombi Attila1f4793eaec52
diff --git a/spec/requests/api/v3/work_packages/show_resource_spec.rb b/spec/requests/api/v3/work_packages/show_resource_spec.rb
index c4210dd92a6..ad141441927 100644
--- a/spec/requests/api/v3/work_packages/show_resource_spec.rb
+++ b/spec/requests/api/v3/work_packages/show_resource_spec.rb
@@ -229,7 +229,10 @@ RSpec.describe 'API v3 Work package resource',
project:,
journals: {
created_at => { subject: "The original work package" },
- 1.day.ago => {}
+ # This journal creation conflicts with the timestamp "P-1D" due to timing issues.
+ # P-1D is always evaluated to the current time at runtime, thus we cannot control that.
+ # To solve the issue, we modify the journal's creation time, we add 1 second to it.
+ 1.day.ago + 1 => {}
})
end
let(:original_journal) { work_package.journals.first }