nonnative 1.59.1 → 1.60.0

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: 8a2c4751f90acdfd5c610819ec3c6400c06ef5565a21a57de76ca934e0ae4c4c
4
- data.tar.gz: 0543d81897672535887ded26db0631b03868ee465dfe0a1361795da890223f12
3
+ metadata.gz: 6020ea5cff78072f14de7b11b17af9db8c4be430ed98093b3251c45f72d51767
4
+ data.tar.gz: c8f94ee98cc1d2e6424d96fb4359bf851bec9133bb87e2250fb8905608bee6fa
5
5
  SHA512:
6
- metadata.gz: 92d476f0b27e5524b7698846b25b7cd4dd761582784dc53124093bb0c6bff31f8dec73869685a43e77de00d826204fe55d7bcd0644b83a5bbdae27a9add43e36
7
- data.tar.gz: b2bbaa52ee9e45e36c5903f5989ab1100c3f4c23a49e344f2fa287bc870e98d206c956d94c5af75be7136880b1a50294846dba314e081bf6562cef1ccc999c0d
6
+ metadata.gz: 505eefe99b975f2650ec1b805fdbb5c4dcd068103bea0698ecbfcba26985c53204ae75fa55a943d2d8dfbe0c6cf99748bb2999e4b7d4f07cc150bdf652fb8852
7
+ data.tar.gz: 6fbcc4ba9f618a6a1ed9fc910b379382cc4100112e18e3174739fb9f68f4a4f0fa7da01e93735440a00c6bd774af68f33db0b63af7a154f61ac025bcb7372f93
data/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [1.60.0](https://github.com/alexfalkowski/nonnative/compare/v1.59.1...v1.60.0) (2022-04-25)
6
+
7
+
8
+ ### Features
9
+
10
+ * remove strategy to allow finer control in features. ([#119](https://github.com/alexfalkowski/nonnative/issues/119)) ([60b8310](https://github.com/alexfalkowski/nonnative/commit/60b8310ab8ae2a2761d867ab169f8ad5bbbed416))
11
+
5
12
  ### [1.59.1](https://github.com/alexfalkowski/nonnative/compare/v1.59.0...v1.59.1) (2022-04-25)
6
13
 
7
14
  ## [1.59.0](https://github.com/alexfalkowski/nonnative/compare/v1.58.2...v1.59.0) (2022-04-25)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nonnative (1.59.1)
4
+ nonnative (1.60.0)
5
5
  concurrent-ruby (~> 1.0, >= 1.0.5)
6
6
  cucumber (>= 7, < 8)
7
7
  get_process_mem (~> 0.2.1)
data/README.md CHANGED
@@ -43,13 +43,9 @@ Configure nonnative with the following:
43
43
  ### Strategy
44
44
 
45
45
  The strategy can be one of the following values:
46
- - startup - will start the process once.
47
- - before - will hook into cucumbers Before and After.
48
- - manual - do this manually
49
-
50
- This can be overridden by the following environment variables:
51
- - NONNATIVE_STRATEGY - Set this to override what is set in the config.
52
- - NONNATIVE_TIMEOUT - Set this (in seconds, e.g 5) to override what is set in the config.
46
+ - startup - When we include `nonnative/startup`, it will start it once.
47
+ - before - When we tag our features with `@startup` it will start and stop after the scenario.
48
+ - manual - When we tag our features with `@manual` it will stop after the scenario.
53
49
 
54
50
  ### Processes
55
51
 
@@ -61,12 +57,10 @@ Setup it up programmatically:
61
57
  require 'nonnative'
62
58
 
63
59
  Nonnative.configure do |config|
64
- config.strategy = :startup
65
-
66
60
  config.process do |p|
67
61
  p.name = 'start_1'
68
62
  p.command = -> { 'features/support/bin/start 12_321' }
69
- p.timeout = config.strategy.timeout
63
+ p.timeout = 5
70
64
  p.port = 12_321
71
65
  p.log = 'features/logs/12_321.log'
72
66
  p.signal = 'INT' # Possible values are described in Signal.list.keys.
@@ -89,7 +83,6 @@ Setup it up through configuration:
89
83
 
90
84
  ```yaml
91
85
  version: 1.0
92
- strategy: startup
93
86
  processes:
94
87
  -
95
88
  name: start_1
@@ -157,8 +150,6 @@ Setup it up programmatically:
157
150
  require 'nonnative'
158
151
 
159
152
  Nonnative.configure do |config|
160
- config.strategy = :startup
161
-
162
153
  config.server do |s|
163
154
  s.name = 'server_1'
164
155
  s.klass = Nonnative::EchoServer
@@ -181,7 +172,6 @@ Setup it up through configuration:
181
172
 
182
173
  ```yaml
183
174
  version: 1.0
184
- strategy: startup
185
175
  servers:
186
176
  -
187
177
  name: server_1
@@ -239,8 +229,6 @@ Setup it up programmatically:
239
229
  require 'nonnative'
240
230
 
241
231
  Nonnative.configure do |config|
242
- config.strategy = :startup
243
-
244
232
  config.server do |s|
245
233
  s.name = 'http_server_1'
246
234
  s.klass = Nonnative::Features::HTTPServer
@@ -255,7 +243,6 @@ Setup it up through configuration:
255
243
 
256
244
  ```yaml
257
245
  version: 1.0
258
- strategy: startup
259
246
  servers:
260
247
  -
261
248
  name: http_server_1
@@ -303,8 +290,6 @@ Setup it up programmatically:
303
290
  require 'nonnative'
304
291
 
305
292
  Nonnative.configure do |config|
306
- config.strategy = :startup
307
-
308
293
  config.server do |s|
309
294
  s.name = 'grpc_server_1'
310
295
  s.klass = Nonnative::Features::GRPCServer
@@ -319,7 +304,6 @@ Setup it up through configuration:
319
304
 
320
305
  ```yaml
321
306
  version: 1.0
322
- strategy: startup
323
307
  servers:
324
308
  -
325
309
  name: grpc_server_1
@@ -349,8 +333,6 @@ Setup it up programmatically:
349
333
  require 'nonnative'
350
334
 
351
335
  Nonnative.configure do |config|
352
- config.strategy = :startup
353
-
354
336
  config.service do |s|
355
337
  s.name = 'postgres'
356
338
  p.port = 5432
@@ -367,7 +349,6 @@ Setup it up through configuration:
367
349
 
368
350
  ```yaml
369
351
  version: 1.0
370
- strategy: startup
371
352
  processes:
372
353
  -
373
354
  name: postgres
@@ -401,8 +382,6 @@ Setup it up programmatically:
401
382
  require 'nonnative'
402
383
 
403
384
  Nonnative.configure do |config|
404
- config.strategy = :startup
405
-
406
385
  config.process do |p|
407
386
  p.proxy = {
408
387
  type: 'fault_injection',
@@ -420,7 +399,6 @@ Setup it up through configuration:
420
399
 
421
400
  ```yaml
422
401
  version: 1.0
423
- strategy: startup
424
402
  processes:
425
403
  -
426
404
  proxy:
@@ -439,8 +417,6 @@ Setup it up programmatically:
439
417
  require 'nonnative'
440
418
 
441
419
  Nonnative.configure do |config|
442
- config.strategy = :startup
443
-
444
420
  config.server do |s|
445
421
  s.proxy = {
446
422
  type: 'fault_injection',
@@ -458,7 +434,6 @@ Setup it up through configuration:
458
434
 
459
435
  ```yaml
460
436
  version: 1.0
461
- strategy: startup
462
437
  servers:
463
438
  -
464
439
  proxy:
@@ -477,8 +452,6 @@ Setup it up programmatically:
477
452
  require 'nonnative'
478
453
 
479
454
  Nonnative.configure do |config|
480
- config.strategy = :startup
481
-
482
455
  config.service do |s|
483
456
  s.proxy = {
484
457
  type: 'fault_injection',
@@ -496,7 +469,6 @@ Setup it up through configuration:
496
469
 
497
470
  ```yaml
498
471
  version: 1.0
499
- strategy: startup
500
472
  services:
501
473
  -
502
474
  proxy:
@@ -605,7 +577,6 @@ Setup it up through configuration:
605
577
 
606
578
  ```yaml
607
579
  version: 1.0
608
- strategy: startup
609
580
  processes:
610
581
  -
611
582
  name: go
@@ -3,29 +3,21 @@
3
3
  module Nonnative
4
4
  class Configuration
5
5
  def initialize
6
- @strategy = Strategy.new
7
6
  @processes = []
8
7
  @servers = []
9
8
  @services = []
10
9
  end
11
10
 
12
11
  attr_accessor :processes, :servers, :services
13
- attr_reader :strategy
14
12
 
15
13
  def load_file(path)
16
14
  file = YAML.load_file(path)
17
15
 
18
- self.strategy = file['strategy']
19
-
20
16
  add_processes(file)
21
17
  add_servers(file)
22
18
  add_services(file)
23
19
  end
24
20
 
25
- def strategy=(value)
26
- @strategy = Strategy.new(value)
27
- end
28
-
29
21
  def process
30
22
  process = Nonnative::ConfigurationProcess.new
31
23
  yield process
@@ -2,10 +2,22 @@
2
2
 
3
3
  World(RSpec::Benchmark::Matchers)
4
4
 
5
+ Before('@startup') do
6
+ Nonnative.start
7
+ end
8
+
9
+ After('@startup') do
10
+ Nonnative.stop
11
+ end
12
+
5
13
  After('@manual') do
6
14
  Nonnative.stop
7
15
  end
8
16
 
17
+ Before('@clear') do
18
+ Nonnative.clear
19
+ end
20
+
9
21
  Given('I set the proxy for process {string} to {string}') do |name, operation|
10
22
  process = Nonnative.pool.process_by_name(name)
11
23
  process.proxy.send(operation)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nonnative
4
- VERSION = '1.59.1'
4
+ VERSION = '1.60.0'
5
5
  end
data/lib/nonnative.rb CHANGED
@@ -47,7 +47,6 @@ require 'nonnative/close_all_socket_pair'
47
47
  require 'nonnative/delay_socket_pair'
48
48
  require 'nonnative/invalid_data_socket_pair'
49
49
  require 'nonnative/socket_pair_factory'
50
- require 'nonnative/strategy'
51
50
  require 'nonnative/go_command'
52
51
  require 'nonnative/cucumber'
53
52
 
@@ -69,8 +68,6 @@ module Nonnative
69
68
 
70
69
  def configure
71
70
  yield configuration
72
-
73
- require "nonnative/#{configuration.strategy}"
74
71
  end
75
72
 
76
73
  def start
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nonnative
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.59.1
4
+ version: 1.60.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alejandro Falkowski
@@ -245,7 +245,6 @@ files:
245
245
  - bin/console
246
246
  - bin/setup
247
247
  - lib/nonnative.rb
248
- - lib/nonnative/before.rb
249
248
  - lib/nonnative/close_all_socket_pair.rb
250
249
  - lib/nonnative/configuration.rb
251
250
  - lib/nonnative/configuration_process.rb
@@ -262,7 +261,6 @@ files:
262
261
  - lib/nonnative/http_client.rb
263
262
  - lib/nonnative/http_server.rb
264
263
  - lib/nonnative/invalid_data_socket_pair.rb
265
- - lib/nonnative/manual.rb
266
264
  - lib/nonnative/no_proxy.rb
267
265
  - lib/nonnative/not_found_error.rb
268
266
  - lib/nonnative/observability.rb
@@ -279,7 +277,6 @@ files:
279
277
  - lib/nonnative/start_error.rb
280
278
  - lib/nonnative/startup.rb
281
279
  - lib/nonnative/stop_error.rb
282
- - lib/nonnative/strategy.rb
283
280
  - lib/nonnative/timeout.rb
284
281
  - lib/nonnative/version.rb
285
282
  - nonnative.gemspec
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Before do
4
- Nonnative.start
5
- end
6
-
7
- After do
8
- Nonnative.stop
9
- end
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Do nothing as it's manual
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nonnative
4
- class Strategy
5
- def initialize(strategy = 'before', timeout = 5)
6
- @strategy = strategy
7
- @timeout = timeout
8
- end
9
-
10
- def timeout
11
- (env_timeout || @timeout).to_i
12
- end
13
-
14
- def to_s
15
- (env_strategy || @strategy).to_s
16
- end
17
-
18
- private
19
-
20
- def env_strategy
21
- @env_strategy ||= ENV.fetch('NONNATIVE_STRATEGY', nil)
22
- end
23
-
24
- def env_timeout
25
- @env_timeout ||= ENV.fetch('NONNATIVE_TIMEOUT', nil)
26
- end
27
- end
28
- end