aranea 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rspec +3 -0
- data/.rubocop.yml +15 -0
- data/.travis.yml +26 -0
- data/CHANGELOG.md +14 -0
- data/Gemfile +4 -0
- data/MIT-LICENSE +19 -0
- data/README.md +124 -0
- data/aranea.gemspec +36 -0
- data/lib/aranea.rb +12 -2
- data/lib/aranea/failure_repository.rb +20 -33
- data/lib/aranea/faraday/aranea_middleware.rb +2 -8
- data/lib/aranea/rack/aranea_middleware.rb +19 -23
- data/lib/aranea/version.rb +3 -3
- metadata +41 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2744be4a620f72ecba9af9c7547b2436cccde77d9a96007167e40feba44487eb
|
4
|
+
data.tar.gz: 76a0e97b08d766d2fd3644d63e3e49f6c6019400db2af32f049304f543dd462a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e92d3166f8335b61cce5fa3b634cd1184742c081f7e777b6c1263da831eef9892286bf985fc3d77e156ca4f0aadbfcc6b1753123984c17783527166b08ea292a
|
7
|
+
data.tar.gz: '0598ac41d882147de25488ceadb78694573a84a74df5fd8d40b819327f2506e5defcf1619911d10fc378367eb80d5ead97d0c5fed43ac6af14622fa9ba031d78'
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
inherit_gem:
|
2
|
+
rubocop-mdsol: rubocop.yml
|
3
|
+
|
4
|
+
Layout/ArgumentAlignment:
|
5
|
+
EnforcedStyle: with_fixed_indentation
|
6
|
+
|
7
|
+
Layout/FirstHashElementIndentation:
|
8
|
+
EnforcedStyle: consistent
|
9
|
+
|
10
|
+
Style/FrozenStringLiteralComment:
|
11
|
+
Enabled: true
|
12
|
+
|
13
|
+
Style/StringLiterals:
|
14
|
+
Enabled: true
|
15
|
+
EnforcedStyle: double_quotes
|
data/.travis.yml
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
dist: focal
|
2
|
+
language: ruby
|
3
|
+
cache: bundler
|
4
|
+
|
5
|
+
rvm:
|
6
|
+
- 2.5
|
7
|
+
- 2.6
|
8
|
+
- 2.7
|
9
|
+
- 3.0
|
10
|
+
|
11
|
+
before_install:
|
12
|
+
- gem update --system --force -N > /dev/null && echo "Rubygems version $(gem --version)"
|
13
|
+
- gem install bundler --force -N && bundle --version
|
14
|
+
|
15
|
+
install: BUNDLE_JOBS=4 bundle install
|
16
|
+
|
17
|
+
script:
|
18
|
+
- bundle exec rubocop
|
19
|
+
- bundle exec rspec
|
20
|
+
|
21
|
+
deploy:
|
22
|
+
edge: true # opt in to dpl v2
|
23
|
+
provider: rubygems
|
24
|
+
on:
|
25
|
+
tags: true
|
26
|
+
condition: $TRAVIS_RUBY_VERSION == 3.0
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# 0.1.0
|
2
|
+
- Require Ruby 2.5 and up.
|
3
|
+
- Require ActiveSupport 4.2 and up.
|
4
|
+
- Allow Faraday 1.x.
|
5
|
+
- Refresh code/specs and publish to rubygems.org.
|
6
|
+
|
7
|
+
# 0.0.3
|
8
|
+
- Added ability to specify the response body and response headers.
|
9
|
+
|
10
|
+
# 0.0.2
|
11
|
+
- Ability to raise Faraday::SSLError.
|
12
|
+
|
13
|
+
# 0.0.1
|
14
|
+
- Initial release.
|
data/Gemfile
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2015-2021 Medidata Solutions Worldwide
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
# Aranea
|
2
|
+
|
3
|
+
Aranea is a gem to use in fault-tolerance testing. It simulates a remote dependency failing, so that you can see how your project reacts.
|
4
|
+
|
5
|
+
In Dungeons and Dragons, an Aranea is a giant spider that will ambush a group of adventurers using its illusion powers, then immobilize the strongest member, forcing the others to battle without a key ally.
|
6
|
+
|
7
|
+
Aranea currently only works with Faraday clients.
|
8
|
+
|
9
|
+
## Activating Aranea in a Deployed Rails or Rack Application
|
10
|
+
|
11
|
+
If Aranea has already been set up and configured to run in your testing environment, you can switch it on via a POST request to `/disable`. For example, in your shell, you could write
|
12
|
+
|
13
|
+
```sh
|
14
|
+
curl -d "" https://myapp-sandbox.example.com/disable?dependency=google
|
15
|
+
```
|
16
|
+
|
17
|
+
Your app should return the message "For the next 5 minutes, all requests to urls containing 'google' will 500". You can then see how your app would behave if google were down, without the bother of having to actually DOS google.
|
18
|
+
|
19
|
+
You must specify a dependency. If you want *all* external requests to fail, set `dependency=.`. Any regular expression syntax will work, so if you want a subset of dependencies to fail, use a pipe-delimited list (`dependency=google|yahoo`).
|
20
|
+
|
21
|
+
You can override the duration of the test by specifying `minutes=` with a number from 1 to 60.
|
22
|
+
|
23
|
+
You can optionally specify the response body by setting `response=` and also the response header by setting `header=`. The endpoint to create a stubbed response uses query parameters, so your `response` and `header` fields must be URL encoded. For example, to return a response `{ "errors": "test_error" }`, you must send `response=%7B%20%22errors%22%3A%20%22test_error%22%20%7D`.
|
24
|
+
|
25
|
+
You can also override the simulated response code, if your app is meant to handle different failures differently. `?dependency=google&failure=404` will simulate a 404 (Not Found) response instead of a 500 (Internal Server Error). `?dependency=google&failure=timeout` will pretend the server never responded at all (although it will raise an error instantly; the illusion is not perfect).
|
26
|
+
|
27
|
+
### Sample calls and their effects
|
28
|
+
|
29
|
+
```
|
30
|
+
https://myapp-sandbox.example.com/disable?dependency=google
|
31
|
+
```
|
32
|
+
For the next 5 minutes, all requests to urls containing 'google' will 500.
|
33
|
+
|
34
|
+
---
|
35
|
+
|
36
|
+
```
|
37
|
+
https://myapp-sandbox.example.com/disable?dependency=.&failure=403
|
38
|
+
```
|
39
|
+
For the next 5 minutes, all external requests will 403.
|
40
|
+
|
41
|
+
---
|
42
|
+
|
43
|
+
```
|
44
|
+
https://myapp-sandbox.example.com/disable?dependency=sheep&failure=ssl_error
|
45
|
+
```
|
46
|
+
For the next 5 minutes, all external requests to urls containing `sheep` will raise a Faraday::SSLError.
|
47
|
+
|
48
|
+
---
|
49
|
+
|
50
|
+
```
|
51
|
+
https://myapp-sandbox.example.com/disable?dependency=google|yahoo&minutes=10
|
52
|
+
```
|
53
|
+
For the next 10 minutes, all requests to urls containing 'google' and/or 'yahoo' will 500.
|
54
|
+
|
55
|
+
---
|
56
|
+
|
57
|
+
```
|
58
|
+
https://myapp-sandbox.example.com/disable?dependency=google|yahoo&minutes=10&failure=timeout
|
59
|
+
```
|
60
|
+
For the next 10 minutes, all requests to urls containing 'google' and/or 'yahoo' will raise a Timeout error.
|
61
|
+
|
62
|
+
---
|
63
|
+
|
64
|
+
```
|
65
|
+
https://myapp-sandbox.example.com/disable?dependency=google|yahoo&minutes=10&failure=timeout&response=%7B%20%22errors%22%3A%20%22test_error%22%20%7D
|
66
|
+
```
|
67
|
+
Similar to the above example, except all external requests that match will now return `{ "errors": "test_error" }`.
|
68
|
+
|
69
|
+
---
|
70
|
+
|
71
|
+
```
|
72
|
+
https://myapp-sandbox.example.com/disable?dependency=google|yahoo&minutes=10&failure=timeout&response=%7B%20%22errors%22%3A%20%22test_error%22%20%7D&headers=%7B%20%22Content-Type%22%3A%20%22application%2Fjson%22%20%7D
|
73
|
+
```
|
74
|
+
Similar to the above example, except all external requests that match will now return `{ "errors": "test_error" }`, and will return the header `{ "Content-Type": "application/json" }`
|
75
|
+
|
76
|
+
## Activating Aranea Programmatically
|
77
|
+
|
78
|
+
From inside your application, you can run
|
79
|
+
|
80
|
+
```ruby
|
81
|
+
Aranea::Failure.create(
|
82
|
+
pattern: /google/,
|
83
|
+
minutes: 5,
|
84
|
+
failure: 503,
|
85
|
+
response_hash: { "errors": "test_error" },
|
86
|
+
response_headers_hash: { "Content-Type": "application/json" }
|
87
|
+
)
|
88
|
+
```
|
89
|
+
|
90
|
+
All parameters are required in this form. They may alternatively be provided as strings ('google','5').
|
91
|
+
|
92
|
+
## Adding Aranea To Your Project
|
93
|
+
|
94
|
+
In your Gemfile:
|
95
|
+
|
96
|
+
```ruby
|
97
|
+
gem "aranea", "~> 0.1"
|
98
|
+
```
|
99
|
+
|
100
|
+
In your Faraday middleware stack (wherever and however you configure it):
|
101
|
+
|
102
|
+
```ruby
|
103
|
+
use Aranea::Faraday::FailureSimulator
|
104
|
+
```
|
105
|
+
|
106
|
+
Similarly, in your Rack middleware stack:
|
107
|
+
|
108
|
+
```ruby
|
109
|
+
if ENV['USE_ARANEA']
|
110
|
+
use Aranea::Rack::FailureCreator
|
111
|
+
end
|
112
|
+
```
|
113
|
+
|
114
|
+
You'll want to ensure that Aranea (or at minimum the Rack middleware) is not active in production!
|
115
|
+
|
116
|
+
## Caveats and Limitations
|
117
|
+
|
118
|
+
Aranea needs to be included manually into every Faraday stack you have. If you miss one, or if you have a gem that makes http requests without using Faraday, your fault-tolerance test may falsely pass. Pull requests are welcome for compatibility with other http clients (aws-sdk is on the wishlist).
|
119
|
+
|
120
|
+
Failures are not necessarily shared between processes. Aranea will use `Rails.cache` if it exists and is available when it starts up, so if `Rails.cache` is shared between processes, a POST that hits one app worker will disable requests from all of them. But if you're not using Rails, your cache is in-memory, your cache is a file cache and your workers can be on different servers, or something else goes wrong, then some requests are likely to get through. In particular, jobs executed in the background may not hit the failure, even if they execute within the specified time frame.
|
121
|
+
|
122
|
+
## Owners
|
123
|
+
|
124
|
+
Aranea is (c) Medidata Solutions Worldwide and owned by whoever committed to it most recently. Original concept by Matthew Szenher.
|
data/aranea.gemspec
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/aranea/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "aranea"
|
7
|
+
s.version = Aranea::VERSION
|
8
|
+
s.authors = ["Aaron Weiner", "Matthew Szenher"]
|
9
|
+
s.email = s.authors.map { |name| name.sub(/(.).* (.*)/, '\1\2@mdsol.com') }
|
10
|
+
s.homepage = "https://github.com/mdsol/aranea"
|
11
|
+
s.summary = "Middleware for fault tolerance testing"
|
12
|
+
s.description = "Rack and Faraday middleware to temporarily disable connections to external dependencies"
|
13
|
+
s.license = "MIT"
|
14
|
+
|
15
|
+
s.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
16
|
+
|
17
|
+
s.metadata["homepage_uri"] = s.homepage
|
18
|
+
s.metadata["source_code_uri"] = s.homepage
|
19
|
+
s.metadata["changelog_uri"] = "#{s.homepage}/blob/master/CHANGELOG.md"
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
s.files = Dir.chdir(File.expand_path(__dir__)) do
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
25
|
+
end
|
26
|
+
s.require_paths = ["lib"]
|
27
|
+
|
28
|
+
s.add_dependency "activesupport", ">= 4.2"
|
29
|
+
s.add_dependency "faraday", ">= 0.9", "< 2.0"
|
30
|
+
s.add_dependency "rack"
|
31
|
+
|
32
|
+
s.add_development_dependency "pry-byebug"
|
33
|
+
s.add_development_dependency "rails"
|
34
|
+
s.add_development_dependency "rspec"
|
35
|
+
s.add_development_dependency "rubocop-mdsol", "~> 0.1"
|
36
|
+
end
|
data/lib/aranea.rb
CHANGED
@@ -1,2 +1,12 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/cache"
|
4
|
+
require "active_support/core_ext/numeric/time"
|
5
|
+
require "active_support/notifications"
|
6
|
+
require "faraday"
|
7
|
+
require "json"
|
8
|
+
require "rack"
|
9
|
+
|
10
|
+
require "aranea/failure_repository"
|
11
|
+
require "aranea/rack/aranea_middleware"
|
12
|
+
require "aranea/faraday/aranea_middleware"
|
@@ -1,33 +1,27 @@
|
|
1
|
-
|
2
|
-
require 'active_support/core_ext/numeric/time'
|
3
|
-
require 'json'
|
1
|
+
# frozen_string_literal: true
|
4
2
|
|
5
3
|
module Aranea
|
6
|
-
|
7
|
-
#
|
4
|
+
# TODO: Look into moving whitelisting of consumer hostnames to here and allowing it to be configurable
|
5
|
+
# via the consuming application
|
8
6
|
|
9
7
|
class Failure
|
10
|
-
|
11
8
|
class << self
|
12
|
-
|
13
9
|
def current
|
14
10
|
retrieve_failure || NullFailure.new
|
15
11
|
end
|
16
12
|
|
17
13
|
def create(params)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
14
|
+
failure = retrieve_failure
|
15
|
+
raise FailureFailure, "A failure is already in progress (#{failure})." if failure
|
16
|
+
|
17
|
+
failure = new(params)
|
18
|
+
Repository.store(failure, params[:minutes].minutes)
|
19
|
+
failure
|
25
20
|
end
|
26
21
|
|
27
22
|
def retrieve_failure
|
28
23
|
Repository.get
|
29
24
|
end
|
30
|
-
|
31
25
|
end
|
32
26
|
|
33
27
|
attr_accessor :expiration_date
|
@@ -39,15 +33,16 @@ module Aranea
|
|
39
33
|
@response_headers_hash = params[:response_headers_hash] || {}
|
40
34
|
end
|
41
35
|
|
42
|
-
def should_fail?(request_env,
|
36
|
+
def should_fail?(request_env, _app)
|
43
37
|
@pattern.match(request_env[:url].to_s)
|
44
38
|
end
|
45
39
|
|
46
40
|
def respond!
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
41
|
+
case @response
|
42
|
+
when "timeout"
|
43
|
+
raise ::Faraday::TimeoutError, "Fake failure from Aranea"
|
44
|
+
when "ssl_error"
|
45
|
+
raise ::Faraday::SSLError, "Fake failure from Aranea"
|
51
46
|
else
|
52
47
|
::Faraday::Response.new(
|
53
48
|
status: @response.to_i,
|
@@ -58,17 +53,15 @@ module Aranea
|
|
58
53
|
end
|
59
54
|
|
60
55
|
def to_s
|
61
|
-
"Failure on #{@pattern.inspect} ending at approximately
|
56
|
+
"Failure on #{@pattern.inspect} ending at approximately #{@expiration_date}"
|
62
57
|
end
|
63
58
|
|
64
|
-
#TODO: Actually implement Repository pattern, dependency injection and all.
|
59
|
+
# TODO: Actually implement Repository pattern, dependency injection and all.
|
65
60
|
# As is we only support sharing between multiple instances if Rails.cache exists and does
|
66
61
|
class Repository
|
67
|
-
|
68
|
-
KEY = 'aranea_current_failure'
|
62
|
+
KEY = "aranea_current_failure"
|
69
63
|
|
70
64
|
class << self
|
71
|
-
|
72
65
|
def store(failure, lifespan)
|
73
66
|
failure.expiration_date = Time.now + lifespan
|
74
67
|
cache.write(KEY, failure, expires_in: lifespan)
|
@@ -91,22 +84,16 @@ module Aranea
|
|
91
84
|
end
|
92
85
|
|
93
86
|
def memory_store
|
94
|
-
require
|
87
|
+
require "active_support/cache"
|
95
88
|
ActiveSupport::Cache::MemoryStore.new
|
96
89
|
end
|
97
|
-
|
98
90
|
end
|
99
|
-
|
100
91
|
end
|
101
|
-
|
102
92
|
end
|
103
93
|
|
104
94
|
class NullFailure
|
105
|
-
|
106
|
-
def should_fail?(request_env, app)
|
95
|
+
def should_fail?(_request_env, _app)
|
107
96
|
false
|
108
97
|
end
|
109
|
-
|
110
98
|
end
|
111
|
-
|
112
99
|
end
|
@@ -1,30 +1,24 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Aranea
|
4
4
|
module Faraday
|
5
|
-
|
6
5
|
class FailureSimulator
|
7
|
-
|
8
6
|
def initialize(app, config = {})
|
9
7
|
@app = app
|
10
8
|
@config = config
|
11
9
|
end
|
12
10
|
|
13
11
|
def call(request_env)
|
14
|
-
|
15
12
|
current_failure = Failure.current
|
16
13
|
|
17
14
|
if current_failure.should_fail?(request_env, @app)
|
18
|
-
#TODO: injectable logger
|
15
|
+
# TODO: injectable logger
|
19
16
|
puts "Aranea: simulating a failed call on #{request_env}"
|
20
17
|
current_failure.respond!
|
21
18
|
else
|
22
19
|
@app.call(request_env)
|
23
20
|
end
|
24
|
-
|
25
21
|
end
|
26
|
-
|
27
22
|
end
|
28
|
-
|
29
23
|
end
|
30
24
|
end
|
@@ -1,17 +1,12 @@
|
|
1
|
-
|
2
|
-
require 'rack'
|
3
|
-
require 'json'
|
1
|
+
# frozen_string_literal: true
|
4
2
|
|
5
3
|
module Aranea
|
6
|
-
|
7
4
|
FailureFailure = Class.new(RuntimeError)
|
8
5
|
|
9
|
-
ALLOWED_MINUTES = 1..60
|
6
|
+
ALLOWED_MINUTES = (1..60).freeze
|
10
7
|
|
11
8
|
module Rack
|
12
|
-
|
13
9
|
class FailureCreator
|
14
|
-
|
15
10
|
def initialize(app, config = {})
|
16
11
|
@app = app
|
17
12
|
@config = config
|
@@ -20,11 +15,11 @@ module Aranea
|
|
20
15
|
def call(env)
|
21
16
|
if failure_creation_request?(env)
|
22
17
|
response = begin
|
23
|
-
[create_failure(::Rack::Utils.parse_query(env[
|
18
|
+
[create_failure(::Rack::Utils.parse_query(env["QUERY_STRING"])), 201, {}]
|
24
19
|
rescue FailureFailure => e
|
25
20
|
[e.message, 422, {}]
|
26
|
-
rescue
|
27
|
-
[
|
21
|
+
rescue => e
|
22
|
+
[e.message, 500, {}]
|
28
23
|
end
|
29
24
|
::Rack::Response.new(*response).finish
|
30
25
|
else
|
@@ -32,18 +27,20 @@ module Aranea
|
|
32
27
|
end
|
33
28
|
end
|
34
29
|
|
35
|
-
|
30
|
+
protected
|
36
31
|
|
37
32
|
def failure_creation_request?(env)
|
38
|
-
env[
|
33
|
+
env["REQUEST_METHOD"] == "POST" && env["PATH_INFO"] == "/disable"
|
39
34
|
end
|
40
35
|
|
41
36
|
def create_failure(options)
|
42
|
-
dependency = options.fetch(
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
37
|
+
dependency = options.fetch("dependency") do
|
38
|
+
raise FailureFailure, "Please provide a dependency to simulate failing"
|
39
|
+
end
|
40
|
+
minutes = options.fetch("minutes", 5)
|
41
|
+
failure = options.fetch("failure", "500")
|
42
|
+
response = options.fetch("response", "{}") # Expect URI encoded
|
43
|
+
headers = options.fetch("headers", "{}")
|
47
44
|
|
48
45
|
# These will emit a parsing error if the response/headers URI encoded string is malformed.
|
49
46
|
response_hash = JSON.parse(CGI.unescape(response)).to_hash
|
@@ -54,7 +51,8 @@ module Aranea
|
|
54
51
|
end
|
55
52
|
|
56
53
|
unless ALLOWED_MINUTES.cover?(minutes.to_i)
|
57
|
-
raise FailureFailure,
|
54
|
+
raise FailureFailure,
|
55
|
+
"minutes should be an integer from #{ALLOWED_MINUTES.begin} to #{ALLOWED_MINUTES.end}, got #{minutes}"
|
58
56
|
end
|
59
57
|
|
60
58
|
Failure.create(
|
@@ -65,16 +63,14 @@ module Aranea
|
|
65
63
|
response_headers_hash: response_headers_hash
|
66
64
|
)
|
67
65
|
|
68
|
-
result = "For the next #{minutes} minutes, all requests to urls containing '#{dependency}'
|
66
|
+
result = "For the next #{minutes} minutes, all requests to urls containing '#{dependency}' " \
|
67
|
+
"will #{failure.downcase}"
|
69
68
|
|
70
|
-
#TODO: injectable logger
|
69
|
+
# TODO: injectable logger
|
71
70
|
puts "Aranea: #{result}"
|
72
71
|
|
73
72
|
result
|
74
|
-
|
75
73
|
end
|
76
|
-
|
77
74
|
end
|
78
|
-
|
79
75
|
end
|
80
76
|
end
|
data/lib/aranea/version.rb
CHANGED
metadata
CHANGED
@@ -1,46 +1,52 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aranea
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Weiner
|
8
8
|
- Matthew Szenher
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
date: 2021-04-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: activesupport
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '4.2'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '4.2'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
29
|
+
name: faraday
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '0'
|
34
|
+
version: '0.9'
|
35
|
+
- - "<"
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '2.0'
|
35
38
|
type: :runtime
|
36
39
|
prerelease: false
|
37
40
|
version_requirements: !ruby/object:Gem::Requirement
|
38
41
|
requirements:
|
39
42
|
- - ">="
|
40
43
|
- !ruby/object:Gem::Version
|
41
|
-
version: '0'
|
44
|
+
version: '0.9'
|
45
|
+
- - "<"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.0'
|
42
48
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
49
|
+
name: rack
|
44
50
|
requirement: !ruby/object:Gem::Requirement
|
45
51
|
requirements:
|
46
52
|
- - ">="
|
@@ -54,7 +60,7 @@ dependencies:
|
|
54
60
|
- !ruby/object:Gem::Version
|
55
61
|
version: '0'
|
56
62
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
63
|
+
name: pry-byebug
|
58
64
|
requirement: !ruby/object:Gem::Requirement
|
59
65
|
requirements:
|
60
66
|
- - ">="
|
@@ -68,7 +74,7 @@ dependencies:
|
|
68
74
|
- !ruby/object:Gem::Version
|
69
75
|
version: '0'
|
70
76
|
- !ruby/object:Gem::Dependency
|
71
|
-
name:
|
77
|
+
name: rails
|
72
78
|
requirement: !ruby/object:Gem::Requirement
|
73
79
|
requirements:
|
74
80
|
- - ">="
|
@@ -82,7 +88,7 @@ dependencies:
|
|
82
88
|
- !ruby/object:Gem::Version
|
83
89
|
version: '0'
|
84
90
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
91
|
+
name: rspec
|
86
92
|
requirement: !ruby/object:Gem::Requirement
|
87
93
|
requirements:
|
88
94
|
- - ">="
|
@@ -96,19 +102,19 @@ dependencies:
|
|
96
102
|
- !ruby/object:Gem::Version
|
97
103
|
version: '0'
|
98
104
|
- !ruby/object:Gem::Dependency
|
99
|
-
name:
|
105
|
+
name: rubocop-mdsol
|
100
106
|
requirement: !ruby/object:Gem::Requirement
|
101
107
|
requirements:
|
102
|
-
- - "
|
108
|
+
- - "~>"
|
103
109
|
- !ruby/object:Gem::Version
|
104
|
-
version: '0'
|
110
|
+
version: '0.1'
|
105
111
|
type: :development
|
106
112
|
prerelease: false
|
107
113
|
version_requirements: !ruby/object:Gem::Requirement
|
108
114
|
requirements:
|
109
|
-
- - "
|
115
|
+
- - "~>"
|
110
116
|
- !ruby/object:Gem::Version
|
111
|
-
version: '0'
|
117
|
+
version: '0.1'
|
112
118
|
description: Rack and Faraday middleware to temporarily disable connections to external
|
113
119
|
dependencies
|
114
120
|
email:
|
@@ -118,6 +124,15 @@ executables: []
|
|
118
124
|
extensions: []
|
119
125
|
extra_rdoc_files: []
|
120
126
|
files:
|
127
|
+
- ".gitignore"
|
128
|
+
- ".rspec"
|
129
|
+
- ".rubocop.yml"
|
130
|
+
- ".travis.yml"
|
131
|
+
- CHANGELOG.md
|
132
|
+
- Gemfile
|
133
|
+
- MIT-LICENSE
|
134
|
+
- README.md
|
135
|
+
- aranea.gemspec
|
121
136
|
- lib/aranea.rb
|
122
137
|
- lib/aranea/failure_repository.rb
|
123
138
|
- lib/aranea/faraday/aranea_middleware.rb
|
@@ -126,8 +141,11 @@ files:
|
|
126
141
|
homepage: https://github.com/mdsol/aranea
|
127
142
|
licenses:
|
128
143
|
- MIT
|
129
|
-
metadata:
|
130
|
-
|
144
|
+
metadata:
|
145
|
+
homepage_uri: https://github.com/mdsol/aranea
|
146
|
+
source_code_uri: https://github.com/mdsol/aranea
|
147
|
+
changelog_uri: https://github.com/mdsol/aranea/blob/master/CHANGELOG.md
|
148
|
+
post_install_message:
|
131
149
|
rdoc_options: []
|
132
150
|
require_paths:
|
133
151
|
- lib
|
@@ -135,15 +153,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
135
153
|
requirements:
|
136
154
|
- - ">="
|
137
155
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
156
|
+
version: 2.5.0
|
139
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
158
|
requirements:
|
141
159
|
- - ">="
|
142
160
|
- !ruby/object:Gem::Version
|
143
|
-
version:
|
161
|
+
version: '0'
|
144
162
|
requirements: []
|
145
|
-
rubygems_version: 3.2
|
146
|
-
signing_key:
|
163
|
+
rubygems_version: 3.1.2
|
164
|
+
signing_key:
|
147
165
|
specification_version: 4
|
148
166
|
summary: Middleware for fault tolerance testing
|
149
167
|
test_files: []
|