toxiproxy 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87ada93994d565f7179ecf9b542e20d98c0e8d0a147ebb96ad9a6db91a1af343
4
- data.tar.gz: 2f4a626ed0b4db30f596963485749b22a754695bea9d94de3ee872f233eaae1d
3
+ metadata.gz: d135ce7e35507ad08017ae28db7f7543f9c0d0a29cd32042c9c61d072bee5eee
4
+ data.tar.gz: 8db56acdadcac8ac84b5b1be31a235cd7715422ff4cee1a36e3832eb983355f8
5
5
  SHA512:
6
- metadata.gz: e95bfdfa0351fad12ea9b5baf9020ec34bb1948e3d1d97afa9dcc1fc231d15520b1b937a493a7e3a87bdb4ec8e7f42234e22f5318c8fc564ceb7dd8bc7609348
7
- data.tar.gz: 944defb2bfee5378844b38a51400164be70f0ee39806d6f5cded3585ddd61ac6f4bb75229786f948bd5b3afc35a437d09c326575f0ac4e89f24a7f880f2badc9
6
+ metadata.gz: adee5993b439b3227b67ec4ca28fecdb8c7194d9b640e369df77f60a754d42bf20d758eaa8ca2a11a553451d7bd63654d14b0a03781fcc07751a5f5e947d524b
7
+ data.tar.gz: 1d69a13027507acc7791ac0904e70b1a02bd6f5bd4bad55e2724b6cc6e0d9f19e0e949c05d49f5ef7313e80193cfe898c3b2950c5124c41277412254b5895144
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # toxiproxy-ruby
2
2
 
3
- `toxiproxy-ruby` `1.x` (latest) is compatible with the Toxiproxy `2.x` series.
3
+ `toxiproxy-ruby` `>= 1.x` is compatible with the Toxiproxy `2.x` series.
4
4
  `toxiproxy-ruby` `0.x` is compatible with the Toxiproxy `1.x` series.
5
5
 
6
6
  [Toxiproxy](https://github.com/shopify/toxiproxy) is a proxy to simulate network
@@ -1,3 +1,3 @@
1
1
  class Toxiproxy
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
data/lib/toxiproxy.rb CHANGED
@@ -68,6 +68,8 @@ class Toxiproxy
68
68
  # Sets the toxiproxy host to use.
69
69
  def self.host=(host)
70
70
  @uri = host.is_a?(::URI) ? host : ::URI.parse(host)
71
+ reset_http_client!
72
+ @uri
71
73
  end
72
74
 
73
75
  # Convenience method to create a proxy.
@@ -223,6 +225,15 @@ class Toxiproxy
223
225
  }
224
226
  end
225
227
 
228
+ def self.reset_http_client!
229
+ if defined? @http
230
+ @http.finish() if @http && @http.started?
231
+ @http = nil
232
+ end
233
+
234
+ @http
235
+ end
236
+
226
237
  private
227
238
 
228
239
  def self.http_request(request)
@@ -453,6 +453,15 @@ class ToxiproxyTest < MiniTest::Unit::TestCase
453
453
  end
454
454
  end
455
455
 
456
+ def test_invalidate_cache_http_on_host
457
+ old_value = Toxiproxy.uri
458
+ assert_equal 8474, Toxiproxy.http.port
459
+ Toxiproxy.host = "http://127.0.0.1:8475"
460
+ assert_equal 8475, Toxiproxy.http.port
461
+ ensure
462
+ Toxiproxy.host = old_value
463
+ end
464
+
456
465
  private
457
466
 
458
467
  def with_webmock_enabled
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: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Eskildsen
@@ -9,91 +9,29 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-10-27 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: bundler
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: '0'
21
- type: :development
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- version: '0'
28
- - !ruby/object:Gem::Dependency
29
- name: minitest
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: '0'
35
- type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: '0'
42
- - !ruby/object:Gem::Dependency
43
- name: rake
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ">="
47
- - !ruby/object:Gem::Version
48
- version: '0'
49
- type: :development
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: '0'
56
- - !ruby/object:Gem::Dependency
57
- name: webmock
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: '0'
63
- type: :development
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: '0'
12
+ date: 2022-03-15 00:00:00.000000000 Z
13
+ dependencies: []
70
14
  description: A Ruby library for controlling Toxiproxy. Can be used in resiliency testing.
71
- email: simon.eskildsen@shopify.com
15
+ email: opensource@shopify.com
72
16
  executables: []
73
17
  extensions: []
74
18
  extra_rdoc_files: []
75
19
  files:
76
- - ".github/probots.yml"
77
- - ".github/workflows/ci.yml"
78
- - ".gitignore"
79
- - Gemfile
80
20
  - LICENSE
81
21
  - README.md
82
- - Rakefile
83
- - bin/start-toxiproxy.sh
84
22
  - lib/toxiproxy.rb
85
23
  - lib/toxiproxy/proxy_collection.rb
86
24
  - lib/toxiproxy/toxic.rb
87
25
  - lib/toxiproxy/toxic_collection.rb
88
26
  - lib/toxiproxy/version.rb
89
- - shipit.rubygems.yml
90
27
  - test/test_helper.rb
91
28
  - test/toxiproxy_test.rb
92
- - toxiproxy.gemspec
93
29
  homepage: https://github.com/Shopify/toxiproxy
94
30
  licenses:
95
31
  - MIT
96
32
  metadata:
33
+ homepage_uri: https://github.com/Shopify/toxiproxy
34
+ documentation_uri: https://github.com/Shopify/toxiproxy-ruby
97
35
  allowed_push_host: https://rubygems.org
98
36
  post_install_message:
99
37
  rdoc_options: []
@@ -110,8 +48,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
48
  - !ruby/object:Gem::Version
111
49
  version: '0'
112
50
  requirements: []
113
- rubygems_version: 3.0.3
51
+ rubygems_version: 3.2.20
114
52
  signing_key:
115
53
  specification_version: 4
116
54
  summary: Ruby library for Toxiproxy
117
- test_files: []
55
+ test_files:
56
+ - test/test_helper.rb
57
+ - test/toxiproxy_test.rb
data/.github/probots.yml DELETED
@@ -1,2 +0,0 @@
1
- enabled:
2
- - cla
@@ -1,19 +0,0 @@
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/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- vendor/
2
- .bundle
3
- Gemfile.lock
4
- *.gem
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source "https://rubygems.org"
2
- gemspec
3
-
data/Rakefile DELETED
@@ -1,12 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- desc 'Default: run unit tests.'
5
- task :default => :test
6
-
7
- Rake::TestTask.new(:test) do |t|
8
- t.libs << 'lib'
9
- t.libs << 'test'
10
- t.pattern = 'test/*_test.rb'
11
- t.verbose = true
12
- end
@@ -1,17 +0,0 @@
1
- #!/bin/bash -e
2
-
3
- VERSION='v2.1.0'
4
- TOXIPROXY_LOG_DIR=${CIRCLE_ARTIFACTS:-'/tmp'}
5
-
6
- if [[ "$OSTYPE" == "linux"* ]]; then
7
- DOWNLOAD_TYPE="linux-amd64"
8
- elif [[ "$OSTYPE" == "darwin"* ]]; then
9
- DOWNLOAD_TYPE="darwin-amd64"
10
- fi
11
-
12
- echo "[dowload toxiproxy for $DOWNLOAD_TYPE]"
13
- curl --silent -L https://github.com/Shopify/toxiproxy/releases/download/$VERSION/toxiproxy-server-$DOWNLOAD_TYPE -o ./bin/toxiproxy-server
14
-
15
- echo "[start toxiproxy]"
16
- chmod +x ./bin/toxiproxy-server
17
- nohup bash -c "./bin/toxiproxy-server > ${TOXIPROXY_LOG_DIR}/toxiproxy.log 2>&1 &"
data/shipit.rubygems.yml DELETED
@@ -1,2 +0,0 @@
1
- fetch:
2
- - fetch-gem-version toxiproxy Shopify/toxiproxy-ruby
data/toxiproxy.gemspec DELETED
@@ -1,23 +0,0 @@
1
- require File.expand_path("../lib/toxiproxy/version", __FILE__)
2
-
3
- Gem::Specification.new do |spec|
4
- spec.name = "toxiproxy"
5
- spec.version = Toxiproxy::VERSION
6
- spec.authors = ["Simon Eskildsen", "Jacob Wirth"]
7
- spec.email = "simon.eskildsen@shopify.com"
8
- spec.summary = "Ruby library for Toxiproxy"
9
- spec.description = "A Ruby library for controlling Toxiproxy. Can be used in resiliency testing."
10
- spec.homepage = "https://github.com/Shopify/toxiproxy"
11
- spec.license = "MIT"
12
-
13
- spec.metadata['allowed_push_host'] = 'https://rubygems.org'
14
-
15
- spec.files = `git ls-files`.split("\n")
16
- spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
- spec.require_paths = ["lib"]
18
-
19
- spec.add_development_dependency "bundler"
20
- spec.add_development_dependency "minitest"
21
- spec.add_development_dependency "rake"
22
- spec.add_development_dependency "webmock"
23
- end