diff options
Diffstat (limited to 'qa/qa/resource/base.rb')
-rw-r--r-- | qa/qa/resource/base.rb | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/qa/qa/resource/base.rb b/qa/qa/resource/base.rb index ba1b581b100..6025dd6ec40 100644 --- a/qa/qa/resource/base.rb +++ b/qa/qa/resource/base.rb @@ -12,6 +12,8 @@ module QA NoValueError = Class.new(RuntimeError) + attr_reader :retrieved_from_cache + class << self # Initialize new instance of class without fabrication # @@ -81,7 +83,7 @@ module QA Support::FabricationTracker.start_fabrication result = yield.tap do fabrication_time = Time.now - start - fabrication_http_method = if resource.api_fabrication_http_method == :get + fabrication_http_method = if resource.api_fabrication_http_method == :get || resource.retrieved_from_cache if include?(Reusable) "Retrieved for reuse" else @@ -92,24 +94,28 @@ module QA end Support::FabricationTracker.save_fabrication(:"#{fabrication_method}_fabrication", fabrication_time) - Tools::TestResourceDataProcessor.collect( - resource: resource, - info: resource.identifier, - fabrication_method: fabrication_method, - fabrication_time: fabrication_time - ) + + unless resource.retrieved_from_cache + Tools::TestResourceDataProcessor.collect( + resource: resource, + info: resource.identifier, + fabrication_method: fabrication_method, + fabrication_time: fabrication_time + ) + end Runtime::Logger.info do msg = ["==#{'=' * parents.size}>"] msg << "#{fabrication_http_method} a #{Rainbow(name).black.bg(:white)}" msg << resource.identifier msg << "as a dependency of #{parents.last}" if parents.any? - msg << "via #{fabrication_method}" + msg << "via #{resource.retrieved_from_cache ? 'cache' : fabrication_method}" msg << "in #{fabrication_time.round(2)} seconds" msg.compact.join(' ') end end + Support::FabricationTracker.finish_fabrication result @@ -263,6 +269,8 @@ module QA end def log_having_both_api_result_and_block(name, api_value) + api_value = "[MASKED]" if name == :token + QA::Runtime::Logger.debug(<<~MSG.strip) <#{self.class}> Attribute #{name.inspect} has both API response `#{api_value}` and a block. API response will be picked. Block will be ignored. MSG |