nonnative 1.23.0 → 1.24.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +7 -2
- data/lib/nonnative/chaos_proxy.rb +1 -1
- data/lib/nonnative/configuration.rb +2 -1
- data/lib/nonnative/configuration_proxy.rb +2 -1
- data/lib/nonnative/configuration_server.rb +1 -1
- data/lib/nonnative/delay_socket_pair.rb +2 -1
- data/lib/nonnative/socket_pair.rb +4 -4
- data/lib/nonnative/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39dfda3ff344a41e06816d7f7cbc152a53d8b5bc98090113e1c79109ea2faf95
|
4
|
+
data.tar.gz: b1fbf5078dfa16d8fb89fc0699af0bebdc2a47473b455d71f3b7cd7bab390b8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a797cf86fe77a38f9ebb5fa78f0dd20f24ce9e91f5666ae0c264ce1a37c9e91bba4ff19389da82c5de6fa48099d0187b6789fa1abb296383a8a186280b3b8ab0
|
7
|
+
data.tar.gz: 7a559c54037a22f2b01c995787cac36a076b5afbd8c68a3f1c72ed9f50f4543ff73d060514ea747c4db6964348d568d0a38c222476a33fa8886919e10b8ca093
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -311,7 +311,10 @@ Nonnative.configure do |config|
|
|
311
311
|
config.server do |d|
|
312
312
|
d.proxy = {
|
313
313
|
type: 'chaos',
|
314
|
-
port: 20_000
|
314
|
+
port: 20_000,
|
315
|
+
options: {
|
316
|
+
delay: 5
|
317
|
+
}
|
315
318
|
}
|
316
319
|
end
|
317
320
|
end
|
@@ -327,13 +330,15 @@ servers:
|
|
327
330
|
proxy:
|
328
331
|
type: chaos
|
329
332
|
port: 20000
|
333
|
+
options:
|
334
|
+
delay: 5
|
330
335
|
```
|
331
336
|
|
332
337
|
##### Fault Injection
|
333
338
|
|
334
339
|
The `chaos` proxy allows you to simulate failures by injecting them. We currently support the following:
|
335
340
|
- `close_all` - Closes the socket as soon as it connects.
|
336
|
-
- `delay` - This delays the communication between the connection.
|
341
|
+
- `delay` - This delays the communication between the connection. Default is 2 secs can be configured through options.
|
337
342
|
- `invalid_data` - This takes the input and rearranges it to produce invalid data.
|
338
343
|
|
339
344
|
Setup it up programmatically:
|
@@ -47,7 +47,7 @@ module Nonnative
|
|
47
47
|
def perform_start
|
48
48
|
loop do
|
49
49
|
thread = Thread.start(tcp_server.accept) do |local_socket|
|
50
|
-
SocketPairFactory.create(read_state,
|
50
|
+
SocketPairFactory.create(read_state, service.proxy).connect(local_socket)
|
51
51
|
connections.delete(Thread.current.object_id)
|
52
52
|
end
|
53
53
|
thread.report_on_exception = false
|
@@ -3,7 +3,6 @@
|
|
3
3
|
module Nonnative
|
4
4
|
class ConfigurationServer
|
5
5
|
attr_accessor :name, :klass, :timeout, :port
|
6
|
-
|
7
6
|
attr_reader :proxy
|
8
7
|
|
9
8
|
def initialize
|
@@ -13,6 +12,7 @@ module Nonnative
|
|
13
12
|
def proxy=(value)
|
14
13
|
proxy.type = value[:type]
|
15
14
|
proxy.port = value[:port]
|
15
|
+
proxy.options = value[:options]
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
module Nonnative
|
4
4
|
class SocketPair
|
5
|
-
def initialize(
|
6
|
-
@
|
5
|
+
def initialize(proxy)
|
6
|
+
@proxy = proxy
|
7
7
|
end
|
8
8
|
|
9
9
|
def connect(local_socket)
|
@@ -22,10 +22,10 @@ module Nonnative
|
|
22
22
|
|
23
23
|
protected
|
24
24
|
|
25
|
-
attr_reader :
|
25
|
+
attr_reader :proxy
|
26
26
|
|
27
27
|
def create_remote_socket
|
28
|
-
::TCPSocket.new('0.0.0.0', port)
|
28
|
+
::TCPSocket.new('0.0.0.0', proxy.port)
|
29
29
|
end
|
30
30
|
|
31
31
|
def pipe(ready, socket1, socket2)
|
data/lib/nonnative/version.rb
CHANGED