From bbd7d5c27f81f46b06b324cffc96c44305e07da0 Mon Sep 17 00:00:00 2001 From: Maxime Orefice <morefice@gitlab.com> Date: Fri, 1 Jul 2022 09:54:33 +0200 Subject: [PATCH] Add spec to track artifact size when reading blob --- spec/models/concerns/ci/artifactable_spec.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spec/models/concerns/ci/artifactable_spec.rb b/spec/models/concerns/ci/artifactable_spec.rb index b27a4d0dcc1f4..6af244a5a0f8d 100644 --- a/spec/models/concerns/ci/artifactable_spec.rb +++ b/spec/models/concerns/ci/artifactable_spec.rb @@ -53,6 +53,15 @@ expect { |b| artifact.each_blob(&b) }.to raise_error(described_class::NotSupportedAdapterError) end end + + context 'pushes artifact_size to application context' do + let(:artifact) { create(:ci_job_artifact, :junit) } + + it 'logs artifact size', :aggregate_failures do + expect { |b| artifact.each_blob(&b) }.to yield_control.once + expect(Gitlab::ApplicationContext.current).to include("meta.artifact_size" => artifact.size) + end + end end context 'ActiveRecord scopes' do -- GitLab