diff --git a/.github/workflows/build_knapsack_controllers.yml b/.github/workflows/build_knapsack_controllers.yml index 6943af5bec..059d1b2040 100644 --- a/.github/workflows/build_knapsack_controllers.yml +++ b/.github/workflows/build_knapsack_controllers.yml @@ -39,10 +39,10 @@ jobs: # [n] - where the n is a number of parallel jobs you want to run your tests on. # Use a higher number if you have slow tests to split them between more parallel jobs. # Remember to update the value of the `ci_node_index` below to (0..n-1). - ci_node_total: [10] + ci_node_total: [5] # Indexes for parallel jobs (starting from zero). # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. - ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + ci_node_index: [0, 1, 2, 3, 4] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/build_knapsack_models.yml b/.github/workflows/build_knapsack_models.yml index 151cf4b27e..d7dcdd2f12 100644 --- a/.github/workflows/build_knapsack_models.yml +++ b/.github/workflows/build_knapsack_models.yml @@ -39,10 +39,10 @@ jobs: # [n] - where the n is a number of parallel jobs you want to run your tests on. # Use a higher number if you have slow tests to split them between more parallel jobs. # Remember to update the value of the `ci_node_index` below to (0..n-1). - ci_node_total: [10] + ci_node_total: [5] # Indexes for parallel jobs (starting from zero). # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. - ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + ci_node_index: [0, 1, 2, 3, 4] steps: - uses: actions/checkout@v3 diff --git a/spec/performance/shop_controller_spec.rb b/spec/performance/shop_controller_spec.rb new file mode 100644 index 0000000000..793a84c049 --- /dev/null +++ b/spec/performance/shop_controller_spec.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +require 'spec_helper' + +xdescribe ShopController, type: :controller, performance: true do + include FileHelper + + let(:d) { create(:distributor_enterprise) } + let(:enterprise_fee) { create(:enterprise_fee) } + let(:order_cycle) { + create(:simple_order_cycle, distributors: [d], coordinator_fees: [enterprise_fee]) + } + + before do + allow(controller).to receive(:current_distributor) { d } + allow(controller).to receive(:current_order_cycle) { order_cycle } + Spree::Config.currency = 'AUD' + end + + describe "fetching products" do + let(:exchange) { order_cycle.exchanges.to_enterprises(d).outgoing.first } + let(:image) { white_logo_file } + let(:cache_key_patterns) do + [ + 'api\/taxon_serializer\/spree\/taxons', + 'enterprise' + ] + end + + before do + 11.times do + p = create(:simple_product) + p.set_property 'Organic Certified', 'NASAA 12345' + v1 = create(:variant, product: p) + v2 = create(:variant, product: p) + Spree::Image.create! viewable_id: p.master.id, viewable_type: 'Spree::Variant', + attachment: image + + exchange.variants << [v1, v2] + end + end + + it "returns products via json" do + pending("fixing failing performance specs") + results = multi_benchmark(3, cache_key_patterns: cache_key_patterns) do + get :products, xhr: true + expect(response.status).to eq 200 + end + end + end +end