test/toxiproxy_test.rb in toxiproxy-0.1.1 vs test/toxiproxy_test.rb in toxiproxy-0.1.2
- old
+ new
@@ -301,9 +301,56 @@
proxies.each do |proxy|
assert_proxy_available(proxy)
end
end
+ def test_populate_creates_proxies_update_listen
+ proxies = [{
+ name: "test_toxiproxy_populate1",
+ upstream: "localhost:3306",
+ listen: "localhost:22222",
+ },
+ ]
+
+ proxies = Toxiproxy.populate(proxies)
+
+ proxies = [{
+ name: "test_toxiproxy_populate1",
+ upstream: "localhost:3306",
+ listen: "localhost:22223",
+ },
+ ]
+
+ proxies = Toxiproxy.populate(proxies)
+
+ proxies.each do |proxy|
+ assert_proxy_available(proxy)
+ end
+ end
+
+ def test_populate_creates_proxies_update_upstream
+ proxies = [{
+ name: "test_toxiproxy_populate1",
+ upstream: "localhost:3306",
+ listen: "localhost:22222",
+ },
+ ]
+
+ proxies = Toxiproxy.populate(proxies)
+
+ proxies = [{
+ name: "test_toxiproxy_populate1",
+ upstream: "localhost:3307",
+ listen: "localhost:22222",
+ },
+ ]
+
+ proxies2 = Toxiproxy.populate(proxies)
+
+ assert_equal proxies.first[:upstream], proxies2.first.upstream
+ assert_proxy_available(proxies2.first)
+ end
+
private
def assert_proxy_available(proxy)
connect_to_proxy proxy
end