README.md in toxiproxy-0.1.4 vs README.md in toxiproxy-1.0.0
- old
+ new
@@ -1,7 +1,10 @@
# toxiproxy-ruby
+`toxiproxy-ruby` `1.x` (latest) is compatible with the Toxiproxy `2.x` series.
+`toxiproxy-ruby` `0.x` is compatible with the Toxiproxy `1.x` series.
+
[Toxiproxy](https://github.com/shopify/toxiproxy) is a proxy to simulate network
and system conditions. The Ruby API aims to make it simple to write tests that
ensure your application behaves appropriately under harsh conditions. Before you
can use the Ruby library, you need to read the [Usage section of the Toxiproxy
README](https://github.com/shopify/toxiproxy#usage).
@@ -27,11 +30,11 @@
For example, to simulate 1000ms latency on a database server you can use the
`latency` toxic with the `latency` argument (see the Toxiproxy project for a
list of all toxics):
```ruby
-Toxiproxy[:mysql_master].downstream(:latency, latency: 1000).apply do
+Toxiproxy[:mysql_master].toxic(:latency, latency: 1000).apply do
Shop.first # this took at least 1s
end
```
You can also take an endpoint down for the duration of a block at the TCP level:
@@ -58,11 +61,12 @@
Toxiproxy[:cache].upstream(:latency, latency: 1000).apply do
Cache.get(:omg) # will take at least a second
end
```
-You can apply many toxics to many connections:
+By default the toxic is applied to the downstream connection, you can be
+explicit and chain them:
```ruby
Toxiproxy[/redis/].upstream(:slow_close, delay: 100).downstream(:latency, jitter: 300).apply do
# all redises are now slow at responding and closing
end
@@ -88,6 +92,11 @@
```
This will create the proxies passed, or replace the proxies if they already exist in Toxiproxy.
It's recommended to do this early as early in boot as possible, see the
[Toxiproxy README](https://github.com/shopify/toxiproxy#Usage). If you have many
-proxies, we recommend storing the Toxiproxy configs in a configuration file.
+proxies, we recommend storing the Toxiproxy configs in a configuration file and
+deserializing it into `Toxiproxy.populate`.
+
+If you're doing this in Rails, you may have to do this in `config/boot.rb` (as
+early in boot as possible) as older versions of `ActiveRecord` establish a
+database connection as soon as it's loaded.