Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-12-06 21:14:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-12-06 21:14:09 +0300
commita15c9bc9eb04dcee1369c5fd6248c6352915ad21 (patch)
tree3f40f6f76615d85a7bfa45d5b1045d2fbe22860f /qa
parent55242833f832095a6fcff00b1ccacbc5900ee52a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/resource/base.rb14
-rw-r--r--qa/spec/resource/base_spec.rb11
2 files changed, 22 insertions, 3 deletions
diff --git a/qa/qa/resource/base.rb b/qa/qa/resource/base.rb
index 26a2a668cc1..640d2a8f06e 100644
--- a/qa/qa/resource/base.rb
+++ b/qa/qa/resource/base.rb
@@ -80,11 +80,25 @@ module QA
Support::FabricationTracker.start_fabrication
result = yield.tap do
fabrication_time = Time.now - start
+ resource_identifier = begin
+ if resource.respond_to?(:username) && resource.username
+ "with username '#{resource.username}'"
+ elsif resource.respond_to?(:full_path) && resource.full_path
+ "with full_path '#{resource.full_path}'"
+ elsif resource.respond_to?(:name) && resource.name
+ "with name '#{resource.name}'"
+ elsif resource.respond_to?(:id) && resource.id
+ "with id '#{resource.id}'"
+ end
+ rescue QA::Resource::Base::NoValueError
+ nil
+ end
Support::FabricationTracker.save_fabrication(:"#{method}_fabrication", fabrication_time)
Runtime::Logger.debug do
msg = ["==#{'=' * parents.size}>"]
msg << "Built a #{name}"
+ msg << resource_identifier if resource_identifier
msg << "as a dependency of #{parents.last}" if parents.any?
msg << "via #{method}"
msg << "in #{fabrication_time} seconds"
diff --git a/qa/spec/resource/base_spec.rb b/qa/spec/resource/base_spec.rb
index b24ced9e310..2a26a479436 100644
--- a/qa/spec/resource/base_spec.rb
+++ b/qa/spec/resource/base_spec.rb
@@ -3,8 +3,9 @@
RSpec.describe QA::Resource::Base do
include QA::Support::Helpers::StubEnv
- let(:resource) { spy('resource') }
+ let(:resource) { spy('resource', username: 'qa') }
let(:location) { 'http://location' }
+ let(:log_regex) { %r{==> Built a MyResource with username 'qa' via #{method} in [\d.\-e]+ seconds+} }
shared_context 'with fabrication context' do
subject do
@@ -68,6 +69,8 @@ RSpec.describe QA::Resource::Base do
end
context "with debug log level" do
+ let(:method) { 'api' }
+
before do
allow(QA::Runtime::Logger).to receive(:debug)
end
@@ -78,7 +81,7 @@ RSpec.describe QA::Resource::Base do
subject.fabricate_via_api!('something', resource: resource, parents: [])
expect(QA::Runtime::Logger).to have_received(:debug) do |&msg|
- expect(msg.call).to match_regex(/==> Built a MyResource via api in [\d.\-e]+ seconds+/)
+ expect(msg.call).to match_regex(log_regex)
end
end
end
@@ -102,6 +105,8 @@ RSpec.describe QA::Resource::Base do
end
context "with debug log level" do
+ let(:method) { 'browser_ui' }
+
before do
allow(QA::Runtime::Logger).to receive(:debug)
end
@@ -112,7 +117,7 @@ RSpec.describe QA::Resource::Base do
subject.fabricate_via_browser_ui!('something', resource: resource, parents: [])
expect(QA::Runtime::Logger).to have_received(:debug) do |&msg|
- expect(msg.call).to match_regex(/==> Built a MyResource via browser_ui in [\d.\-e]+ seconds+/)
+ expect(msg.call).to match_regex(log_regex)
end
end
end