nonnative 1.86.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81b070f7067278bcc745ef685d26cb856196efcaff35255baa850ac41448f0dc
4
- data.tar.gz: bf16cd6415717885eb38d3b60fd9e5da08a981571e9f67e7928fcda8e9e35ffb
3
+ metadata.gz: d084e050131452576fb0716fa60f9ad641f8d18e50cf99c05d0f3e0c37742f58
4
+ data.tar.gz: dea87ac4b7b3c1d85bba7b1253d24191654fa3a7a338c54767716a85ff6b1123
5
5
  SHA512:
6
- metadata.gz: aa19604dfec804d43a98f23f54020c35eef9fc6f1633b01437703ccec275df4ddedf8710737fd6f2edc69cfc1e28fdfc6da0499d8856686c7cd1c43def45982d
7
- data.tar.gz: 8521adce4f1ac505d2ab958fa9359f7fd459e78a674bc4008b11ce682275ac9f47a9578988fae484137d4ce6a8621dbd7ee8940bdad19da5ed4980c5154baa0a
6
+ metadata.gz: 38c23a797f43a2193335fbcf50550311a0881de585d27af319935eeba9bb3e07e2f920c06004accd9cc3eada1079e374f5e9ffd6a51fcf238908b57ff04f3e42
7
+ data.tar.gz: e6e63b0ed16fb218b56d981e04577774128d52e0a281e6937eb5127beee7a180fdd0fc7fbbfa536e75e78570aaa1202b3f21a69b2669f83dc8b1933abe4518bf
data/CHANGELOG.md CHANGED
@@ -6,6 +6,11 @@ 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
+
9
14
  ## [v1.86.0](https://github.com/alexfalkowski/nonnative/releases/tag/v1.86.0) - 2025-01-25
10
15
 
11
16
  - [`9f3be69`](https://github.com/alexfalkowski/nonnative/commit/9f3be69130570a6842d6559c929fe6cb480dd1df) feat(http_server): use webrick (#490)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nonnative (1.86.0)
4
+ nonnative (1.87.0)
5
5
  concurrent-ruby (>= 1, < 2)
6
6
  config (>= 5, < 6)
7
7
  cucumber (>= 7, < 10)
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: 0.1
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: 0.1
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 EchoServer < Nonnative::Server
145
- def perform_start
146
- @socket_server = TCPServer.new(service.host, service.port)
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 = @socket_server.accept
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
- @socket_server.close
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 :server_settings, log_requests: true
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.new
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, :wait, :processes, :servers, :services
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
@@ -18,6 +18,7 @@ module Nonnative
18
18
  proxy.host = value[:host] if value[:host]
19
19
  proxy.port = value[:port]
20
20
  proxy.log = value[:log]
21
+ proxy.wait = value[:wait] if value[:wait]
21
22
  proxy.options = value[:options]
22
23
  end
23
24
  end
@@ -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
@@ -91,6 +91,8 @@ module Nonnative
91
91
  mutex.synchronize do
92
92
  @state = state
93
93
  close_connections
94
+
95
+ wait
94
96
  end
95
97
  end
96
98
 
@@ -9,5 +9,9 @@ module Nonnative
9
9
  protected
10
10
 
11
11
  attr_reader :service
12
+
13
+ def wait
14
+ sleep service.proxy.wait
15
+ end
12
16
  end
13
17
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nonnative
4
- VERSION = '1.86.0'
4
+ VERSION = '1.87.0'
5
5
  end
data/lib/nonnative.rb CHANGED
@@ -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
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.86.0
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-25 00:00:00.000000000 Z
10
+ date: 2025-01-26 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: concurrent-ruby