toxiproxy 1.0.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.github/probots.yml +2 -0
- data/.github/workflows/ci.yml +19 -0
- data/lib/toxiproxy.rb +17 -8
- data/lib/toxiproxy/version.rb +1 -1
- data/test/toxiproxy_test.rb +13 -8
- data/toxiproxy.gemspec +3 -1
- metadata +11 -10
- data/circle.yml +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 87ada93994d565f7179ecf9b542e20d98c0e8d0a147ebb96ad9a6db91a1af343
|
4
|
+
data.tar.gz: 2f4a626ed0b4db30f596963485749b22a754695bea9d94de3ee872f233eaae1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e95bfdfa0351fad12ea9b5baf9020ec34bb1948e3d1d97afa9dcc1fc231d15520b1b937a493a7e3a87bdb4ec8e7f42234e22f5318c8fc564ceb7dd8bc7609348
|
7
|
+
data.tar.gz: 944defb2bfee5378844b38a51400164be70f0ee39806d6f5cded3585ddd61ac6f4bb75229786f948bd5b3afc35a437d09c326575f0ac4e89f24a7f880f2badc9
|
data/.github/probots.yml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
name: Run tests
|
2
|
+
on: [push]
|
3
|
+
jobs:
|
4
|
+
test:
|
5
|
+
runs-on: ubuntu-latest
|
6
|
+
strategy:
|
7
|
+
matrix:
|
8
|
+
ruby: [ '2.5', '2.6', '2.7' ]
|
9
|
+
name: Ruby ${{ matrix.ruby }}
|
10
|
+
steps:
|
11
|
+
- uses: actions/checkout@v2
|
12
|
+
- uses: ruby/setup-ruby@v1
|
13
|
+
with:
|
14
|
+
ruby-version: ${{ matrix.ruby }}
|
15
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
16
|
+
- name: Install and start toxiproxy
|
17
|
+
run: ./bin/start-toxiproxy.sh
|
18
|
+
- name: Run tests
|
19
|
+
run: bundle exec rake test
|
data/lib/toxiproxy.rb
CHANGED
@@ -98,14 +98,23 @@ class Toxiproxy
|
|
98
98
|
def self.populate(*proxies)
|
99
99
|
proxies = proxies.first if proxies.first.is_a?(Array)
|
100
100
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
101
|
+
request = Net::HTTP::Post.new("/populate")
|
102
|
+
request.body = proxies.to_json
|
103
|
+
request["Content-Type"] = "application/json"
|
104
|
+
|
105
|
+
response = http_request(request)
|
106
|
+
assert_response(response)
|
107
|
+
|
108
|
+
proxies = JSON.parse(response.body).fetch('proxies', []).map do |attrs|
|
109
|
+
self.new({
|
110
|
+
upstream: attrs["upstream"],
|
111
|
+
listen: attrs["listen"],
|
112
|
+
name: attrs["name"],
|
113
|
+
enabled: attrs["enabled"]
|
114
|
+
})
|
115
|
+
end
|
116
|
+
|
117
|
+
ProxyCollection.new(proxies)
|
109
118
|
end
|
110
119
|
|
111
120
|
def self.running?
|
data/lib/toxiproxy/version.rb
CHANGED
data/test/toxiproxy_test.rb
CHANGED
@@ -358,26 +358,31 @@ class ToxiproxyTest < MiniTest::Unit::TestCase
|
|
358
358
|
end
|
359
359
|
|
360
360
|
def test_populate_creates_proxies_update_upstream
|
361
|
-
|
362
|
-
|
361
|
+
proxy_name = "test_toxiproxy_populate1"
|
362
|
+
proxies_config = [{
|
363
|
+
name: proxy_name,
|
363
364
|
upstream: "localhost:3306",
|
364
365
|
listen: "localhost:22222",
|
365
366
|
},
|
366
367
|
]
|
367
368
|
|
368
|
-
proxies = Toxiproxy.populate(
|
369
|
+
proxies = Toxiproxy.populate(proxies_config)
|
369
370
|
|
370
|
-
|
371
|
-
name:
|
371
|
+
proxies_config = [{
|
372
|
+
name: proxy_name,
|
372
373
|
upstream: "localhost:3307",
|
373
374
|
listen: "localhost:22222",
|
374
375
|
},
|
375
376
|
]
|
376
377
|
|
377
|
-
proxies2 = Toxiproxy.populate(
|
378
|
+
proxies2 = Toxiproxy.populate(proxies_config)
|
379
|
+
|
380
|
+
refute_equal proxies.find(name: proxy_name).first.upstream,
|
381
|
+
proxies2.find(name: proxy_name).first.upstream
|
378
382
|
|
379
|
-
|
380
|
-
|
383
|
+
proxies2.each do |proxy|
|
384
|
+
assert_proxy_available(proxy)
|
385
|
+
end
|
381
386
|
end
|
382
387
|
|
383
388
|
def test_running_helper
|
data/toxiproxy.gemspec
CHANGED
@@ -10,11 +10,13 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.homepage = "https://github.com/Shopify/toxiproxy"
|
11
11
|
spec.license = "MIT"
|
12
12
|
|
13
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
14
|
+
|
13
15
|
spec.files = `git ls-files`.split("\n")
|
14
16
|
spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
15
17
|
spec.require_paths = ["lib"]
|
16
18
|
|
17
|
-
spec.add_development_dependency "bundler"
|
19
|
+
spec.add_development_dependency "bundler"
|
18
20
|
spec.add_development_dependency "minitest"
|
19
21
|
spec.add_development_dependency "rake"
|
20
22
|
spec.add_development_dependency "webmock"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toxiproxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Eskildsen
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-10-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '0'
|
21
21
|
type: :development
|
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: '0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: minitest
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,13 +73,14 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
+
- ".github/probots.yml"
|
77
|
+
- ".github/workflows/ci.yml"
|
76
78
|
- ".gitignore"
|
77
79
|
- Gemfile
|
78
80
|
- LICENSE
|
79
81
|
- README.md
|
80
82
|
- Rakefile
|
81
83
|
- bin/start-toxiproxy.sh
|
82
|
-
- circle.yml
|
83
84
|
- lib/toxiproxy.rb
|
84
85
|
- lib/toxiproxy/proxy_collection.rb
|
85
86
|
- lib/toxiproxy/toxic.rb
|
@@ -92,7 +93,8 @@ files:
|
|
92
93
|
homepage: https://github.com/Shopify/toxiproxy
|
93
94
|
licenses:
|
94
95
|
- MIT
|
95
|
-
metadata:
|
96
|
+
metadata:
|
97
|
+
allowed_push_host: https://rubygems.org
|
96
98
|
post_install_message:
|
97
99
|
rdoc_options: []
|
98
100
|
require_paths:
|
@@ -108,8 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
110
|
- !ruby/object:Gem::Version
|
109
111
|
version: '0'
|
110
112
|
requirements: []
|
111
|
-
|
112
|
-
rubygems_version: 2.6.14
|
113
|
+
rubygems_version: 3.0.3
|
113
114
|
signing_key:
|
114
115
|
specification_version: 4
|
115
116
|
summary: Ruby library for Toxiproxy
|