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

Fix up test for etag updates #32

Merged
merged 1 commit into from
Nov 16, 2015
Merged

Fix up test for etag updates #32

merged 1 commit into from
Nov 16, 2015

Conversation

untitaker
Copy link
Member

No description provided.

@untitaker
Copy link
Member Author

@gregkare Please review.

Also, do you just hash the file content for etag? This might be problematic as metadata changes alone should trigger an ETag update.

@gregkare
Copy link
Member

Let me check


@item_etag = @res.headers[:etag]
@old_listing = JSON.parse @old_listing_res.body
@listing = JSON.parse @listing_res.body
@item_info = @listing["items"]["test-object-simple.json"]
@old_item_info = @old_listing["items"]["test-object-simple.json"]
@item_info = @listing["items"]["nested-folder-object.json"]
Copy link
Member Author

Choose a reason for hiding this comment

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

It's comparing listing vs old_listing. Should I rename?

Copy link
Member

Choose a reason for hiding this comment

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

No, I think I was just confused because of what's probably a bug in our server

Copy link
Member

Choose a reason for hiding this comment

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

What's a bug?!

Copy link
Member

Choose a reason for hiding this comment

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

@skddc I'm investigating right now, I'm getting the wrong ETag

Copy link
Member

Choose a reason for hiding this comment

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

It's not a bug in our server, this spec is wrong. before is a before :each so it's running three times (once for each it block). On the second it block the spec fails because the old_listing is actually the new one from the previous it

Copy link
Member

Choose a reason for hiding this comment

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

I had to look it up because I'm usually using RSpec, there's an extension that adds before :all to minitest-spec (https://github.com/jeremyevans/minitest-hooks). We have two options: add this as a dependency or turn those three it blocks into one

Copy link
Member Author

Choose a reason for hiding this comment

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

On a very related note, I think we should get rid of the tests dependency on each other, i.e. wipe the server after each test. This is slow but will let us keep our sanity.

Copy link
Member Author

Choose a reason for hiding this comment

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

#33

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Member

Choose a reason for hiding this comment

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

Cool, I'm running it once more with the updated code

@@ -81,35 +81,34 @@ def check_dir_listing_content_type(content_type)
end
end

describe "PUT another JSON object" do
describe "updating that JSON object" do
before do
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be better to group together the old_listing variables before the put request and the new ones afterwards. Also not all of those variables need to be instance variables (prefixed with @) because they're not used outside of the before block

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Copy link
Member Author

Choose a reason for hiding this comment

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

ahh fuck me

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@gregkare
Copy link
Member

👍

untitaker added a commit that referenced this pull request Nov 16, 2015
@untitaker untitaker merged commit f94ec2e into master Nov 16, 2015
@gregkare gregkare deleted the etag-updating-fixes branch November 19, 2015 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants