nonnative 1.85.1 → 1.87.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +6 -5
- data/README.md +27 -12
- data/lib/nonnative/configuration.rb +2 -2
- data/lib/nonnative/configuration_proxy.rb +2 -1
- data/lib/nonnative/configuration_runner.rb +1 -0
- data/lib/nonnative/cucumber.rb +0 -6
- data/lib/nonnative/fault_injection_proxy.rb +2 -0
- data/lib/nonnative/http_server.rb +10 -21
- data/lib/nonnative/proxy.rb +4 -0
- data/lib/nonnative/version.rb +1 -1
- data/lib/nonnative.rb +2 -8
- data/nonnative.gemspec +2 -1
- metadata +27 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d084e050131452576fb0716fa60f9ad641f8d18e50cf99c05d0f3e0c37742f58
|
4
|
+
data.tar.gz: dea87ac4b7b3c1d85bba7b1253d24191654fa3a7a338c54767716a85ff6b1123
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38c23a797f43a2193335fbcf50550311a0881de585d27af319935eeba9bb3e07e2f920c06004accd9cc3eada1079e374f5e9ffd6a51fcf238908b57ff04f3e42
|
7
|
+
data.tar.gz: e6e63b0ed16fb218b56d981e04577774128d52e0a281e6937eb5127beee7a180fdd0fc7fbbfa536e75e78570aaa1202b3f21a69b2669f83dc8b1933abe4518bf
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
|
7
7
|
## Unreleased
|
8
8
|
|
9
|
+
## [v1.87.0](https://github.com/alexfalkowski/nonnative/releases/tag/v1.87.0) - 2025-01-26
|
10
|
+
|
11
|
+
- [`c370c66`](https://github.com/alexfalkowski/nonnative/commit/c370c664ff1f6f83a8f2afe7075afd1b34bc333a) feat(proxy): add wait to the proxy, not globally (#493)
|
12
|
+
- [`39cc986`](https://github.com/alexfalkowski/nonnative/commit/39cc9867157c0d68ac78670e656b0aaa55773cfe) docs(readme): http app is a class not a instance (#492)
|
13
|
+
|
14
|
+
## [v1.86.0](https://github.com/alexfalkowski/nonnative/releases/tag/v1.86.0) - 2025-01-25
|
15
|
+
|
16
|
+
- [`9f3be69`](https://github.com/alexfalkowski/nonnative/commit/9f3be69130570a6842d6559c929fe6cb480dd1df) feat(http_server): use webrick (#490)
|
17
|
+
|
9
18
|
## [v1.85.1](https://github.com/alexfalkowski/nonnative/releases/tag/v1.85.1) - 2025-01-25
|
10
19
|
|
11
20
|
- [`14b648f`](https://github.com/alexfalkowski/nonnative/commit/14b648f96addc49163e14a22ae904f2fafec79ca) fix(socket_pair): handle nil from recv (#488)
|
data/Gemfile.lock
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nonnative (1.
|
4
|
+
nonnative (1.87.0)
|
5
5
|
concurrent-ruby (>= 1, < 2)
|
6
6
|
config (>= 5, < 6)
|
7
7
|
cucumber (>= 7, < 10)
|
8
8
|
get_process_mem (>= 1, < 2)
|
9
9
|
grpc (>= 1, < 2)
|
10
|
-
|
10
|
+
rackup (>= 2, < 3)
|
11
11
|
rest-client (>= 2, < 3)
|
12
12
|
rspec-benchmark (>= 0, < 1)
|
13
13
|
rspec-expectations (>= 3, < 4)
|
14
14
|
rspec-wait (>= 1, < 2)
|
15
15
|
sinatra (>= 4, < 5)
|
16
|
+
webrick (>= 1, < 2)
|
16
17
|
|
17
18
|
GEM
|
18
19
|
remote: https://rubygems.org/
|
@@ -98,15 +99,12 @@ GEM
|
|
98
99
|
mustermann (3.0.3)
|
99
100
|
ruby2_keywords (~> 0.0.1)
|
100
101
|
netrc (0.11.0)
|
101
|
-
nio4r (2.7.4)
|
102
102
|
ostruct (0.6.1)
|
103
103
|
parallel (1.26.3)
|
104
104
|
parser (3.3.7.0)
|
105
105
|
ast (~> 2.4.1)
|
106
106
|
racc
|
107
107
|
prism (1.3.0)
|
108
|
-
puma (6.5.0)
|
109
|
-
nio4r (~> 2.0)
|
110
108
|
racc (1.8.1)
|
111
109
|
rack (3.1.8)
|
112
110
|
rack-protection (4.1.1)
|
@@ -116,6 +114,8 @@ GEM
|
|
116
114
|
rack-session (2.1.0)
|
117
115
|
base64 (>= 0.1.0)
|
118
116
|
rack (>= 3.0.0)
|
117
|
+
rackup (2.2.1)
|
118
|
+
rack (>= 3)
|
119
119
|
rainbow (3.1.1)
|
120
120
|
rake (13.2.1)
|
121
121
|
rbs (3.8.1)
|
@@ -189,6 +189,7 @@ GEM
|
|
189
189
|
unicode-display_width (3.1.4)
|
190
190
|
unicode-emoji (~> 4.0, >= 4.0.4)
|
191
191
|
unicode-emoji (4.0.4)
|
192
|
+
webrick (1.9.1)
|
192
193
|
|
193
194
|
PLATFORMS
|
194
195
|
arm64-darwin-22
|
data/README.md
CHANGED
@@ -37,7 +37,6 @@ Configure nonnative with the following:
|
|
37
37
|
|
38
38
|
- The version of the configuration (1.0).
|
39
39
|
- The URL of the service.
|
40
|
-
- The time to wait on proxy changes (fault injection).
|
41
40
|
- Process, Server or Service that you want to start.
|
42
41
|
- A timeout value.
|
43
42
|
- A time to wait.
|
@@ -65,7 +64,6 @@ require 'nonnative'
|
|
65
64
|
Nonnative.configure do |config|
|
66
65
|
config.version = '1.0'
|
67
66
|
config.url = 'http://localhost:4567'
|
68
|
-
config.wait = 2.0
|
69
67
|
|
70
68
|
config.process do |p|
|
71
69
|
p.name = 'start_1'
|
@@ -96,13 +94,12 @@ Setup it up through configuration:
|
|
96
94
|
```yaml
|
97
95
|
version: "1.0"
|
98
96
|
url: http://localhost:4567
|
99
|
-
wait: 2.0
|
100
97
|
processes:
|
101
98
|
-
|
102
99
|
name: start_1
|
103
100
|
command: features/support/bin/start 12_321
|
104
101
|
timeout: 5
|
105
|
-
wait:
|
102
|
+
wait: 1
|
106
103
|
port: 12321
|
107
104
|
log: 12_321.log
|
108
105
|
signal: INT # Possible values are described in Signal.list.keys.
|
@@ -112,7 +109,7 @@ processes:
|
|
112
109
|
name: start_2
|
113
110
|
command: features/support/bin/start 12_322
|
114
111
|
timeout: 5
|
115
|
-
wait:
|
112
|
+
wait: 1
|
116
113
|
port: 12322
|
117
114
|
log: 12_322.log
|
118
115
|
```
|
@@ -141,21 +138,30 @@ Define your server:
|
|
141
138
|
|
142
139
|
```ruby
|
143
140
|
module Nonnative
|
144
|
-
class
|
145
|
-
def
|
146
|
-
|
141
|
+
class TCPServer < Nonnative::Server
|
142
|
+
def initialize(service)
|
143
|
+
super
|
144
|
+
|
145
|
+
@socket_server = ::TCPServer.new(proxy.host, proxy.port)
|
146
|
+
end
|
147
147
|
|
148
|
+
def perform_start
|
148
149
|
loop do
|
149
|
-
client_socket =
|
150
|
+
client_socket = socket_server.accept
|
150
151
|
client_socket.puts 'Hello World!'
|
151
152
|
client_socket.close
|
152
153
|
end
|
153
154
|
rescue StandardError
|
155
|
+
socket_server.close
|
154
156
|
end
|
155
157
|
|
156
158
|
def perform_stop
|
157
|
-
|
159
|
+
socket_server.close
|
158
160
|
end
|
161
|
+
|
162
|
+
private
|
163
|
+
|
164
|
+
attr_reader :socket_server
|
159
165
|
end
|
160
166
|
end
|
161
167
|
```
|
@@ -226,7 +232,7 @@ module Nonnative
|
|
226
232
|
module Features
|
227
233
|
class Application < Sinatra::Application
|
228
234
|
configure do
|
229
|
-
set :
|
235
|
+
set :logging, false
|
230
236
|
end
|
231
237
|
|
232
238
|
get '/hello' do
|
@@ -236,7 +242,7 @@ module Nonnative
|
|
236
242
|
|
237
243
|
class HTTPServer < Nonnative::HTTPServer
|
238
244
|
def app
|
239
|
-
Application
|
245
|
+
Application
|
240
246
|
end
|
241
247
|
end
|
242
248
|
end
|
@@ -380,6 +386,7 @@ Setup it up through configuration:
|
|
380
386
|
|
381
387
|
```yaml
|
382
388
|
version: "1.0"
|
389
|
+
url: http://localhost:4567
|
383
390
|
processes:
|
384
391
|
-
|
385
392
|
name: postgres
|
@@ -421,6 +428,7 @@ Nonnative.configure do |config|
|
|
421
428
|
kind: 'fault_injection',
|
422
429
|
port: 20_000,
|
423
430
|
log: 'proxy_server.log',
|
431
|
+
wait: 1,
|
424
432
|
options: {
|
425
433
|
delay: 5
|
426
434
|
}
|
@@ -440,6 +448,7 @@ processes:
|
|
440
448
|
kind: fault_injection
|
441
449
|
port: 20000
|
442
450
|
log: proxy_server.log
|
451
|
+
wait: 1
|
443
452
|
options:
|
444
453
|
delay: 5
|
445
454
|
```
|
@@ -460,6 +469,7 @@ Nonnative.configure do |config|
|
|
460
469
|
kind: 'fault_injection',
|
461
470
|
port: 20_000,
|
462
471
|
log: 'proxy_server.log',
|
472
|
+
wait: 1,
|
463
473
|
options: {
|
464
474
|
delay: 5
|
465
475
|
}
|
@@ -479,6 +489,7 @@ servers:
|
|
479
489
|
kind: fault_injection
|
480
490
|
port: 20000
|
481
491
|
log: proxy_server.log
|
492
|
+
wait: 1
|
482
493
|
options:
|
483
494
|
delay: 5
|
484
495
|
```
|
@@ -493,12 +504,14 @@ require 'nonnative'
|
|
493
504
|
Nonnative.configure do |config|
|
494
505
|
config.version = '1.0'
|
495
506
|
config.url = 'http://localhost:4567'
|
507
|
+
config.wait = 1
|
496
508
|
|
497
509
|
config.service do |s|
|
498
510
|
s.proxy = {
|
499
511
|
kind: 'fault_injection',
|
500
512
|
port: 20_000,
|
501
513
|
log: 'proxy_server.log',
|
514
|
+
wait: 1,
|
502
515
|
options: {
|
503
516
|
delay: 5
|
504
517
|
}
|
@@ -512,12 +525,14 @@ Setup it up through configuration:
|
|
512
525
|
```yaml
|
513
526
|
version: "1.0"
|
514
527
|
url: http://localhost:4567
|
528
|
+
wait: 1
|
515
529
|
services:
|
516
530
|
-
|
517
531
|
proxy:
|
518
532
|
kind: fault_injection
|
519
533
|
port: 20000
|
520
534
|
log: proxy_server.log
|
535
|
+
wait: 1
|
521
536
|
options:
|
522
537
|
delay: 5
|
523
538
|
```
|
@@ -8,14 +8,13 @@ module Nonnative
|
|
8
8
|
@services = []
|
9
9
|
end
|
10
10
|
|
11
|
-
attr_accessor :version, :url, :
|
11
|
+
attr_accessor :version, :url, :processes, :servers, :services
|
12
12
|
|
13
13
|
def load_file(path)
|
14
14
|
cfg = Nonnative.configurations(path)
|
15
15
|
|
16
16
|
self.version = cfg.version
|
17
17
|
self.url = cfg.url
|
18
|
-
self.wait = cfg.wait
|
19
18
|
|
20
19
|
add_processes(cfg)
|
21
20
|
add_servers(cfg)
|
@@ -122,6 +121,7 @@ module Nonnative
|
|
122
121
|
}
|
123
122
|
|
124
123
|
p[:host] = proxy.host if proxy.host
|
124
|
+
p[:wait] = proxy.wait if proxy.wait
|
125
125
|
|
126
126
|
runner.proxy = p
|
127
127
|
end
|
@@ -2,12 +2,13 @@
|
|
2
2
|
|
3
3
|
module Nonnative
|
4
4
|
class ConfigurationProxy
|
5
|
-
attr_accessor :kind, :host, :port, :log, :options
|
5
|
+
attr_accessor :kind, :host, :port, :log, :wait, :options
|
6
6
|
|
7
7
|
def initialize
|
8
8
|
self.kind = 'none'
|
9
9
|
self.host = '0.0.0.0'
|
10
10
|
self.port = 0
|
11
|
+
self.wait = 0.1
|
11
12
|
self.options = {}
|
12
13
|
end
|
13
14
|
end
|
data/lib/nonnative/cucumber.rb
CHANGED
@@ -23,22 +23,16 @@ end
|
|
23
23
|
Given('I set the proxy for process {string} to {string}') do |name, operation|
|
24
24
|
process = Nonnative.pool.process_by_name(name)
|
25
25
|
process.proxy.send(operation)
|
26
|
-
|
27
|
-
Nonnative.wait
|
28
26
|
end
|
29
27
|
|
30
28
|
Given('I set the proxy for server {string} to {string}') do |name, operation|
|
31
29
|
server = Nonnative.pool.server_by_name(name)
|
32
30
|
server.proxy.send(operation)
|
33
|
-
|
34
|
-
Nonnative.wait
|
35
31
|
end
|
36
32
|
|
37
33
|
Given('I set the proxy for service {string} to {string}') do |name, operation|
|
38
34
|
service = Nonnative.pool.service_by_name(name)
|
39
35
|
service.proxy.send(operation)
|
40
|
-
|
41
|
-
Nonnative.wait
|
42
36
|
end
|
43
37
|
|
44
38
|
Given('I start the system') do
|
@@ -3,12 +3,7 @@
|
|
3
3
|
module Nonnative
|
4
4
|
class HTTPServer < Nonnative::Server
|
5
5
|
def initialize(service)
|
6
|
-
|
7
|
-
options = {
|
8
|
-
log_writer: Puma::LogWriter.new(log, log),
|
9
|
-
force_shutdown_after: service.timeout
|
10
|
-
}
|
11
|
-
@server = Puma::Server.new(app, Puma::Events.new, options)
|
6
|
+
@server = ::Rackup::Handler.get('webrick')
|
12
7
|
|
13
8
|
super
|
14
9
|
end
|
@@ -16,24 +11,18 @@ module Nonnative
|
|
16
11
|
protected
|
17
12
|
|
18
13
|
def perform_start
|
19
|
-
|
20
|
-
|
14
|
+
file = File.open(service.log, 'a')
|
15
|
+
logs = [
|
16
|
+
[Logger.new(file), WEBrick::AccessLog::COMBINED_LOG_FORMAT]
|
17
|
+
]
|
18
|
+
|
19
|
+
server.run(app, Host: proxy.host, Port: proxy.port,
|
20
|
+
Logger: WEBrick::Log.new(file),
|
21
|
+
AccessLog: logs)
|
21
22
|
end
|
22
23
|
|
23
24
|
def perform_stop
|
24
|
-
server.
|
25
|
-
end
|
26
|
-
|
27
|
-
def wait_start
|
28
|
-
timeout.perform do
|
29
|
-
super while server.running == 0
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def wait_stop
|
34
|
-
timeout.perform do
|
35
|
-
super while server.running != 0
|
36
|
-
end
|
25
|
+
server.shutdown
|
37
26
|
end
|
38
27
|
|
39
28
|
private
|
data/lib/nonnative/proxy.rb
CHANGED
data/lib/nonnative/version.rb
CHANGED
data/lib/nonnative.rb
CHANGED
@@ -8,9 +8,8 @@ require 'securerandom'
|
|
8
8
|
|
9
9
|
require 'grpc'
|
10
10
|
require 'sinatra'
|
11
|
+
require 'rackup'
|
11
12
|
require 'rest-client'
|
12
|
-
require 'puma'
|
13
|
-
require 'puma/server'
|
14
13
|
require 'concurrent'
|
15
14
|
require 'config'
|
16
15
|
require 'cucumber'
|
@@ -18,6 +17,7 @@ require 'get_process_mem'
|
|
18
17
|
require 'rspec-benchmark'
|
19
18
|
require 'rspec/expectations'
|
20
19
|
require 'rspec/wait'
|
20
|
+
require 'webrick'
|
21
21
|
|
22
22
|
require 'nonnative/version'
|
23
23
|
require 'nonnative/error'
|
@@ -58,12 +58,6 @@ module Nonnative
|
|
58
58
|
class << self
|
59
59
|
attr_reader :pool
|
60
60
|
|
61
|
-
def wait
|
62
|
-
wait = Nonnative.configuration.wait
|
63
|
-
|
64
|
-
sleep wait if wait
|
65
|
-
end
|
66
|
-
|
67
61
|
def configurations(*files)
|
68
62
|
Config.load_files(files)
|
69
63
|
end
|
data/nonnative.gemspec
CHANGED
@@ -29,10 +29,11 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_dependency 'cucumber', '>= 7', '< 10'
|
30
30
|
spec.add_dependency 'get_process_mem', '>= 1', '< 2'
|
31
31
|
spec.add_dependency 'grpc', '>= 1', '< 2'
|
32
|
-
spec.add_dependency '
|
32
|
+
spec.add_dependency 'rackup', '>= 2', '< 3'
|
33
33
|
spec.add_dependency 'rest-client', '>= 2', '< 3'
|
34
34
|
spec.add_dependency 'rspec-benchmark', '>= 0', '< 1'
|
35
35
|
spec.add_dependency 'rspec-expectations', '>= 3', '< 4'
|
36
36
|
spec.add_dependency 'rspec-wait', '>= 1', '< 2'
|
37
37
|
spec.add_dependency 'sinatra', '>= 4', '< 5'
|
38
|
+
spec.add_dependency 'webrick', '>= 1', '< 2'
|
38
39
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nonnative
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.87.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alejandro Falkowski
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-01-
|
10
|
+
date: 2025-01-26 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: concurrent-ruby
|
@@ -110,25 +110,25 @@ dependencies:
|
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '2'
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
|
-
name:
|
113
|
+
name: rackup
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
116
|
- - ">="
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version: '
|
118
|
+
version: '2'
|
119
119
|
- - "<"
|
120
120
|
- !ruby/object:Gem::Version
|
121
|
-
version: '
|
121
|
+
version: '3'
|
122
122
|
type: :runtime
|
123
123
|
prerelease: false
|
124
124
|
version_requirements: !ruby/object:Gem::Requirement
|
125
125
|
requirements:
|
126
126
|
- - ">="
|
127
127
|
- !ruby/object:Gem::Version
|
128
|
-
version: '
|
128
|
+
version: '2'
|
129
129
|
- - "<"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
131
|
+
version: '3'
|
132
132
|
- !ruby/object:Gem::Dependency
|
133
133
|
name: rest-client
|
134
134
|
requirement: !ruby/object:Gem::Requirement
|
@@ -229,6 +229,26 @@ dependencies:
|
|
229
229
|
- - "<"
|
230
230
|
- !ruby/object:Gem::Version
|
231
231
|
version: '5'
|
232
|
+
- !ruby/object:Gem::Dependency
|
233
|
+
name: webrick
|
234
|
+
requirement: !ruby/object:Gem::Requirement
|
235
|
+
requirements:
|
236
|
+
- - ">="
|
237
|
+
- !ruby/object:Gem::Version
|
238
|
+
version: '1'
|
239
|
+
- - "<"
|
240
|
+
- !ruby/object:Gem::Version
|
241
|
+
version: '2'
|
242
|
+
type: :runtime
|
243
|
+
prerelease: false
|
244
|
+
version_requirements: !ruby/object:Gem::Requirement
|
245
|
+
requirements:
|
246
|
+
- - ">="
|
247
|
+
- !ruby/object:Gem::Version
|
248
|
+
version: '1'
|
249
|
+
- - "<"
|
250
|
+
- !ruby/object:Gem::Version
|
251
|
+
version: '2'
|
232
252
|
description: Allows you to keep using the power of ruby to test other systems
|
233
253
|
email:
|
234
254
|
- alexrfalkowski@gmail.com
|