nonnative 1.26.0 → 1.31.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 +4 -4
- data/.circleci/config.yml +1 -1
- data/.rubocop.yml +4 -51
- data/.ruby-version +1 -1
- data/Gemfile.lock +56 -82
- data/Makefile +1 -1
- data/README.md +50 -5
- data/lib/nonnative.rb +3 -2
- data/lib/nonnative/configuration.rb +21 -14
- data/lib/nonnative/delay_socket_pair.rb +1 -1
- data/lib/nonnative/go_command.rb +40 -0
- data/lib/nonnative/pool.rb +0 -2
- data/lib/nonnative/strategy.rb +28 -0
- data/lib/nonnative/timeout.rb +2 -4
- data/lib/nonnative/version.rb +1 -1
- data/nonnative.gemspec +5 -7
- metadata +20 -36
- data/Rakefile +0 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f9da622a2bc452f1fb3fde00697e415939676e86effb17c6a8a461bcabed826e
|
|
4
|
+
data.tar.gz: 93d0f12cb69c8281f5ec04c01d081f4a5993b090e99f6fa1c0f3d3cc318de6d1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4b68bea5ebd563bf547c3db4e4929c91a3003dd5560e595f6b75cb70f61eb9334f5c6d3513d005b11a280ab5b89423628bf08cb71058e6a71ec71eee37285532
|
|
7
|
+
data.tar.gz: 7cd3daed412bffe1e55c4ba4c1dbf03afb3e65812c11a34720ca3cee18fe4800f842598716c44582da8928347454e77206f668975f76eb43055e18215f228d38
|
data/.circleci/config.yml
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
AllCops:
|
|
2
|
-
TargetRubyVersion: 2.
|
|
2
|
+
TargetRubyVersion: 2.7
|
|
3
3
|
DisplayCopNames: true
|
|
4
|
+
NewCops: enable
|
|
4
5
|
|
|
5
6
|
Layout/LineLength:
|
|
6
7
|
Max: 120
|
|
@@ -17,53 +18,5 @@ Metrics/AbcSize:
|
|
|
17
18
|
Style/Documentation:
|
|
18
19
|
Enabled: false
|
|
19
20
|
|
|
20
|
-
Lint/
|
|
21
|
-
Enabled:
|
|
22
|
-
|
|
23
|
-
Style/HashEachMethods:
|
|
24
|
-
Enabled: true
|
|
25
|
-
|
|
26
|
-
Style/HashTransformKeys:
|
|
27
|
-
Enabled: true
|
|
28
|
-
|
|
29
|
-
Style/HashTransformValues:
|
|
30
|
-
Enabled: true
|
|
31
|
-
|
|
32
|
-
Lint/StructNewOverride:
|
|
33
|
-
Enabled: true
|
|
34
|
-
|
|
35
|
-
Layout/SpaceAroundMethodCallOperator:
|
|
36
|
-
Enabled: true
|
|
37
|
-
|
|
38
|
-
Style/ExponentialNotation:
|
|
39
|
-
Enabled: true
|
|
40
|
-
|
|
41
|
-
Layout/EmptyLinesAroundAttributeAccessor:
|
|
42
|
-
Enabled: true
|
|
43
|
-
|
|
44
|
-
Style/SlicingWithRange:
|
|
45
|
-
Enabled: true
|
|
46
|
-
|
|
47
|
-
Lint/DeprecatedOpenSSLConstant:
|
|
48
|
-
Enabled: true
|
|
49
|
-
|
|
50
|
-
Lint/MixedRegexpCaptureTypes:
|
|
51
|
-
Enabled: true
|
|
52
|
-
|
|
53
|
-
Style/RedundantRegexpCharacterClass:
|
|
54
|
-
Enabled: true
|
|
55
|
-
|
|
56
|
-
Style/RedundantRegexpEscape:
|
|
57
|
-
Enabled: true
|
|
58
|
-
|
|
59
|
-
Style/RedundantFetchBlock:
|
|
60
|
-
Enabled: true
|
|
61
|
-
|
|
62
|
-
Style/AccessorGrouping:
|
|
63
|
-
Enabled: true
|
|
64
|
-
|
|
65
|
-
Style/BisectedAttrAccessor:
|
|
66
|
-
Enabled: true
|
|
67
|
-
|
|
68
|
-
Style/RedundantAssignment:
|
|
69
|
-
Enabled: true
|
|
21
|
+
Lint/HashCompareByIdentity:
|
|
22
|
+
Enabled: false
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
ruby-2.
|
|
1
|
+
ruby-2.7.1
|
data/Gemfile.lock
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
nonnative (1.
|
|
4
|
+
nonnative (1.31.0)
|
|
5
5
|
concurrent-ruby (~> 1.0, >= 1.0.5)
|
|
6
|
-
cucumber (>=
|
|
6
|
+
cucumber (>= 5, < 6)
|
|
7
7
|
grpc (>= 1, < 2)
|
|
8
|
-
puma (~>
|
|
8
|
+
puma (~> 5.0)
|
|
9
9
|
rest-client (~> 2.1)
|
|
10
10
|
rspec-benchmark (~> 0.6.0)
|
|
11
11
|
rspec-expectations (~> 3.9, >= 3.9.2)
|
|
@@ -14,108 +14,98 @@ PATH
|
|
|
14
14
|
GEM
|
|
15
15
|
remote: https://rubygems.org/
|
|
16
16
|
specs:
|
|
17
|
-
activesupport (6.0.3.
|
|
17
|
+
activesupport (6.0.3.4)
|
|
18
18
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
19
19
|
i18n (>= 0.7, < 2)
|
|
20
20
|
minitest (~> 5.1)
|
|
21
21
|
tzinfo (~> 1.1)
|
|
22
22
|
zeitwerk (~> 2.2, >= 2.2.2)
|
|
23
23
|
ast (2.4.1)
|
|
24
|
-
backport (1.1.2)
|
|
25
|
-
benchmark (0.1.0)
|
|
26
24
|
benchmark-malloc (0.2.0)
|
|
27
25
|
benchmark-perf (0.6.0)
|
|
28
26
|
benchmark-trend (0.4.0)
|
|
29
27
|
builder (3.2.4)
|
|
30
|
-
concurrent-ruby (1.1.
|
|
31
|
-
cucumber (
|
|
32
|
-
builder (~> 3.2, >= 3.2.
|
|
33
|
-
cucumber-core (~>
|
|
34
|
-
cucumber-create-meta (~>
|
|
35
|
-
cucumber-cucumber-expressions (~> 10.
|
|
36
|
-
cucumber-gherkin (~>
|
|
37
|
-
cucumber-html-formatter (~>
|
|
38
|
-
cucumber-messages (~>
|
|
39
|
-
cucumber-wire (~>
|
|
40
|
-
diff-lcs (~> 1.
|
|
28
|
+
concurrent-ruby (1.1.7)
|
|
29
|
+
cucumber (5.2.0)
|
|
30
|
+
builder (~> 3.2, >= 3.2.4)
|
|
31
|
+
cucumber-core (~> 8.0, >= 8.0.1)
|
|
32
|
+
cucumber-create-meta (~> 2.0, >= 2.0.2)
|
|
33
|
+
cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
|
|
34
|
+
cucumber-gherkin (~> 15.0, >= 15.0.2)
|
|
35
|
+
cucumber-html-formatter (~> 9.0, >= 9.0.0)
|
|
36
|
+
cucumber-messages (~> 13.1, >= 13.1.0)
|
|
37
|
+
cucumber-wire (~> 4.0, >= 4.0.1)
|
|
38
|
+
diff-lcs (~> 1.4, >= 1.4.4)
|
|
41
39
|
multi_test (~> 0.1, >= 0.1.2)
|
|
42
|
-
sys-uname (~> 1.
|
|
43
|
-
cucumber-core (
|
|
44
|
-
cucumber-gherkin (~>
|
|
45
|
-
cucumber-messages (~>
|
|
40
|
+
sys-uname (~> 1.2, >= 1.2.1)
|
|
41
|
+
cucumber-core (8.0.1)
|
|
42
|
+
cucumber-gherkin (~> 15.0, >= 15.0.2)
|
|
43
|
+
cucumber-messages (~> 13.0, >= 13.0.1)
|
|
46
44
|
cucumber-tag-expressions (~> 2.0, >= 2.0.4)
|
|
47
|
-
cucumber-create-meta (
|
|
48
|
-
cucumber-messages (~>
|
|
45
|
+
cucumber-create-meta (2.0.2)
|
|
46
|
+
cucumber-messages (~> 13.0, >= 13.0.1)
|
|
49
47
|
sys-uname (~> 1.2, >= 1.2.1)
|
|
50
|
-
cucumber-cucumber-expressions (10.
|
|
51
|
-
cucumber-gherkin (
|
|
52
|
-
cucumber-messages (~>
|
|
53
|
-
cucumber-html-formatter (
|
|
54
|
-
cucumber-messages (~>
|
|
55
|
-
cucumber-messages (
|
|
48
|
+
cucumber-cucumber-expressions (10.3.0)
|
|
49
|
+
cucumber-gherkin (15.0.2)
|
|
50
|
+
cucumber-messages (~> 13.0, >= 13.0.1)
|
|
51
|
+
cucumber-html-formatter (9.0.0)
|
|
52
|
+
cucumber-messages (~> 13.0, >= 13.0.1)
|
|
53
|
+
cucumber-messages (13.1.0)
|
|
56
54
|
protobuf-cucumber (~> 3.10, >= 3.10.8)
|
|
57
55
|
cucumber-tag-expressions (2.0.4)
|
|
58
|
-
cucumber-wire (
|
|
59
|
-
cucumber-core (~>
|
|
60
|
-
cucumber-cucumber-expressions (~> 10.
|
|
61
|
-
cucumber-messages (~>
|
|
62
|
-
diff-lcs (1.
|
|
56
|
+
cucumber-wire (4.0.1)
|
|
57
|
+
cucumber-core (~> 8.0, >= 8.0.1)
|
|
58
|
+
cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
|
|
59
|
+
cucumber-messages (~> 13.0, >= 13.0.1)
|
|
60
|
+
diff-lcs (1.4.4)
|
|
63
61
|
docile (1.3.2)
|
|
64
62
|
domain_name (0.5.20190701)
|
|
65
63
|
unf (>= 0.0.5, < 1.0.0)
|
|
66
|
-
e2mmap (0.1.0)
|
|
67
64
|
ffi (1.13.1)
|
|
68
|
-
google-protobuf (3.
|
|
65
|
+
google-protobuf (3.13.0)
|
|
69
66
|
googleapis-common-protos-types (1.0.5)
|
|
70
67
|
google-protobuf (~> 3.11)
|
|
71
|
-
grpc (1.
|
|
72
|
-
google-protobuf (~> 3.
|
|
68
|
+
grpc (1.32.0)
|
|
69
|
+
google-protobuf (~> 3.13)
|
|
73
70
|
googleapis-common-protos-types (~> 1.0)
|
|
74
|
-
grpc-tools (1.
|
|
71
|
+
grpc-tools (1.32.0)
|
|
75
72
|
http-accept (1.7.0)
|
|
76
73
|
http-cookie (1.0.3)
|
|
77
74
|
domain_name (~> 0.5)
|
|
78
|
-
i18n (1.8.
|
|
75
|
+
i18n (1.8.5)
|
|
79
76
|
concurrent-ruby (~> 1.0)
|
|
80
|
-
|
|
81
|
-
json (2.3.0)
|
|
82
|
-
maruku (0.7.3)
|
|
77
|
+
json (2.3.1)
|
|
83
78
|
middleware (0.1.0)
|
|
84
79
|
mime-types (3.3.1)
|
|
85
80
|
mime-types-data (~> 3.2015)
|
|
86
81
|
mime-types-data (3.2020.0512)
|
|
87
|
-
|
|
88
|
-
minitest (5.14.1)
|
|
82
|
+
minitest (5.14.2)
|
|
89
83
|
multi_test (0.1.2)
|
|
90
84
|
mustermann (1.1.1)
|
|
91
85
|
ruby2_keywords (~> 0.0.1)
|
|
92
86
|
netrc (0.11.0)
|
|
93
|
-
nio4r (2.5.
|
|
94
|
-
nokogiri (1.10.10)
|
|
95
|
-
mini_portile2 (~> 2.4.0)
|
|
87
|
+
nio4r (2.5.4)
|
|
96
88
|
parallel (1.19.2)
|
|
97
|
-
parser (2.7.
|
|
89
|
+
parser (2.7.2.0)
|
|
98
90
|
ast (~> 2.4.1)
|
|
99
91
|
protobuf-cucumber (3.10.8)
|
|
100
92
|
activesupport (>= 3.2)
|
|
101
93
|
middleware
|
|
102
94
|
thor
|
|
103
95
|
thread_safe
|
|
104
|
-
puma (
|
|
96
|
+
puma (5.0.2)
|
|
105
97
|
nio4r (~> 2.0)
|
|
106
98
|
rack (2.2.3)
|
|
107
|
-
rack-protection (2.0
|
|
99
|
+
rack-protection (2.1.0)
|
|
108
100
|
rack
|
|
109
101
|
rainbow (3.0.0)
|
|
110
102
|
rake (13.0.1)
|
|
111
|
-
regexp_parser (1.
|
|
103
|
+
regexp_parser (1.8.2)
|
|
112
104
|
rest-client (2.1.0)
|
|
113
105
|
http-accept (>= 1.7.0, < 2.0)
|
|
114
106
|
http-cookie (>= 1.0.2, < 2.0)
|
|
115
107
|
mime-types (>= 1.16, < 4.0)
|
|
116
108
|
netrc (~> 0.8)
|
|
117
|
-
reverse_markdown (2.0.0)
|
|
118
|
-
nokogiri
|
|
119
109
|
rexml (3.2.4)
|
|
120
110
|
rspec (3.9.0)
|
|
121
111
|
rspec-core (~> 3.9.0)
|
|
@@ -126,7 +116,7 @@ GEM
|
|
|
126
116
|
benchmark-perf (~> 0.6)
|
|
127
117
|
benchmark-trend (~> 0.4)
|
|
128
118
|
rspec (>= 3.0)
|
|
129
|
-
rspec-core (3.9.
|
|
119
|
+
rspec-core (3.9.3)
|
|
130
120
|
rspec-support (~> 3.9.3)
|
|
131
121
|
rspec-expectations (3.9.2)
|
|
132
122
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
@@ -135,17 +125,17 @@ GEM
|
|
|
135
125
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
136
126
|
rspec-support (~> 3.9.0)
|
|
137
127
|
rspec-support (3.9.3)
|
|
138
|
-
rubocop (0.
|
|
128
|
+
rubocop (1.0.0)
|
|
139
129
|
parallel (~> 1.10)
|
|
140
|
-
parser (>= 2.7.1.
|
|
130
|
+
parser (>= 2.7.1.5)
|
|
141
131
|
rainbow (>= 2.2.2, < 4.0)
|
|
142
|
-
regexp_parser (>= 1.
|
|
132
|
+
regexp_parser (>= 1.8)
|
|
143
133
|
rexml
|
|
144
|
-
rubocop-ast (>= 0.
|
|
134
|
+
rubocop-ast (>= 0.6.0)
|
|
145
135
|
ruby-progressbar (~> 1.7)
|
|
146
136
|
unicode-display_width (>= 1.4.0, < 2.0)
|
|
147
|
-
rubocop-ast (
|
|
148
|
-
parser (>= 2.7.
|
|
137
|
+
rubocop-ast (1.0.0)
|
|
138
|
+
parser (>= 2.7.1.5)
|
|
149
139
|
ruby-progressbar (1.10.1)
|
|
150
140
|
ruby2_keywords (0.0.2)
|
|
151
141
|
simplecov (0.17.1)
|
|
@@ -153,25 +143,11 @@ GEM
|
|
|
153
143
|
json (>= 1.8, < 3)
|
|
154
144
|
simplecov-html (~> 0.10.0)
|
|
155
145
|
simplecov-html (0.10.2)
|
|
156
|
-
sinatra (2.0
|
|
146
|
+
sinatra (2.1.0)
|
|
157
147
|
mustermann (~> 1.0)
|
|
158
|
-
rack (~> 2.
|
|
159
|
-
rack-protection (= 2.0
|
|
160
|
-
tilt (~> 2.0)
|
|
161
|
-
solargraph (0.39.11)
|
|
162
|
-
backport (~> 1.1)
|
|
163
|
-
benchmark
|
|
164
|
-
bundler (>= 1.17.2)
|
|
165
|
-
e2mmap
|
|
166
|
-
jaro_winkler (~> 1.5)
|
|
167
|
-
maruku (~> 0.7, >= 0.7.3)
|
|
168
|
-
nokogiri (~> 1.9, >= 1.9.1)
|
|
169
|
-
parser (~> 2.3)
|
|
170
|
-
reverse_markdown (>= 1.0.5, < 3)
|
|
171
|
-
rubocop (~> 0.52)
|
|
172
|
-
thor (~> 1.0)
|
|
148
|
+
rack (~> 2.2)
|
|
149
|
+
rack-protection (= 2.1.0)
|
|
173
150
|
tilt (~> 2.0)
|
|
174
|
-
yard (~> 0.9, >= 0.9.24)
|
|
175
151
|
sys-uname (1.2.1)
|
|
176
152
|
ffi (>= 1.0.0)
|
|
177
153
|
thor (1.0.1)
|
|
@@ -183,8 +159,7 @@ GEM
|
|
|
183
159
|
unf_ext
|
|
184
160
|
unf_ext (0.0.7.7)
|
|
185
161
|
unicode-display_width (1.7.0)
|
|
186
|
-
|
|
187
|
-
zeitwerk (2.3.1)
|
|
162
|
+
zeitwerk (2.4.0)
|
|
188
163
|
|
|
189
164
|
PLATFORMS
|
|
190
165
|
ruby
|
|
@@ -194,9 +169,8 @@ DEPENDENCIES
|
|
|
194
169
|
grpc-tools (>= 1, < 2)
|
|
195
170
|
nonnative!
|
|
196
171
|
rake (~> 13.0, >= 13.0.1)
|
|
197
|
-
rubocop (~> 0
|
|
172
|
+
rubocop (~> 1.0)
|
|
198
173
|
simplecov (~> 0.17.1)
|
|
199
|
-
solargraph (~> 0.39.11)
|
|
200
174
|
|
|
201
175
|
BUNDLED WITH
|
|
202
176
|
2.1.4
|
data/Makefile
CHANGED
data/README.md
CHANGED
|
@@ -37,10 +37,19 @@ Configure nonnative with the following:
|
|
|
37
37
|
- A timeout value.
|
|
38
38
|
- Port to verify.
|
|
39
39
|
- The class for servers.
|
|
40
|
-
- The
|
|
40
|
+
- The log for servers/processes
|
|
41
41
|
- The strategy for processes/servers.
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
|
|
43
|
+
### Strategy
|
|
44
|
+
|
|
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.
|
|
44
53
|
|
|
45
54
|
### Processes
|
|
46
55
|
|
|
@@ -50,12 +59,12 @@ Setup it up programmatically:
|
|
|
50
59
|
require 'nonnative'
|
|
51
60
|
|
|
52
61
|
Nonnative.configure do |config|
|
|
53
|
-
config.strategy = :startup
|
|
62
|
+
config.strategy = :startup
|
|
54
63
|
|
|
55
64
|
config.process do |d|
|
|
56
65
|
d.name = 'start_1'
|
|
57
66
|
d.command = 'features/support/bin/start 12_321'
|
|
58
|
-
d.timeout =
|
|
67
|
+
d.timeout = config.strategy.timeout
|
|
59
68
|
d.port = 12_321
|
|
60
69
|
d.log = 'features/logs/12_321.log'
|
|
61
70
|
d.signal = 'INT' # Possible values are described in Signal.list.keys
|
|
@@ -364,3 +373,39 @@ server = Nonnative.pool.server_by_name(name)
|
|
|
364
373
|
server.proxy.close_all # To use close_all.
|
|
365
374
|
server.proxy.reset # To reset it back to a good state.
|
|
366
375
|
```
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
### Go
|
|
379
|
+
|
|
380
|
+
As we love using go as a language for services we have added support to start binaries with defined parameters. This expects that you build your services in the format of `command sub_command --params`
|
|
381
|
+
|
|
382
|
+
To get this to work you will need to create a `main_test.go` file with these contents:
|
|
383
|
+
|
|
384
|
+
```go
|
|
385
|
+
// +build features
|
|
386
|
+
|
|
387
|
+
package main
|
|
388
|
+
|
|
389
|
+
import (
|
|
390
|
+
"testing"
|
|
391
|
+
)
|
|
392
|
+
|
|
393
|
+
// TestFeatures is a hack that allows us to figure out what the coverage is during
|
|
394
|
+
// integration tests. I would not recommend that you use a binary built using
|
|
395
|
+
// this hack outside of a test suite.
|
|
396
|
+
func TestFeatures(t *testing.T) {
|
|
397
|
+
main()
|
|
398
|
+
}
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
Then to compile this binary you will need to do the following:
|
|
402
|
+
|
|
403
|
+
```sh
|
|
404
|
+
go test -mod vendor -c -tags features -covermode=count -o your_binary -coverpkg=./... github.com/your_location
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
Then to get an executable you do the following:
|
|
408
|
+
|
|
409
|
+
```ruby
|
|
410
|
+
Nonnative::GoCommand.new('your_binary', 'reports').executable('sub_command', '--config config.yaml')
|
|
411
|
+
```
|
data/lib/nonnative.rb
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
require 'socket'
|
|
4
4
|
require 'timeout'
|
|
5
|
-
require 'thwait'
|
|
6
5
|
require 'yaml'
|
|
6
|
+
require 'open3'
|
|
7
7
|
|
|
8
8
|
require 'grpc'
|
|
9
9
|
require 'sinatra'
|
|
@@ -29,7 +29,6 @@ require 'nonnative/server'
|
|
|
29
29
|
require 'nonnative/http_client'
|
|
30
30
|
require 'nonnative/http_server'
|
|
31
31
|
require 'nonnative/grpc_server'
|
|
32
|
-
require 'nonnative/grpc_server'
|
|
33
32
|
require 'nonnative/observability'
|
|
34
33
|
require 'nonnative/proxy_factory'
|
|
35
34
|
require 'nonnative/proxy'
|
|
@@ -40,6 +39,8 @@ require 'nonnative/close_all_socket_pair'
|
|
|
40
39
|
require 'nonnative/delay_socket_pair'
|
|
41
40
|
require 'nonnative/invalid_data_socket_pair'
|
|
42
41
|
require 'nonnative/socket_pair_factory'
|
|
42
|
+
require 'nonnative/strategy'
|
|
43
|
+
require 'nonnative/go_command'
|
|
43
44
|
|
|
44
45
|
module Nonnative
|
|
45
46
|
class << self
|
|
@@ -40,28 +40,35 @@ module Nonnative
|
|
|
40
40
|
s.port = fd['port']
|
|
41
41
|
s.log = fd['log']
|
|
42
42
|
|
|
43
|
-
proxy
|
|
44
|
-
|
|
45
|
-
if proxy
|
|
46
|
-
s.proxy = {
|
|
47
|
-
type: proxy['type'],
|
|
48
|
-
port: proxy['port'],
|
|
49
|
-
log: proxy['log'],
|
|
50
|
-
options: proxy['options']
|
|
51
|
-
}
|
|
52
|
-
end
|
|
43
|
+
proxy s, fd['proxy']
|
|
53
44
|
end
|
|
54
45
|
end
|
|
55
46
|
end
|
|
47
|
+
|
|
48
|
+
def proxy(server, proxy)
|
|
49
|
+
return unless proxy
|
|
50
|
+
|
|
51
|
+
server.proxy = {
|
|
52
|
+
type: proxy['type'],
|
|
53
|
+
port: proxy['port'],
|
|
54
|
+
log: proxy['log'],
|
|
55
|
+
options: proxy['options']
|
|
56
|
+
}
|
|
57
|
+
end
|
|
56
58
|
end
|
|
57
59
|
|
|
58
60
|
def initialize
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
@strategy = Strategy.new
|
|
62
|
+
@processes = []
|
|
63
|
+
@servers = []
|
|
62
64
|
end
|
|
63
65
|
|
|
64
|
-
attr_accessor :
|
|
66
|
+
attr_accessor :processes, :servers
|
|
67
|
+
attr_reader :strategy
|
|
68
|
+
|
|
69
|
+
def strategy=(value)
|
|
70
|
+
@strategy = Strategy.new(value)
|
|
71
|
+
end
|
|
65
72
|
|
|
66
73
|
def process
|
|
67
74
|
process = Nonnative::ConfigurationProcess.new
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Nonnative
|
|
4
|
+
class GoCommand
|
|
5
|
+
def initialize(main, output)
|
|
6
|
+
@main = main
|
|
7
|
+
@output = output
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def executable(cmd, *params)
|
|
11
|
+
params = params.join(' ')
|
|
12
|
+
"#{main} #{flags(cmd, params).join(' ')} #{cmd} #{params}"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def execute(cmd, *params)
|
|
16
|
+
Open3.popen3(executable(cmd, params)) do |_stdin, stdout, stderr, wait_thr|
|
|
17
|
+
return stdout.read, stderr.read, wait_thr.value
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
attr_reader :main, :output
|
|
24
|
+
|
|
25
|
+
def flags(cmd, params)
|
|
26
|
+
m = File.basename(main, File.extname(main))
|
|
27
|
+
p = params.gsub(/\W/, '')
|
|
28
|
+
path = "#{output}/#{m}-#{cmd}-#{p}"
|
|
29
|
+
|
|
30
|
+
[
|
|
31
|
+
"-test.cpuprofile=#{path}-cpu.prof",
|
|
32
|
+
"-test.memprofile=#{path}-mem.prof",
|
|
33
|
+
"-test.blockprofile=#{path}-block.prof",
|
|
34
|
+
"-test.mutexprofile=#{path}-mutex.prof",
|
|
35
|
+
"-test.coverprofile=#{path}.cov",
|
|
36
|
+
"-test.trace=#{path}-trace.out"
|
|
37
|
+
]
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
data/lib/nonnative/pool.rb
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
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
|
data/lib/nonnative/timeout.rb
CHANGED
data/lib/nonnative/version.rb
CHANGED
data/nonnative.gemspec
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
lib = File.expand_path('lib', __dir__)
|
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
|
+
|
|
5
6
|
require 'nonnative/version'
|
|
6
7
|
|
|
7
8
|
Gem::Specification.new do |spec|
|
|
@@ -14,20 +15,18 @@ Gem::Specification.new do |spec|
|
|
|
14
15
|
spec.description = spec.summary
|
|
15
16
|
spec.homepage = 'https://github.com/alexfalkowski/nonnative'
|
|
16
17
|
spec.license = 'Unlicense'
|
|
17
|
-
|
|
18
|
-
# Specify which files should be added to the gem when it is released.
|
|
19
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
20
18
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
21
19
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
22
20
|
end
|
|
23
21
|
spec.bindir = 'exe'
|
|
24
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
25
23
|
spec.require_paths = ['lib']
|
|
24
|
+
spec.required_ruby_version = ['>= 2.7.0', '< 2.8.0']
|
|
26
25
|
|
|
27
26
|
spec.add_dependency 'concurrent-ruby', '~> 1.0', '>= 1.0.5'
|
|
28
|
-
spec.add_dependency 'cucumber', ['>=
|
|
27
|
+
spec.add_dependency 'cucumber', ['>= 5', '< 6']
|
|
29
28
|
spec.add_dependency 'grpc', ['>= 1', '< 2']
|
|
30
|
-
spec.add_dependency 'puma', '~>
|
|
29
|
+
spec.add_dependency 'puma', '~> 5.0'
|
|
31
30
|
spec.add_dependency 'rest-client', '~> 2.1'
|
|
32
31
|
spec.add_dependency 'rspec-benchmark', '~> 0.6.0'
|
|
33
32
|
spec.add_dependency 'rspec-expectations', '~> 3.9', '>= 3.9.2'
|
|
@@ -36,7 +35,6 @@ Gem::Specification.new do |spec|
|
|
|
36
35
|
spec.add_development_dependency 'bundler', '~> 2.1', '>= 2.1.4'
|
|
37
36
|
spec.add_development_dependency 'grpc-tools', ['>= 1', '< 2']
|
|
38
37
|
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.1'
|
|
39
|
-
spec.add_development_dependency 'rubocop', '~> 0
|
|
38
|
+
spec.add_development_dependency 'rubocop', '~> 1.0'
|
|
40
39
|
spec.add_development_dependency 'simplecov', '~> 0.17.1'
|
|
41
|
-
spec.add_development_dependency 'solargraph', '~> 0.39.11'
|
|
42
40
|
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.
|
|
4
|
+
version: 1.31.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alex Falkowski
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-10-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: concurrent-ruby
|
|
@@ -36,20 +36,20 @@ dependencies:
|
|
|
36
36
|
requirements:
|
|
37
37
|
- - ">="
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '
|
|
39
|
+
version: '5'
|
|
40
40
|
- - "<"
|
|
41
41
|
- !ruby/object:Gem::Version
|
|
42
|
-
version: '
|
|
42
|
+
version: '6'
|
|
43
43
|
type: :runtime
|
|
44
44
|
prerelease: false
|
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
|
46
46
|
requirements:
|
|
47
47
|
- - ">="
|
|
48
48
|
- !ruby/object:Gem::Version
|
|
49
|
-
version: '
|
|
49
|
+
version: '5'
|
|
50
50
|
- - "<"
|
|
51
51
|
- !ruby/object:Gem::Version
|
|
52
|
-
version: '
|
|
52
|
+
version: '6'
|
|
53
53
|
- !ruby/object:Gem::Dependency
|
|
54
54
|
name: grpc
|
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -76,20 +76,14 @@ dependencies:
|
|
|
76
76
|
requirements:
|
|
77
77
|
- - "~>"
|
|
78
78
|
- !ruby/object:Gem::Version
|
|
79
|
-
version: '
|
|
80
|
-
- - ">="
|
|
81
|
-
- !ruby/object:Gem::Version
|
|
82
|
-
version: 4.3.3
|
|
79
|
+
version: '5.0'
|
|
83
80
|
type: :runtime
|
|
84
81
|
prerelease: false
|
|
85
82
|
version_requirements: !ruby/object:Gem::Requirement
|
|
86
83
|
requirements:
|
|
87
84
|
- - "~>"
|
|
88
85
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '
|
|
90
|
-
- - ">="
|
|
91
|
-
- !ruby/object:Gem::Version
|
|
92
|
-
version: 4.3.3
|
|
86
|
+
version: '5.0'
|
|
93
87
|
- !ruby/object:Gem::Dependency
|
|
94
88
|
name: rest-client
|
|
95
89
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -224,14 +218,14 @@ dependencies:
|
|
|
224
218
|
requirements:
|
|
225
219
|
- - "~>"
|
|
226
220
|
- !ruby/object:Gem::Version
|
|
227
|
-
version: 0
|
|
221
|
+
version: '1.0'
|
|
228
222
|
type: :development
|
|
229
223
|
prerelease: false
|
|
230
224
|
version_requirements: !ruby/object:Gem::Requirement
|
|
231
225
|
requirements:
|
|
232
226
|
- - "~>"
|
|
233
227
|
- !ruby/object:Gem::Version
|
|
234
|
-
version: 0
|
|
228
|
+
version: '1.0'
|
|
235
229
|
- !ruby/object:Gem::Dependency
|
|
236
230
|
name: simplecov
|
|
237
231
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -246,20 +240,6 @@ dependencies:
|
|
|
246
240
|
- - "~>"
|
|
247
241
|
- !ruby/object:Gem::Version
|
|
248
242
|
version: 0.17.1
|
|
249
|
-
- !ruby/object:Gem::Dependency
|
|
250
|
-
name: solargraph
|
|
251
|
-
requirement: !ruby/object:Gem::Requirement
|
|
252
|
-
requirements:
|
|
253
|
-
- - "~>"
|
|
254
|
-
- !ruby/object:Gem::Version
|
|
255
|
-
version: 0.39.11
|
|
256
|
-
type: :development
|
|
257
|
-
prerelease: false
|
|
258
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
259
|
-
requirements:
|
|
260
|
-
- - "~>"
|
|
261
|
-
- !ruby/object:Gem::Version
|
|
262
|
-
version: 0.39.11
|
|
263
243
|
description: Allows you to keep using the power of ruby to test other systems
|
|
264
244
|
email:
|
|
265
245
|
- alexrfalkowski@gmail.com
|
|
@@ -278,7 +258,6 @@ files:
|
|
|
278
258
|
- LICENSE
|
|
279
259
|
- Makefile
|
|
280
260
|
- README.md
|
|
281
|
-
- Rakefile
|
|
282
261
|
- bin/console
|
|
283
262
|
- bin/setup
|
|
284
263
|
- lib/nonnative.rb
|
|
@@ -292,6 +271,7 @@ files:
|
|
|
292
271
|
- lib/nonnative/delay_socket_pair.rb
|
|
293
272
|
- lib/nonnative/error.rb
|
|
294
273
|
- lib/nonnative/fault_injection_proxy.rb
|
|
274
|
+
- lib/nonnative/go_command.rb
|
|
295
275
|
- lib/nonnative/grpc_server.rb
|
|
296
276
|
- lib/nonnative/http_client.rb
|
|
297
277
|
- lib/nonnative/http_server.rb
|
|
@@ -310,6 +290,7 @@ files:
|
|
|
310
290
|
- lib/nonnative/start_error.rb
|
|
311
291
|
- lib/nonnative/startup.rb
|
|
312
292
|
- lib/nonnative/stop_error.rb
|
|
293
|
+
- lib/nonnative/strategy.rb
|
|
313
294
|
- lib/nonnative/timeout.rb
|
|
314
295
|
- lib/nonnative/version.rb
|
|
315
296
|
- nonnative.gemspec
|
|
@@ -318,7 +299,7 @@ homepage: https://github.com/alexfalkowski/nonnative
|
|
|
318
299
|
licenses:
|
|
319
300
|
- Unlicense
|
|
320
301
|
metadata: {}
|
|
321
|
-
post_install_message:
|
|
302
|
+
post_install_message:
|
|
322
303
|
rdoc_options: []
|
|
323
304
|
require_paths:
|
|
324
305
|
- lib
|
|
@@ -326,15 +307,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
326
307
|
requirements:
|
|
327
308
|
- - ">="
|
|
328
309
|
- !ruby/object:Gem::Version
|
|
329
|
-
version:
|
|
310
|
+
version: 2.7.0
|
|
311
|
+
- - "<"
|
|
312
|
+
- !ruby/object:Gem::Version
|
|
313
|
+
version: 2.8.0
|
|
330
314
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
331
315
|
requirements:
|
|
332
316
|
- - ">="
|
|
333
317
|
- !ruby/object:Gem::Version
|
|
334
318
|
version: '0'
|
|
335
319
|
requirements: []
|
|
336
|
-
rubygems_version: 3.
|
|
337
|
-
signing_key:
|
|
320
|
+
rubygems_version: 3.1.2
|
|
321
|
+
signing_key:
|
|
338
322
|
specification_version: 4
|
|
339
323
|
summary: Allows you to keep using the power of ruby to test other systems
|
|
340
324
|
test_files: []
|
data/Rakefile
DELETED