nonnative 1.59.1 → 1.62.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 +21 -0
- data/Gemfile.lock +2 -2
- data/README.md +4 -33
- data/lib/nonnative/configuration.rb +7 -8
- data/lib/nonnative/cucumber.rb +21 -0
- 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: 7c0356dc5f399e9fa703d3bf310a03349d5b3762124738746fbb982ab7f9261c
|
4
|
+
data.tar.gz: b69f1ac927e2f6dad05a453d0e9919dd09d7ed7a67b5473cf61874b53404a67a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b15cc973504888ef73f821a74105b0209eb25c708451062fee4612ea8e4b16f07fbdbac24e6aab05ab6e33e0bb6da3866b6a1ed8145411f6cc4d4a7f77a3af9
|
7
|
+
data.tar.gz: eb46dc1747a0390f4ad0736fa4bdbf4621430b957a9d79ed7d1b85f42e10405f83ab1c39c26d2ab6c6d044b6e866b24d71aba1ff25ebb4f0b1956cd1d2de4574
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,27 @@
|
|
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.62.0](https://github.com/alexfalkowski/nonnative/compare/v1.61.0...v1.62.0) (2022-04-25)
|
6
|
+
|
7
|
+
|
8
|
+
### Features
|
9
|
+
|
10
|
+
* add ability to read from log file ([#121](https://github.com/alexfalkowski/nonnative/issues/121)) ([eb4638f](https://github.com/alexfalkowski/nonnative/commit/eb4638f3ca8636ca68f989209a6e73831e61a678))
|
11
|
+
|
12
|
+
## [1.61.0](https://github.com/alexfalkowski/nonnative/compare/v1.60.0...v1.61.0) (2022-04-25)
|
13
|
+
|
14
|
+
|
15
|
+
### Features
|
16
|
+
|
17
|
+
* allow checking logs ([#120](https://github.com/alexfalkowski/nonnative/issues/120)) ([dc95fd2](https://github.com/alexfalkowski/nonnative/commit/dc95fd2977c3900d2ae6447d517f410e1128837f))
|
18
|
+
|
19
|
+
## [1.60.0](https://github.com/alexfalkowski/nonnative/compare/v1.59.1...v1.60.0) (2022-04-25)
|
20
|
+
|
21
|
+
|
22
|
+
### Features
|
23
|
+
|
24
|
+
* remove strategy to allow finer control in features. ([#119](https://github.com/alexfalkowski/nonnative/issues/119)) ([60b8310](https://github.com/alexfalkowski/nonnative/commit/60b8310ab8ae2a2761d867ab169f8ad5bbbed416))
|
25
|
+
|
5
26
|
### [1.59.1](https://github.com/alexfalkowski/nonnative/compare/v1.59.0...v1.59.1) (2022-04-25)
|
6
27
|
|
7
28
|
## [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.
|
4
|
+
nonnative (1.62.0)
|
5
5
|
concurrent-ruby (~> 1.0, >= 1.0.5)
|
6
6
|
cucumber (>= 7, < 8)
|
7
7
|
get_process_mem (~> 0.2.1)
|
@@ -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)
|
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,12 @@ 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
|
76
|
+
|
77
|
+
Then('I should see a log entry of {string} in the file {string}') do |message, path|
|
78
|
+
expect(Nonnative.log_lines(path, ->(l) { l.include?(message) }).first).to include(message)
|
79
|
+
end
|
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.62.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.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
|