nonnative 1.59.0 → 1.61.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +6 -6
- data/README.md +4 -33
- data/lib/nonnative/configuration.rb +7 -8
- data/lib/nonnative/cucumber.rb +17 -0
- data/lib/nonnative/process.rb +1 -1
- data/lib/nonnative/version.rb +1 -1
- data/lib/nonnative.rb +0 -3
- metadata +1 -4
- data/lib/nonnative/before.rb +0 -9
- data/lib/nonnative/manual.rb +0 -3
- data/lib/nonnative/strategy.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09d70b9c1d1892ed5d19d59e6130115721e8982d6ec5be4499cdbfae2ffa01b4'
|
4
|
+
data.tar.gz: 4fed0557560e55343d681176ffe449de0fe789a6332ff3c6f90e520b2b87924c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e037a8f8a4645455f9a2e18c030d582785d5d2d000635480ba776c994c1957b257dfe8330a899469707366c7942897778155e2a75b8f40ef202fcd018cb0a0b
|
7
|
+
data.tar.gz: '02228f975130c4a076ab9f3001277466db84b6bc8ae6f9a19ac185157f7adda303f720ea93c4b4e4825892620d95332572ca1fca17d02ef400de039d21120cd8'
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,15 @@
|
|
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
|
+
|
5
14
|
## [1.59.0](https://github.com/alexfalkowski/nonnative/compare/v1.58.2...v1.59.0) (2022-04-25)
|
6
15
|
|
7
16
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nonnative (1.
|
4
|
+
nonnative (1.61.0)
|
5
5
|
concurrent-ruby (~> 1.0, >= 1.0.5)
|
6
6
|
cucumber (>= 7, < 8)
|
7
7
|
get_process_mem (~> 0.2.1)
|
@@ -66,7 +66,7 @@ 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.
|
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)
|
@@ -76,7 +76,7 @@ GEM
|
|
76
76
|
http-cookie (1.0.4)
|
77
77
|
domain_name (~> 0.5)
|
78
78
|
jaro_winkler (1.5.4)
|
79
|
-
kramdown (2.
|
79
|
+
kramdown (2.4.0)
|
80
80
|
rexml
|
81
81
|
kramdown-parser-gfm (1.1.0)
|
82
82
|
kramdown (~> 2.0)
|
@@ -100,7 +100,7 @@ GEM
|
|
100
100
|
rack-protection (2.2.0)
|
101
101
|
rack
|
102
102
|
rainbow (3.1.1)
|
103
|
-
regexp_parser (2.3.
|
103
|
+
regexp_parser (2.3.1)
|
104
104
|
rest-client (2.1.0)
|
105
105
|
http-accept (>= 1.7.0, < 2.0)
|
106
106
|
http-cookie (>= 1.0.2, < 2.0)
|
@@ -127,13 +127,13 @@ GEM
|
|
127
127
|
diff-lcs (>= 1.2.0, < 2.0)
|
128
128
|
rspec-support (~> 3.11.0)
|
129
129
|
rspec-support (3.11.0)
|
130
|
-
rubocop (1.
|
130
|
+
rubocop (1.28.2)
|
131
131
|
parallel (~> 1.10)
|
132
132
|
parser (>= 3.1.0.0)
|
133
133
|
rainbow (>= 2.2.2, < 4.0)
|
134
134
|
regexp_parser (>= 1.8, < 3.0)
|
135
135
|
rexml
|
136
|
-
rubocop-ast (>= 1.
|
136
|
+
rubocop-ast (>= 1.17.0, < 2.0)
|
137
137
|
ruby-progressbar (~> 1.7)
|
138
138
|
unicode-display_width (>= 1.4.0, < 3.0)
|
139
139
|
rubocop-ast (1.17.0)
|
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
|
47
|
-
- before -
|
48
|
-
- manual -
|
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 =
|
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
|
@@ -47,6 +39,13 @@ module Nonnative
|
|
47
39
|
services << service
|
48
40
|
end
|
49
41
|
|
42
|
+
def process_by_name(name)
|
43
|
+
process = processes.find { |s| s.name == name }
|
44
|
+
raise NotFoundError, "Could not find process with name '#{name}'" if process.nil?
|
45
|
+
|
46
|
+
process
|
47
|
+
end
|
48
|
+
|
50
49
|
private
|
51
50
|
|
52
51
|
def add_processes(file)
|
data/lib/nonnative/cucumber.rb
CHANGED
@@ -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)
|
@@ -56,3 +68,8 @@ end
|
|
56
68
|
Then('stopping the system should raise an error') do
|
57
69
|
expect { Nonnative.stop }.to raise_error(Nonnative::StopError)
|
58
70
|
end
|
71
|
+
|
72
|
+
Then('I should see a log entry of {string} for process {string}') do |message, process|
|
73
|
+
process = Nonnative.configuration.process_by_name(process)
|
74
|
+
expect(Nonnative.log_lines(process.log, ->(l) { l.include?(message) }).first).to include(message)
|
75
|
+
end
|
data/lib/nonnative/process.rb
CHANGED
@@ -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
|
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'])
|
data/lib/nonnative/version.rb
CHANGED
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.
|
4
|
+
version: 1.61.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
|
data/lib/nonnative/before.rb
DELETED
data/lib/nonnative/manual.rb
DELETED
data/lib/nonnative/strategy.rb
DELETED
@@ -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
|