Skip to content

Commit

Permalink
tinker test setup for parallel tests
Browse files Browse the repository at this point in the history
  • Loading branch information
colby-swandale committed Oct 15, 2024
1 parent f76c73d commit 460c282
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 1 addition & 2 deletions test/helpers/es_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def es_version_downloads(id)
end

def get_response(id)
Rubygem.searchkick_index.refresh
Searchkick.client.get index: "rubygems-#{Rails.env}", id: id
Searchkick.client.get index: Rubygem.search_index.name, id: id
end
end
2 changes: 1 addition & 1 deletion test/models/concerns/rubygem_searchable_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class RubygemSearchableTest < ActiveSupport::TestCase
context "source" do
setup do
rubygem = create(:rubygem, name: "example_gem", downloads: 10)
create(:version, rubygem: rubygem, summary: "some summary", description: "some description")
create(:version, :reindex, rubygem: rubygem, summary: "some summary", description: "some description")
end

should "return all terms of source" do
Expand Down
8 changes: 5 additions & 3 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,9 @@ class ActiveSupport::TestCase
Version.reset_column_information # TODO: Remove once https://github.com/rails/rails/pull/52703 is released

SemanticLogger.reopen
Searchkick.index_suffix = worker

Searchkick.index_suffix = "_#{worker}"
Rubygem.reindex
Rubygem.disable_callbacks
Searchkick.disable_callbacks
end

setup do
Expand All @@ -96,6 +95,9 @@ class ActiveSupport::TestCase
Unpwn.offline = true
OmniAuth.config.mock_auth.clear

Rubygem.reindex
Searchkick.disable_callbacks

@launch_darkly = LaunchDarkly::Integrations::TestData.data_source
config = LaunchDarkly::Config.new(data_source: @launch_darkly, send_events: false)
Rails.configuration.launch_darkly_client = LaunchDarkly::LDClient.new("", config)
Expand Down

0 comments on commit 460c282

Please sign in to comment.