summaryrefslogtreecommitdiff
path: root/lib/rspec_flaky/flaky_example.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 18:18:33 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 18:18:33 +0000
commitf64a639bcfa1fc2bc89ca7db268f594306edfd7c (patch)
treea2c3c2ebcc3b45e596949db485d6ed18ffaacfa1 /lib/rspec_flaky/flaky_example.rb
parentbfbc3e0d6583ea1a91f627528bedc3d65ba4b10f (diff)
downloadgitlab-ce-f64a639bcfa1fc2bc89ca7db268f594306edfd7c.tar.gz
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc40
Diffstat (limited to 'lib/rspec_flaky/flaky_example.rb')
-rw-r--r--lib/rspec_flaky/flaky_example.rb38
1 files changed, 0 insertions, 38 deletions
diff --git a/lib/rspec_flaky/flaky_example.rb b/lib/rspec_flaky/flaky_example.rb
deleted file mode 100644
index da5dbf06bc9..00000000000
--- a/lib/rspec_flaky/flaky_example.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-# frozen_string_literal: true
-
-module RspecFlaky
- # This represents a flaky RSpec example and is mainly meant to be saved in a JSON file
- class FlakyExample < OpenStruct
- def initialize(example)
- if example.respond_to?(:example_id)
- super(
- example_id: example.example_id,
- file: example.file,
- line: example.line,
- description: example.description,
- last_attempts_count: example.attempts,
- flaky_reports: 0)
- else
- super
- end
- end
-
- def update_flakiness!(last_attempts_count: nil)
- self.first_flaky_at ||= Time.now
- self.last_flaky_at = Time.now
- self.flaky_reports += 1
- self.last_attempts_count = last_attempts_count if last_attempts_count
-
- if ENV['CI_PROJECT_URL'] && ENV['CI_JOB_ID']
- self.last_flaky_job = "#{ENV['CI_PROJECT_URL']}/-/jobs/#{ENV['CI_JOB_ID']}"
- end
- end
-
- def to_h
- super.merge(
- first_flaky_at: first_flaky_at,
- last_flaky_at: last_flaky_at,
- last_flaky_job: last_flaky_job)
- end
- end
-end