fbe 0.0.25 → 0.0.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -0
- data/lib/fbe/octo.rb +7 -4
- data/lib/fbe.rb +1 -1
- data/test/fbe/test_octo.rb +12 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b7ed70e3e3d37780d727b9c269cd27a86179da0df8b781eb2cc8a339e443ac5
|
4
|
+
data.tar.gz: 9635ce676a24efc7e63567d0b370588a4b8af12de34cbcc65bb5718991658c8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5dfd3ace2f914dc4fa31869a743b41fd56851419f32e2d0b1077b1517b9faa9e8829ecc2c545653162161c0722856019ea112411133ec7c79a065eb046f376b1
|
7
|
+
data.tar.gz: 87ffa308115144cf84cb725e084917473dce9ab3f73bca02dc2e231d160c74fb0a46cd4676791c0891d25b5406dc95f0313d08ffda13c8e6ff903fc625570798
|
data/Rakefile
CHANGED
data/lib/fbe/octo.rb
CHANGED
@@ -59,8 +59,11 @@ def Fbe.octo(options: $options, global: $global, loog: $loog)
|
|
59
59
|
stack = Faraday::RackBuilder.new do |builder|
|
60
60
|
builder.use(
|
61
61
|
Faraday::Retry::Middleware,
|
62
|
-
exceptions: Faraday::Retry::Middleware::DEFAULT_EXCEPTIONS + [Octokit::
|
63
|
-
max: 5,
|
62
|
+
exceptions: Faraday::Retry::Middleware::DEFAULT_EXCEPTIONS + [Octokit::Error],
|
63
|
+
max: 5,
|
64
|
+
interval: ENV['RACK_ENV'] == 'test' ? 0.1 : 10,
|
65
|
+
methods: [:get],
|
66
|
+
backoff_factor: 2
|
64
67
|
)
|
65
68
|
builder.use(Faraday::HttpCache, serializer: Marshal, shared_cache: false, logger: Loog::NULL)
|
66
69
|
builder.use(Octokit::Response::RaiseError)
|
@@ -142,7 +145,7 @@ class Fbe::FakeOctokit
|
|
142
145
|
}
|
143
146
|
end
|
144
147
|
|
145
|
-
def repository_workflow_runs(repo)
|
148
|
+
def repository_workflow_runs(repo, _opts = {})
|
146
149
|
{
|
147
150
|
total_count: 2,
|
148
151
|
workflow_runs: [
|
@@ -167,7 +170,7 @@ class Fbe::FakeOctokit
|
|
167
170
|
}
|
168
171
|
end
|
169
172
|
|
170
|
-
def releases(_repo)
|
173
|
+
def releases(_repo, _opts = {})
|
171
174
|
[
|
172
175
|
release('https://github...'),
|
173
176
|
release('https://gith')
|
data/lib/fbe.rb
CHANGED
data/test/fbe/test_octo.rb
CHANGED
@@ -80,6 +80,18 @@ class TestOcto < Minitest::Test
|
|
80
80
|
o.user('yegor256')
|
81
81
|
end
|
82
82
|
|
83
|
+
def test_retrying_on_error_response
|
84
|
+
WebMock.disable_net_connect!
|
85
|
+
global = {}
|
86
|
+
o = Fbe.octo(loog: Loog::NULL, global:, options: Judges::Options.new)
|
87
|
+
stub_request(:get, 'https://api.github.com/users/yegor256')
|
88
|
+
.to_return(status: 503)
|
89
|
+
.times(1)
|
90
|
+
.then
|
91
|
+
.to_return(status: 200, body: '{}')
|
92
|
+
o.user('yegor256')
|
93
|
+
end
|
94
|
+
|
83
95
|
def test_with_broken_token
|
84
96
|
skip # it's a "live" test, run it manually if you need it
|
85
97
|
WebMock.enable_net_connect!
|