workarea-core 3.5.7 → 3.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/app/models/workarea/search/admin.rb +11 -1
 - data/app/models/workarea/search/storefront.rb +5 -1
 - data/app/models/workarea/search/storefront/product.rb +8 -0
 - data/config/initializers/15_endpoint_monitoring.rb +6 -3
 - data/lib/workarea/core/engine.rb +7 -0
 - data/lib/workarea/version.rb +1 -1
 - data/test/integration/workarea/monitoring_integration_test.rb +10 -5
 - data/test/models/workarea/search/storefront_test.rb +15 -0
 - data/test/queries/workarea/search/product_search_test.rb +15 -0
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 1c2fa2d437187cdfa6f9630002c94d5822cc51f5befb62060e6fd219203d4285
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 2a9bb9faea3d1d1ed34cbf48938fcee9d1d2673ebcd3acf1cc976fda0370acd5
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 71f63a2c7b0d0824a173279e01c17ddcc10ea4ef7fb2a232874cd54198a867b5fb6cc3735673d7fe41223f1815e28fdc3794d820d25a74eea03d7f381b4e47eb
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: fc5503c7cb0ee41b481c04cf3682b002e019e095c4a6a1e27c9279a40c78012c3712312e82e5c8c2878c5be680aca7137acb9d706af71bf6cf95c54c4112ec52
         
     | 
| 
         @@ -18,7 +18,17 @@ module Workarea 
     | 
|
| 
       18 
18 
     | 
    
         
             
                          aggs: {
         
     | 
| 
       19 
19 
     | 
    
         
             
                            type: {
         
     | 
| 
       20 
20 
     | 
    
         
             
                              terms: { field: 'facets.type', size: Workarea.config.jump_to_type_limit },
         
     | 
| 
       21 
     | 
    
         
            -
                              aggs: { 
     | 
| 
      
 21 
     | 
    
         
            +
                              aggs: {
         
     | 
| 
      
 22 
     | 
    
         
            +
                                top: {
         
     | 
| 
      
 23 
     | 
    
         
            +
                                  top_hits: {
         
     | 
| 
      
 24 
     | 
    
         
            +
                                    size: Workarea.config.jump_to_results_per_type,
         
     | 
| 
      
 25 
     | 
    
         
            +
                                    sort: [
         
     | 
| 
      
 26 
     | 
    
         
            +
                                      { _score: { order: 'desc' } },
         
     | 
| 
      
 27 
     | 
    
         
            +
                                      { updated_at: { order: 'desc' } }
         
     | 
| 
      
 28 
     | 
    
         
            +
                                    ]
         
     | 
| 
      
 29 
     | 
    
         
            +
                                  }
         
     | 
| 
      
 30 
     | 
    
         
            +
                                }
         
     | 
| 
      
 31 
     | 
    
         
            +
                              }
         
     | 
| 
       22 
32 
     | 
    
         
             
                            }
         
     | 
| 
       23 
33 
     | 
    
         
             
                          }
         
     | 
| 
       24 
34 
     | 
    
         
             
                        }
         
     | 
| 
         @@ -78,6 +78,10 @@ module Workarea 
     | 
|
| 
       78 
78 
     | 
    
         
             
                    nil
         
     | 
| 
       79 
79 
     | 
    
         
             
                  end
         
     | 
| 
       80 
80 
     | 
    
         | 
| 
      
 81 
     | 
    
         
            +
                  def changesets
         
     | 
| 
      
 82 
     | 
    
         
            +
                    @changesets ||= Array.wrap(model.try(:changesets_with_children))
         
     | 
| 
      
 83 
     | 
    
         
            +
                  end
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
       81 
85 
     | 
    
         
             
                  def as_document
         
     | 
| 
       82 
86 
     | 
    
         
             
                    Release.with_current(release_id) do
         
     | 
| 
       83 
87 
     | 
    
         
             
                      {
         
     | 
| 
         @@ -87,7 +91,7 @@ module Workarea 
     | 
|
| 
       87 
91 
     | 
    
         
             
                        active: active,
         
     | 
| 
       88 
92 
     | 
    
         
             
                        active_segment_ids: active_segment_ids,
         
     | 
| 
       89 
93 
     | 
    
         
             
                        release_id: release_id,
         
     | 
| 
       90 
     | 
    
         
            -
                        changeset_release_ids:  
     | 
| 
      
 94 
     | 
    
         
            +
                        changeset_release_ids: changesets.map(&:release_id),
         
     | 
| 
       91 
95 
     | 
    
         
             
                        suggestion_content: suggestion_content,
         
     | 
| 
       92 
96 
     | 
    
         
             
                        created_at: model.created_at,
         
     | 
| 
       93 
97 
     | 
    
         
             
                        updated_at: model.updated_at,
         
     | 
| 
         @@ -122,6 +122,14 @@ module Workarea 
     | 
|
| 
       122 
122 
     | 
    
         
             
                      ProductPrimaryImageUrl.new(model).path
         
     | 
| 
       123 
123 
     | 
    
         
             
                    end
         
     | 
| 
       124 
124 
     | 
    
         | 
| 
      
 125 
     | 
    
         
            +
                    # Override to include release changesets for pricing, featured products, etc.
         
     | 
| 
      
 126 
     | 
    
         
            +
                    #
         
     | 
| 
      
 127 
     | 
    
         
            +
                    # @return [Mongoid::Criteria]
         
     | 
| 
      
 128 
     | 
    
         
            +
                    #
         
     | 
| 
      
 129 
     | 
    
         
            +
                    def changesets
         
     | 
| 
      
 130 
     | 
    
         
            +
                      @product_changesets ||= ProductReleases.new(model).changesets
         
     | 
| 
      
 131 
     | 
    
         
            +
                    end
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
       125 
133 
     | 
    
         
             
                    private
         
     | 
| 
       126 
134 
     | 
    
         | 
| 
       127 
135 
     | 
    
         
             
                    def clean_for_keywords(value)
         
     | 
| 
         @@ -3,7 +3,8 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            #
         
     | 
| 
       4 
4 
     | 
    
         
             
            Easymon::Repository.add(
         
     | 
| 
       5 
5 
     | 
    
         
             
              'mongodb',
         
     | 
| 
       6 
     | 
    
         
            -
              Workarea::Monitoring::MongoidCheck.new
         
     | 
| 
      
 6 
     | 
    
         
            +
              Workarea::Monitoring::MongoidCheck.new,
         
     | 
| 
      
 7 
     | 
    
         
            +
              :critical
         
     | 
| 
       7 
8 
     | 
    
         
             
            )
         
     | 
| 
       8 
9 
     | 
    
         | 
| 
       9 
10 
     | 
    
         
             
            #
         
     | 
| 
         @@ -11,7 +12,8 @@ Easymon::Repository.add( 
     | 
|
| 
       11 
12 
     | 
    
         
             
            #
         
     | 
| 
       12 
13 
     | 
    
         
             
            Easymon::Repository.add(
         
     | 
| 
       13 
14 
     | 
    
         
             
              'elasticsearch',
         
     | 
| 
       14 
     | 
    
         
            -
              Workarea::Monitoring::ElasticsearchCheck.new
         
     | 
| 
      
 15 
     | 
    
         
            +
              Workarea::Monitoring::ElasticsearchCheck.new,
         
     | 
| 
      
 16 
     | 
    
         
            +
              :critical
         
     | 
| 
       15 
17 
     | 
    
         
             
            )
         
     | 
| 
       16 
18 
     | 
    
         | 
| 
       17 
19 
     | 
    
         
             
            #
         
     | 
| 
         @@ -21,7 +23,8 @@ Easymon::Repository.add( 
     | 
|
| 
       21 
23 
     | 
    
         
             
              "redis",
         
     | 
| 
       22 
24 
     | 
    
         
             
              Easymon::RedisCheck.new(
         
     | 
| 
       23 
25 
     | 
    
         
             
                Workarea::Configuration::Redis.persistent.to_h
         
     | 
| 
       24 
     | 
    
         
            -
              )
         
     | 
| 
      
 26 
     | 
    
         
            +
              ),
         
     | 
| 
      
 27 
     | 
    
         
            +
              :critical
         
     | 
| 
       25 
28 
     | 
    
         
             
            )
         
     | 
| 
       26 
29 
     | 
    
         | 
| 
       27 
30 
     | 
    
         
             
            #
         
     | 
    
        data/lib/workarea/core/engine.rb
    CHANGED
    
    | 
         @@ -72,6 +72,13 @@ module Workarea 
     | 
|
| 
       72 
72 
     | 
    
         
             
                    Workarea::Warnings.check
         
     | 
| 
       73 
73 
     | 
    
         
             
                    Configuration::Session.validate!
         
     | 
| 
       74 
74 
     | 
    
         
             
                  end
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
                  config.to_prepare do
         
     | 
| 
      
 77 
     | 
    
         
            +
                    # For some reason, app/workers/workarea/bulk_index_products.rb doesn't
         
     | 
| 
      
 78 
     | 
    
         
            +
                    # get autoloaded. Without this, admin actions like updating product
         
     | 
| 
      
 79 
     | 
    
         
            +
                    # attributes raises a {NameError} "uninitialized constant BulkIndexProducts".
         
     | 
| 
      
 80 
     | 
    
         
            +
                    require_dependency 'workarea/bulk_index_products'
         
     | 
| 
      
 81 
     | 
    
         
            +
                  end
         
     | 
| 
       75 
82 
     | 
    
         
             
                end
         
     | 
| 
       76 
83 
     | 
    
         
             
              end
         
     | 
| 
       77 
84 
     | 
    
         
             
            end
         
     | 
    
        data/lib/workarea/version.rb
    CHANGED
    
    
| 
         @@ -3,27 +3,32 @@ require 'test_helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Workarea
         
     | 
| 
       4 
4 
     | 
    
         
             
              class MonitoringIntegrationTest < Workarea::IntegrationTest
         
     | 
| 
       5 
5 
     | 
    
         
             
                def test_monitors_the_mongodb_status
         
     | 
| 
       6 
     | 
    
         
            -
                  get workarea.easymon_path 
     | 
| 
      
 6 
     | 
    
         
            +
                  get workarea.easymon_path + '/mongodb'
         
     | 
| 
       7 
7 
     | 
    
         
             
                  assert_includes(response.body, 'Up')
         
     | 
| 
       8 
8 
     | 
    
         
             
                end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
                def test_monitors_the_redis_status
         
     | 
| 
       11 
     | 
    
         
            -
                  get workarea.easymon_path 
     | 
| 
      
 11 
     | 
    
         
            +
                  get workarea.easymon_path + '/redis'
         
     | 
| 
       12 
12 
     | 
    
         
             
                  assert_includes(response.body, 'Up')
         
     | 
| 
       13 
13 
     | 
    
         
             
                end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
                def test_monitors_the_elasticsearch_status
         
     | 
| 
       16 
     | 
    
         
            -
                  get workarea.easymon_path 
     | 
| 
      
 16 
     | 
    
         
            +
                  get workarea.easymon_path + '/elasticsearch'
         
     | 
| 
       17 
17 
     | 
    
         
             
                  assert_includes(response.body, 'Up')
         
     | 
| 
       18 
18 
     | 
    
         
             
                end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
                def test_monitors_the_sidekiq_queue_status
         
     | 
| 
       21 
     | 
    
         
            -
                  get workarea.easymon_path 
     | 
| 
      
 21 
     | 
    
         
            +
                  get workarea.easymon_path + '/sidekiq-queue'
         
     | 
| 
       22 
22 
     | 
    
         
             
                  assert_includes(response.body, 'Low')
         
     | 
| 
       23 
23 
     | 
    
         
             
                end
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
                def test_monitors_for_load_balancing
         
     | 
| 
       26 
     | 
    
         
            -
                  get workarea.easymon_path 
     | 
| 
      
 26 
     | 
    
         
            +
                  get workarea.easymon_path + '/load-balancing'
         
     | 
| 
      
 27 
     | 
    
         
            +
                  assert_includes(response.body, 'Up')
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                def test_critical_endpoint
         
     | 
| 
      
 31 
     | 
    
         
            +
                  get workarea.easymon_path + "/critical"
         
     | 
| 
       27 
32 
     | 
    
         
             
                  assert_includes(response.body, 'Up')
         
     | 
| 
       28 
33 
     | 
    
         
             
                end
         
     | 
| 
       29 
34 
     | 
    
         
             
              end
         
     | 
| 
         @@ -10,6 +10,21 @@ module Workarea 
     | 
|
| 
       10 
10 
     | 
    
         
             
                    model.update!(active: true)
         
     | 
| 
       11 
11 
     | 
    
         
             
                    assert(Storefront.new(model).active[:now])
         
     | 
| 
       12 
12 
     | 
    
         
             
                  end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  def test_changesets
         
     | 
| 
      
 15 
     | 
    
         
            +
                    category = create_category(
         
     | 
| 
      
 16 
     | 
    
         
            +
                      name: 'Foo',
         
     | 
| 
      
 17 
     | 
    
         
            +
                      product_rules: [{ name: 'search', operator: 'equals', value: 'foo' }]
         
     | 
| 
      
 18 
     | 
    
         
            +
                    )
         
     | 
| 
      
 19 
     | 
    
         
            +
                    assert_empty(Storefront.new(category).changesets)
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                    release = create_release
         
     | 
| 
      
 22 
     | 
    
         
            +
                    release.as_current { category.update!(name: 'Bar') }
         
     | 
| 
      
 23 
     | 
    
         
            +
                    assert_equal(1, Storefront.new(category).changesets.size)
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                    release.as_current { category.product_rules.first.update!(value: 'bar') }
         
     | 
| 
      
 26 
     | 
    
         
            +
                    assert_equal(2, Storefront.new(category).changesets.size)
         
     | 
| 
      
 27 
     | 
    
         
            +
                  end
         
     | 
| 
       13 
28 
     | 
    
         
             
                end
         
     | 
| 
       14 
29 
     | 
    
         
             
              end
         
     | 
| 
       15 
30 
     | 
    
         
             
            end
         
     | 
| 
         @@ -410,6 +410,21 @@ module Workarea 
     | 
|
| 
       410 
410 
     | 
    
         
             
                    assert(result[:raw].present?)
         
     | 
| 
       411 
411 
     | 
    
         
             
                    assert_kind_of(Float, result[:raw]['_score'])
         
     | 
| 
       412 
412 
     | 
    
         
             
                  end
         
     | 
| 
      
 413 
     | 
    
         
            +
             
     | 
| 
      
 414 
     | 
    
         
            +
                  def test_previewing_releases
         
     | 
| 
      
 415 
     | 
    
         
            +
                    product = create_product(id: 'foo', variants: [{ sku: '1234', regular: 5 }])
         
     | 
| 
      
 416 
     | 
    
         
            +
                    pricing = Pricing::Sku.find('1234')
         
     | 
| 
      
 417 
     | 
    
         
            +
                    assert_equal([product], ProductSearch.new(q: '*').results.pluck(:model))
         
     | 
| 
      
 418 
     | 
    
         
            +
             
     | 
| 
      
 419 
     | 
    
         
            +
                    release = create_release
         
     | 
| 
      
 420 
     | 
    
         
            +
                    release.as_current { pricing.prices.first.update!(regular: 10) }
         
     | 
| 
      
 421 
     | 
    
         
            +
                    IndexProduct.perform(product.reload)
         
     | 
| 
      
 422 
     | 
    
         
            +
             
     | 
| 
      
 423 
     | 
    
         
            +
                    assert_equal([product], ProductSearch.new(q: '*').results.pluck(:model))
         
     | 
| 
      
 424 
     | 
    
         
            +
                    release.as_current do
         
     | 
| 
      
 425 
     | 
    
         
            +
                      assert_equal([product], ProductSearch.new(q: '*').results.pluck(:model))
         
     | 
| 
      
 426 
     | 
    
         
            +
                    end
         
     | 
| 
      
 427 
     | 
    
         
            +
                  end
         
     | 
| 
       413 
428 
     | 
    
         
             
                end
         
     | 
| 
       414 
429 
     | 
    
         
             
              end
         
     | 
| 
       415 
430 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: workarea-core
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 3.5. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.5.8
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Ben Crouse
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2020-03- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2020-03-31 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -2718,7 +2718,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       2718 
2718 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       2719 
2719 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       2720 
2720 
     | 
    
         
             
            requirements: []
         
     | 
| 
       2721 
     | 
    
         
            -
            rubygems_version: 3.0. 
     | 
| 
      
 2721 
     | 
    
         
            +
            rubygems_version: 3.0.3
         
     | 
| 
       2722 
2722 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       2723 
2723 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       2724 
2724 
     | 
    
         
             
            summary: Core of the Workarea Commerce Platform
         
     |