Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optimistic_lock_token to valkyrie resources on query #475

Merged
merged 1 commit into from
Jul 30, 2018
Merged

Conversation

hackartisan
Copy link
Contributor

@hackartisan hackartisan commented Jul 30, 2018

We'll deal with the fact that these aren't coming through from the persister in a forthcoming (persister-focused) PR

connected to #286
connected to #453

@hackartisan hackartisan changed the title [WIP] Add optimistic_lock_token to valkyrie resources on query Add optimistic_lock_token to valkyrie resources on query Jul 30, 2018
context "without locking enabled" do
before do
class CustomNonlockingResource < Valkyrie::Resource
enable_optimistic_locking
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought locking wasn't supposed to be enabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh that's bad!

resource = persister.save(resource: CustomNonlockingResource.new(title: "My Title"))
resource = query_service.find_by(id: resource.id)
query_doc = (query_service.connection.get 'select', :params => {:q => "id:#{resource.id}"})["response"]["docs"].first
expect(resource.optimistic_lock_token.first).to eq query_doc["_version_"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be checking to make sure this isn't set right? Or even that the property doesn't exist I guess.

resource = persister.save(resource: CustomNonlockingResource.new(title: "My Title"))
resource = query_service.find_by(id: resource.id)
query_doc = (query_service.connection.get 'select', params: { q: "id:#{resource.id}" })["response"]["docs"].first
expect(resource.optimistic_lock_token.first).to eq query_doc["_version_"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this not exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah it looks like this is actually covered by the resource spec in https://github.com/samvera-labs/valkyrie/pull/474/files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we'll just remove that test here.

connected to #286
connected to #453

Co-authored-by: Adam Wead <[email protected]>
Co-authored-by: Michael Tribone <[email protected]>
@tpendragon tpendragon merged commit b8569fc into master Jul 30, 2018
@tpendragon tpendragon deleted the i#453 branch July 30, 2018 18:14
@tpendragon tpendragon removed the Review label Jul 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants