nonnative 1.58.2 → 1.60.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: f15ed666a8ba11f08e78eaebfc60593652a23d39c4139848ff36ed94694de292
4
- data.tar.gz: 35d9d9a38c1a38d41c0b1d7ada5976f02d560a0bf7f33944848be7ca1067e6d6
3
+ metadata.gz: 6020ea5cff78072f14de7b11b17af9db8c4be430ed98093b3251c45f72d51767
4
+ data.tar.gz: c8f94ee98cc1d2e6424d96fb4359bf851bec9133bb87e2250fb8905608bee6fa
5
5
  SHA512:
6
- metadata.gz: 7842a29761b438bf355ed9cdbd55344d64009bc71b9bccfdeeb01452e4a8f377cd5da24029eafb2f7a64922007457b93eb162a45426965fd11408a1085e004c8
7
- data.tar.gz: 1fa589968d4a4ba3cc6f27eea3f5a4dba3fe32468622c6749dd57b37af2b52c6549d17ffbf31c432f79470e0c2b9ece99aa8023d22fab241542f08efe4c8284f
6
+ metadata.gz: 505eefe99b975f2650ec1b805fdbb5c4dcd068103bea0698ecbfcba26985c53204ae75fa55a943d2d8dfbe0c6cf99748bb2999e4b7d4f07cc150bdf652fb8852
7
+ data.tar.gz: 6fbcc4ba9f618a6a1ed9fc910b379382cc4100112e18e3174739fb9f68f4a4f0fa7da01e93735440a00c6bd774af68f33db0b63af7a154f61ac025bcb7372f93
data/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
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
+
12
+ ### [1.59.1](https://github.com/alexfalkowski/nonnative/compare/v1.59.0...v1.59.1) (2022-04-25)
13
+
14
+ ## [1.59.0](https://github.com/alexfalkowski/nonnative/compare/v1.58.2...v1.59.0) (2022-04-25)
15
+
16
+
17
+ ### Features
18
+
19
+ * **cucumber:** verify system start errors ([#117](https://github.com/alexfalkowski/nonnative/issues/117)) ([f8c7f7f](https://github.com/alexfalkowski/nonnative/commit/f8c7f7f4cb4d1506e1b8ae038bd6c46f7ce529a2))
20
+
5
21
  ### [1.58.2](https://github.com/alexfalkowski/nonnative/compare/v1.58.1...v1.58.2) (2022-04-13)
6
22
 
7
23
  ### [1.58.1](https://github.com/alexfalkowski/nonnative/compare/v1.58.0...v1.58.1) (2022-04-06)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nonnative (1.58.2)
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)
@@ -66,13 +66,12 @@ GEM
66
66
  ffi (1.15.5)
67
67
  get_process_mem (0.2.7)
68
68
  ffi (~> 1.0)
69
- google-protobuf (3.20.0-x86_64-darwin)
69
+ google-protobuf (3.20.1-x86_64-darwin)
70
70
  googleapis-common-protos-types (1.3.1)
71
71
  google-protobuf (~> 3.14)
72
72
  grpc (1.45.0-universal-darwin)
73
73
  google-protobuf (~> 3.19)
74
74
  googleapis-common-protos-types (~> 1.0)
75
- grpc-tools (1.45.0)
76
75
  http-accept (1.7.0)
77
76
  http-cookie (1.0.4)
78
77
  domain_name (~> 0.5)
@@ -101,7 +100,7 @@ GEM
101
100
  rack-protection (2.2.0)
102
101
  rack
103
102
  rainbow (3.1.1)
104
- regexp_parser (2.3.0)
103
+ regexp_parser (2.3.1)
105
104
  rest-client (2.1.0)
106
105
  http-accept (>= 1.7.0, < 2.0)
107
106
  http-cookie (>= 1.0.2, < 2.0)
@@ -128,13 +127,13 @@ GEM
128
127
  diff-lcs (>= 1.2.0, < 2.0)
129
128
  rspec-support (~> 3.11.0)
130
129
  rspec-support (3.11.0)
131
- rubocop (1.27.0)
130
+ rubocop (1.28.2)
132
131
  parallel (~> 1.10)
133
132
  parser (>= 3.1.0.0)
134
133
  rainbow (>= 2.2.2, < 4.0)
135
134
  regexp_parser (>= 1.8, < 3.0)
136
135
  rexml
137
- rubocop-ast (>= 1.16.0, < 2.0)
136
+ rubocop-ast (>= 1.17.0, < 2.0)
138
137
  ruby-progressbar (~> 1.7)
139
138
  unicode-display_width (>= 1.4.0, < 3.0)
140
139
  rubocop-ast (1.17.0)
@@ -190,7 +189,6 @@ PLATFORMS
190
189
  DEPENDENCIES
191
190
  bundler (~> 2.3)
192
191
  coveralls_reborn (~> 0.24.0)
193
- grpc-tools (>= 1, < 2)
194
192
  nonnative!
195
193
  rubocop (~> 1.26)
196
194
  solargraph (~> 0.44.3)
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:
@@ -530,7 +502,7 @@ With cucumber:
530
502
 
531
503
  ```cucumber
532
504
  Given I set the proxy for process 'process_1' to 'close_all'
533
- Then And I should reset the proxy for process 'process_1'
505
+ Then I should reset the proxy for process 'process_1'
534
506
  ```
535
507
 
536
508
  ###### Servers
@@ -549,7 +521,7 @@ With cucumber:
549
521
 
550
522
  ```cucumber
551
523
  Given I set the proxy for server 'server_1' to 'close_all'
552
- Then And I should reset the proxy for server 'server_1'
524
+ Then I should reset the proxy for server 'server_1'
553
525
  ```
554
526
 
555
527
  ###### Services
@@ -568,7 +540,7 @@ With cucumber:
568
540
 
569
541
  ```cucumber
570
542
  Given I set the proxy for service 'service_1' to 'close_all'
571
- Then And I should reset the proxy for service 'service_1'
543
+ Then I should reset the proxy for service 'service_1'
572
544
  ```
573
545
 
574
546
  ### Go
@@ -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
@@ -1,5 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ World(RSpec::Benchmark::Matchers)
4
+
5
+ Before('@startup') do
6
+ Nonnative.start
7
+ end
8
+
9
+ After('@startup') do
10
+ Nonnative.stop
11
+ end
12
+
13
+ After('@manual') do
14
+ Nonnative.stop
15
+ end
16
+
17
+ Before('@clear') do
18
+ Nonnative.clear
19
+ end
20
+
3
21
  Given('I set the proxy for process {string} to {string}') do |name, operation|
4
22
  process = Nonnative.pool.process_by_name(name)
5
23
  process.proxy.send(operation)
@@ -15,6 +33,10 @@ Given('I set the proxy for service {string} to {string}') do |name, operation|
15
33
  service.proxy.send(operation)
16
34
  end
17
35
 
36
+ Given('I start the system') do
37
+ Nonnative.start
38
+ end
39
+
18
40
  Then('I should reset the proxy for process {string}') do |name|
19
41
  process = Nonnative.pool.process_by_name(name)
20
42
  process.proxy.reset
@@ -38,3 +60,11 @@ Then('the process {string} should consume less than {string} of memory') do |nam
38
60
 
39
61
  expect(actual).to be < size
40
62
  end
63
+
64
+ Then('starting the system should raise an error') do
65
+ expect { Nonnative.start }.to raise_error(Nonnative::StartError)
66
+ end
67
+
68
+ Then('stopping the system should raise an error') do
69
+ expect { Nonnative.stop }.to raise_error(Nonnative::StopError)
70
+ end
@@ -56,7 +56,7 @@ module Nonnative
56
56
  environment = environment.transform_keys(&:to_s).transform_values(&:to_s)
57
57
 
58
58
  environment.each_key do |k|
59
- environment[k] = ENV[k] || environment[k]
59
+ environment[k] = ENV.fetch(k, nil) || environment[k]
60
60
  end
61
61
 
62
62
  spawn(environment, service.command.call, %i[out err] => [service.log, 'a'])
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nonnative
4
- VERSION = '1.58.2'
4
+ VERSION = '1.60.0'
5
5
  end
data/lib/nonnative.rb CHANGED
@@ -14,6 +14,7 @@ require 'puma/server'
14
14
  require 'concurrent'
15
15
  require 'cucumber'
16
16
  require 'get_process_mem'
17
+ require 'rspec-benchmark'
17
18
 
18
19
  require 'nonnative/version'
19
20
  require 'nonnative/error'
@@ -46,7 +47,6 @@ require 'nonnative/close_all_socket_pair'
46
47
  require 'nonnative/delay_socket_pair'
47
48
  require 'nonnative/invalid_data_socket_pair'
48
49
  require 'nonnative/socket_pair_factory'
49
- require 'nonnative/strategy'
50
50
  require 'nonnative/go_command'
51
51
  require 'nonnative/cucumber'
52
52
 
@@ -68,8 +68,6 @@ module Nonnative
68
68
 
69
69
  def configure
70
70
  yield configuration
71
-
72
- require "nonnative/#{configuration.strategy}"
73
71
  end
74
72
 
75
73
  def start
data/nonnative.gemspec CHANGED
@@ -36,7 +36,6 @@ Gem::Specification.new do |spec|
36
36
 
37
37
  spec.add_development_dependency 'bundler', '~> 2.3'
38
38
  spec.add_development_dependency 'coveralls_reborn', '~> 0.24.0'
39
- spec.add_development_dependency 'grpc-tools', ['>= 1', '< 2']
40
39
  spec.add_development_dependency 'rubocop', '~> 1.26'
41
40
  spec.add_development_dependency 'solargraph', '~> 0.44.3'
42
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nonnative
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.58.2
4
+ version: 1.60.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alejandro Falkowski
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-13 00:00:00.000000000 Z
11
+ date: 2022-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -194,26 +194,6 @@ dependencies:
194
194
  - - "~>"
195
195
  - !ruby/object:Gem::Version
196
196
  version: 0.24.0
197
- - !ruby/object:Gem::Dependency
198
- name: grpc-tools
199
- requirement: !ruby/object:Gem::Requirement
200
- requirements:
201
- - - ">="
202
- - !ruby/object:Gem::Version
203
- version: '1'
204
- - - "<"
205
- - !ruby/object:Gem::Version
206
- version: '2'
207
- type: :development
208
- prerelease: false
209
- version_requirements: !ruby/object:Gem::Requirement
210
- requirements:
211
- - - ">="
212
- - !ruby/object:Gem::Version
213
- version: '1'
214
- - - "<"
215
- - !ruby/object:Gem::Version
216
- version: '2'
217
197
  - !ruby/object:Gem::Dependency
218
198
  name: rubocop
219
199
  requirement: !ruby/object:Gem::Requirement
@@ -265,7 +245,6 @@ files:
265
245
  - bin/console
266
246
  - bin/setup
267
247
  - lib/nonnative.rb
268
- - lib/nonnative/before.rb
269
248
  - lib/nonnative/close_all_socket_pair.rb
270
249
  - lib/nonnative/configuration.rb
271
250
  - lib/nonnative/configuration_process.rb
@@ -282,7 +261,6 @@ files:
282
261
  - lib/nonnative/http_client.rb
283
262
  - lib/nonnative/http_server.rb
284
263
  - lib/nonnative/invalid_data_socket_pair.rb
285
- - lib/nonnative/manual.rb
286
264
  - lib/nonnative/no_proxy.rb
287
265
  - lib/nonnative/not_found_error.rb
288
266
  - lib/nonnative/observability.rb
@@ -299,7 +277,6 @@ files:
299
277
  - lib/nonnative/start_error.rb
300
278
  - lib/nonnative/startup.rb
301
279
  - lib/nonnative/stop_error.rb
302
- - lib/nonnative/strategy.rb
303
280
  - lib/nonnative/timeout.rb
304
281
  - lib/nonnative/version.rb
305
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['NONNATIVE_STRATEGY']
22
- end
23
-
24
- def env_timeout
25
- @env_timeout ||= ENV['NONNATIVE_TIMEOUT']
26
- end
27
- end
28
- end