Skip to content

Commit

Permalink
Compare cocina without metadata when testing legacy against Repositor…
Browse files Browse the repository at this point in the history
…yObjects. (#4866)

closes #4865
  • Loading branch information
justinlittman authored Apr 12, 2024
1 parent 28e36e8 commit bd1f2eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/services/cocina_object_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def find(druid)
return cocina unless Settings.enabled_features.repository_object_test

legacy = ar_find(druid).to_cocina_with_metadata
return cocina if legacy == cocina
return cocina if Cocina::Models.without_metadata(legacy) == Cocina::Models.without_metadata(cocina)

Honeybadger.notify('Comparison of RepositoryObject with legacy object failed.', context: { druid: })
return legacy
Expand Down
4 changes: 4 additions & 0 deletions spec/services/cocina_object_store_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@
context 'when objects match' do
let(:version_attributes) { RepositoryObjectVersion.to_model_hash(ar_cocina_object.to_cocina) }

before do
repo_object.head_version.update!(updated_at: 1.day.ago)
end

it "doesn't report a diff" do
expect(store.find(repo_object.external_identifier)).to be_instance_of(Cocina::Models::DROWithMetadata)
expect(Honeybadger).not_to have_received(:notify)
Expand Down

0 comments on commit bd1f2eb

Please sign in to comment.