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

Stick to bundler version < 2 on AppVeyor #2321

Merged
merged 1 commit into from May 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions appveyor.yml
Expand Up @@ -4,6 +4,7 @@ skip_tags: true

environment:
JRUBY_OPTS: "--dev -J-Xmx1024M --debug"
RAILS_VERSION: 5.2
matrix:
- ruby_version: "Ruby23"
- ruby_version: "Ruby23-x64"
Expand All @@ -13,6 +14,9 @@ cache:

install:
- SET PATH=C:\%ruby_version%\bin;%PATH%
- gem uninstall bundler -a -x -I
- gem update --system 2.7.9
- # gem install bundler -v '1.17.3'
- bundle env
- bundle check || bundle install --path=vendor/bundle --retry=3 --jobs=3
- bundle clean --force
Expand Down
10 changes: 6 additions & 4 deletions test/cache_test.rb
Expand Up @@ -164,7 +164,7 @@ def test_expiring_of_cache_at_update_of_record

assert_equal 'Foo', author_json[:name]

author.update_attributes(name: 'Bar')
author.update(name: 'Bar')
Copy link
Member

Choose a reason for hiding this comment

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

👍

author_json = AuthorSerializerWithCache.new(author).as_json

expected = 'Bar'
Expand Down Expand Up @@ -202,10 +202,12 @@ def test_cache_expiration_in_collection_on_update_of_record
end

bar = 'Bar'
author.update!(name: bar)
Timecop.travel(10.seconds.from_now) do
Copy link
Member

Choose a reason for hiding this comment

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

@iggant can you please elaborate the case why you need Timecop in this case?

Copy link
Author

Choose a reason for hiding this comment

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

before this change there were random test failture
probably this is because cache version relay on updated_at column which doesn't contain millisecond part, so time to time it doesn't invalidate cache.
and with travel to 10 second ahead we eliminate this possibility
probably current check in the 172 line is also related, but I will thy to change that test in the next PR

Copy link
Member

Choose a reason for hiding this comment

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

perfect reason 👌 can't wait to see you apply the same logic for the other test too on line 167. You can do it in your next PR. Then we may also be able to remove these weird checks

if ENV['APPVEYOR'] && actual != expected
  skip('Cache expiration tests sometimes fail on Appveyor. FIXME :)')

author.update!(name: bar)

collection_json = render_object_with_cache(author_collection, each_serializer: AuthorSerializerWithCache)
assert_equal [{ name: bar }, { name: bar }, { name: foo2 }], collection_json
collection_json = render_object_with_cache(author_collection, each_serializer: AuthorSerializerWithCache)
assert_equal [{ name: bar }, { name: bar }, { name: foo2 }], collection_json
end
ensure
ARModels::Author.cache_versioning = original_cache_versioning unless original_cache_versioning == :none
end
Expand Down