toxiproxy 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +1 -1
- data/bin/start-toxiproxy.sh +1 -1
- data/lib/toxiproxy.rb +6 -1
- data/lib/toxiproxy/version.rb +1 -1
- data/test/toxiproxy_test.rb +47 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07ea894e2ec459737f6d98f2673e3049e683c4a6
|
4
|
+
data.tar.gz: 5310b2f902eef3c7b468fb1d88df000b287bc943
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27251df5e59a5144ed162a220f401b431e5e68ece5376f3b67e1ae4aa0594609d6b8dcb0b8d1724a7a4f736cc73564d37cc9bd0880e05ba638da2b47e308c01f
|
7
|
+
data.tar.gz: cd8ad0b67da109706aba5ca9c6a4e70313217379f0db35e5899edd45a3c4cd286d6385f03812efe3f2371b2abdc4a7987601e0e381d235228743838447c1df74
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -82,7 +82,7 @@ Toxiproxy.populate([{
|
|
82
82
|
})
|
83
83
|
```
|
84
84
|
|
85
|
-
This will create the proxies passed, if they
|
85
|
+
This will create the proxies passed, or replace the proxies if they already exist in Toxiproxy.
|
86
86
|
It's recommended to do this early as early in boot as possible, see the
|
87
87
|
[Toxiproxy README](https://github.com/shopify/toxiproxy#Usage). If you have many
|
88
88
|
proxies, we recommend storing the Toxiproxy configs in a configuration file.
|
data/bin/start-toxiproxy.sh
CHANGED
data/lib/toxiproxy.rb
CHANGED
@@ -89,7 +89,12 @@ class Toxiproxy
|
|
89
89
|
proxies = proxies.first if proxies.first.is_a?(Array)
|
90
90
|
|
91
91
|
proxies.map { |proxy|
|
92
|
-
|
92
|
+
existing = find_by_name(proxy[:name])
|
93
|
+
if existing && (existing.upstream != proxy[:upstream] || existing.listen != proxy[:listen])
|
94
|
+
existing.destroy
|
95
|
+
existing = false
|
96
|
+
end
|
97
|
+
self.create(proxy) unless existing
|
93
98
|
}.compact
|
94
99
|
end
|
95
100
|
|
data/lib/toxiproxy/version.rb
CHANGED
data/test/toxiproxy_test.rb
CHANGED
@@ -303,6 +303,53 @@ class ToxiproxyTest < MiniTest::Unit::TestCase
|
|
303
303
|
end
|
304
304
|
end
|
305
305
|
|
306
|
+
def test_populate_creates_proxies_update_listen
|
307
|
+
proxies = [{
|
308
|
+
name: "test_toxiproxy_populate1",
|
309
|
+
upstream: "localhost:3306",
|
310
|
+
listen: "localhost:22222",
|
311
|
+
},
|
312
|
+
]
|
313
|
+
|
314
|
+
proxies = Toxiproxy.populate(proxies)
|
315
|
+
|
316
|
+
proxies = [{
|
317
|
+
name: "test_toxiproxy_populate1",
|
318
|
+
upstream: "localhost:3306",
|
319
|
+
listen: "localhost:22223",
|
320
|
+
},
|
321
|
+
]
|
322
|
+
|
323
|
+
proxies = Toxiproxy.populate(proxies)
|
324
|
+
|
325
|
+
proxies.each do |proxy|
|
326
|
+
assert_proxy_available(proxy)
|
327
|
+
end
|
328
|
+
end
|
329
|
+
|
330
|
+
def test_populate_creates_proxies_update_upstream
|
331
|
+
proxies = [{
|
332
|
+
name: "test_toxiproxy_populate1",
|
333
|
+
upstream: "localhost:3306",
|
334
|
+
listen: "localhost:22222",
|
335
|
+
},
|
336
|
+
]
|
337
|
+
|
338
|
+
proxies = Toxiproxy.populate(proxies)
|
339
|
+
|
340
|
+
proxies = [{
|
341
|
+
name: "test_toxiproxy_populate1",
|
342
|
+
upstream: "localhost:3307",
|
343
|
+
listen: "localhost:22222",
|
344
|
+
},
|
345
|
+
]
|
346
|
+
|
347
|
+
proxies2 = Toxiproxy.populate(proxies)
|
348
|
+
|
349
|
+
assert_equal proxies.first[:upstream], proxies2.first.upstream
|
350
|
+
assert_proxy_available(proxies2.first)
|
351
|
+
end
|
352
|
+
|
306
353
|
private
|
307
354
|
|
308
355
|
def assert_proxy_available(proxy)
|
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: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Eskildsen
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
fl3hbtVFTqbOlwL9vy1fudXcolIE/ZTcxQ+er07ZFZdKCXayR9PPs64heamfn0fp
|
32
32
|
TConQSX2BnZdhIEYW+cKzEC/bLc=
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2015-
|
34
|
+
date: 2015-05-11 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
metadata.gz.sig
CHANGED
Binary file
|