nonnative 1.74.0 → 1.75.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: acae0845e2d98d06c04910a7ead3b22ff614926878afb268e37f916c74f470e3
4
- data.tar.gz: 04705b7c6f13f20f9dcf67cee5e9a63bf835abc927a8ccaff196fcf2748a3e4f
3
+ metadata.gz: 35c9918f534eb4242b02b49a1f150c4c4e9ec29c7eb2e0ee194d5205412d4b37
4
+ data.tar.gz: 8c2745e02814c410981ccb128b80b703b43ba97136f9e5c34071218a4228ccbc
5
5
  SHA512:
6
- metadata.gz: d539314d85773631c3880930aae5a2ffbe51bcd448511fed27fb611294410af0062af8806c0527a1bb2616ddaaff1de62f897a3793784502009ceac74ab95ecf
7
- data.tar.gz: b1545342354a75d7010122304bebda429cb01eeb5f563130b4a79d293a66bf44ec27fd6e75a558278405ed8db74d567fddf8cdd7e1859addf61a23d99c4cac6c
6
+ metadata.gz: 8190db81a17ac577757b3756b016db3a494347e7124c9c7519b9ed3f723bd3b1c2332a148ddcee341f8d13090f6f286f84580ca2036f174cd81bc1d02af85a93
7
+ data.tar.gz: 4c775aa03c5598b3464b454cbb397404b268d1b13ca47f7309b7b7286020b87195b261b6ae8a037090f0141d2d5b865c939b84e74b7964582b3fb4c8bbc3f90b
data/.rubocop.yml CHANGED
@@ -5,6 +5,7 @@ AllCops:
5
5
  Exclude:
6
6
  - 'bin/**/*'
7
7
  - 'vendor/**/*'
8
+ - 'test/grpc/**/*'
8
9
 
9
10
  Layout/LineLength:
10
11
  Max: 150
data/CHANGELOG.md CHANGED
@@ -6,6 +6,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ ## [v1.75.0](https://github.com/alexfalkowski/nonnative/releases/tag/v1.75.0) - 2023-11-18
10
+
11
+ - [`dba4d0c`](https://github.com/alexfalkowski/nonnative/commit/dba4d0c4281226b818f95aee637b7433005d4aba) feat: add header (#280)
12
+ - [`9810746`](https://github.com/alexfalkowski/nonnative/commit/98107465057cebcd2c165e50fbfacebd40b7cece) build(deps): update bin (#278)
13
+
14
+ ## [v1.74.1](https://github.com/alexfalkowski/nonnative/releases/tag/v1.74.1) - 2023-11-16
15
+
16
+ - [`57a67b4`](https://github.com/alexfalkowski/nonnative/commit/57a67b4fde47cf1ab1a8299d759cffcc6cd821f6) fix(http): do not override opts (#277)
17
+
9
18
  ## [v1.74.0](https://github.com/alexfalkowski/nonnative/releases/tag/v1.74.0) - 2023-11-16
10
19
 
11
20
  - [`82fa7dc`](https://github.com/alexfalkowski/nonnative/commit/82fa7dccda6acd5bccc2bc146decf8d1bad850db) feat(http): use resource so we can use opts (#276)
data/Gemfile CHANGED
@@ -10,4 +10,3 @@ gemspec
10
10
  gem 'bundler'
11
11
  gem 'coveralls_reborn'
12
12
  gem 'rubocop'
13
- gem 'solargraph'
data/Gemfile.lock CHANGED
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nonnative (1.74.0)
4
+ nonnative (1.75.0)
5
5
  concurrent-ruby (~> 1.0, >= 1.0.5)
6
+ config (~> 5.0)
6
7
  cucumber (>= 7, < 10)
7
8
  get_process_mem (~> 0.2.1)
8
9
  grpc (>= 1, < 2)
@@ -16,13 +17,14 @@ GEM
16
17
  remote: https://rubygems.org/
17
18
  specs:
18
19
  ast (2.4.2)
19
- backport (1.2.0)
20
- benchmark (0.3.0)
21
20
  benchmark-malloc (0.2.0)
22
21
  benchmark-perf (0.6.0)
23
22
  benchmark-trend (0.4.0)
24
23
  builder (3.2.4)
25
24
  concurrent-ruby (1.2.2)
25
+ config (5.0.0)
26
+ deep_merge (~> 1.2, >= 1.2.1)
27
+ dry-validation (~> 1.0, >= 1.0.0)
26
28
  coveralls_reborn (0.28.0)
27
29
  simplecov (~> 0.22.0)
28
30
  term-ansicolor (~> 1.7)
@@ -52,28 +54,63 @@ GEM
52
54
  cucumber-messages (>= 18.0, < 22.1)
53
55
  cucumber-messages (22.0.0)
54
56
  cucumber-tag-expressions (5.0.6)
57
+ deep_merge (1.2.2)
55
58
  diff-lcs (1.5.0)
56
59
  docile (1.4.0)
57
60
  domain_name (0.6.20231109)
58
- e2mmap (0.1.0)
61
+ dry-configurable (1.1.0)
62
+ dry-core (~> 1.0, < 2)
63
+ zeitwerk (~> 2.6)
64
+ dry-core (1.0.1)
65
+ concurrent-ruby (~> 1.0)
66
+ zeitwerk (~> 2.6)
67
+ dry-inflector (1.0.0)
68
+ dry-initializer (3.1.1)
69
+ dry-logic (1.5.0)
70
+ concurrent-ruby (~> 1.0)
71
+ dry-core (~> 1.0, < 2)
72
+ zeitwerk (~> 2.6)
73
+ dry-schema (1.13.3)
74
+ concurrent-ruby (~> 1.0)
75
+ dry-configurable (~> 1.0, >= 1.0.1)
76
+ dry-core (~> 1.0, < 2)
77
+ dry-initializer (~> 3.0)
78
+ dry-logic (>= 1.4, < 2)
79
+ dry-types (>= 1.7, < 2)
80
+ zeitwerk (~> 2.6)
81
+ dry-types (1.7.1)
82
+ concurrent-ruby (~> 1.0)
83
+ dry-core (~> 1.0)
84
+ dry-inflector (~> 1.0)
85
+ dry-logic (~> 1.4)
86
+ zeitwerk (~> 2.6)
87
+ dry-validation (1.10.0)
88
+ concurrent-ruby (~> 1.0)
89
+ dry-core (~> 1.0, < 2)
90
+ dry-initializer (~> 3.0)
91
+ dry-schema (>= 1.12, < 2)
92
+ zeitwerk (~> 2.6)
59
93
  ffi (1.16.3)
60
94
  get_process_mem (0.2.7)
61
95
  ffi (~> 1.0)
62
- google-protobuf (3.25.0-x86_64-darwin)
96
+ google-protobuf (3.25.1-arm64-darwin)
97
+ google-protobuf (3.25.1-x86_64-darwin)
98
+ google-protobuf (3.25.1-x86_64-linux)
63
99
  googleapis-common-protos-types (1.10.0)
64
100
  google-protobuf (~> 3.18)
101
+ grpc (1.59.2)
102
+ google-protobuf (~> 3.24)
103
+ googleapis-common-protos-types (~> 1.0)
65
104
  grpc (1.59.2-x86_64-darwin)
66
105
  google-protobuf (~> 3.24)
67
106
  googleapis-common-protos-types (~> 1.0)
107
+ grpc (1.59.2-x86_64-linux)
108
+ google-protobuf (~> 3.24)
109
+ googleapis-common-protos-types (~> 1.0)
68
110
  http-accept (1.7.0)
69
111
  http-cookie (1.0.5)
70
112
  domain_name (~> 0.5)
71
- jaro_winkler (1.5.6)
72
113
  json (2.6.3)
73
- kramdown (2.4.0)
74
- rexml
75
- kramdown-parser-gfm (1.1.0)
76
- kramdown (~> 2.0)
77
114
  language_server-protocol (3.17.0.3)
78
115
  mime-types (3.5.1)
79
116
  mime-types-data (~> 3.2015)
@@ -83,13 +120,7 @@ GEM
83
120
  mustermann (3.0.0)
84
121
  ruby2_keywords (~> 0.0.1)
85
122
  netrc (0.11.0)
86
- nio4r (2.5.9)
87
- nokogiri (1.15.4-arm64-darwin)
88
- racc (~> 1.4)
89
- nokogiri (1.15.4-x86_64-darwin)
90
- racc (~> 1.4)
91
- nokogiri (1.15.4-x86_64-linux)
92
- racc (~> 1.4)
123
+ nio4r (2.6.0)
93
124
  parallel (1.23.0)
94
125
  parser (3.2.2.4)
95
126
  ast (~> 2.4.1)
@@ -101,15 +132,12 @@ GEM
101
132
  rack-protection (3.1.0)
102
133
  rack (~> 2.2, >= 2.2.4)
103
134
  rainbow (3.1.1)
104
- rbs (2.8.4)
105
135
  regexp_parser (2.8.2)
106
136
  rest-client (2.1.0)
107
137
  http-accept (>= 1.7.0, < 2.0)
108
138
  http-cookie (>= 1.0.2, < 2.0)
109
139
  mime-types (>= 1.16, < 4.0)
110
140
  netrc (~> 0.8)
111
- reverse_markdown (2.1.1)
112
- nokogiri
113
141
  rexml (3.2.6)
114
142
  rspec (3.12.0)
115
143
  rspec-core (~> 3.12.0)
@@ -155,22 +183,6 @@ GEM
155
183
  rack (~> 2.2, >= 2.2.4)
156
184
  rack-protection (= 3.1.0)
157
185
  tilt (~> 2.0)
158
- solargraph (0.49.0)
159
- backport (~> 1.2)
160
- benchmark
161
- bundler (~> 2.0)
162
- diff-lcs (~> 1.4)
163
- e2mmap
164
- jaro_winkler (~> 1.5)
165
- kramdown (~> 2.3)
166
- kramdown-parser-gfm (~> 1.1)
167
- parser (~> 3.0)
168
- rbs (~> 2.0)
169
- reverse_markdown (~> 2.0)
170
- rubocop (~> 1.38)
171
- thor (~> 1.0)
172
- tilt (~> 2.0)
173
- yard (~> 0.9, >= 0.9.24)
174
186
  sync (0.5.0)
175
187
  sys-uname (1.2.3)
176
188
  ffi (~> 1.1)
@@ -181,7 +193,7 @@ GEM
181
193
  tins (1.32.1)
182
194
  sync
183
195
  unicode-display_width (2.5.0)
184
- yard (0.9.34)
196
+ zeitwerk (2.6.12)
185
197
 
186
198
  PLATFORMS
187
199
  arm64-darwin-22
@@ -193,7 +205,6 @@ DEPENDENCIES
193
205
  coveralls_reborn
194
206
  nonnative!
195
207
  rubocop
196
- solargraph
197
208
 
198
209
  BUNDLED WITH
199
210
  2.3.9
@@ -11,11 +11,11 @@ module Nonnative
11
11
  attr_accessor :processes, :servers, :services
12
12
 
13
13
  def load_file(path)
14
- file = YAML.load_file(path)
14
+ cfg = Nonnative.configurations(path)
15
15
 
16
- add_processes(file)
17
- add_servers(file)
18
- add_services(file)
16
+ add_processes(cfg)
17
+ add_servers(cfg)
18
+ add_services(cfg)
19
19
  end
20
20
 
21
21
  def process
@@ -48,59 +48,59 @@ module Nonnative
48
48
 
49
49
  private
50
50
 
51
- def add_processes(file)
52
- processes = file['processes'] || []
51
+ def add_processes(cfg)
52
+ processes = cfg.processes || []
53
53
  processes.each do |fd|
54
54
  process do |d|
55
- d.name = fd['name']
55
+ d.name = fd.name
56
56
  d.command = command(fd)
57
- d.timeout = fd['timeout']
58
- d.port = fd['port']
59
- d.log = fd['log']
60
- d.signal = fd['signal']
61
- d.environment = fd['environment']
57
+ d.timeout = fd.timeout
58
+ d.port = fd.port
59
+ d.log = fd.log
60
+ d.signal = fd.signal
61
+ d.environment = fd.environment
62
62
 
63
- proxy d, fd['proxy']
63
+ proxy d, fd.proxy
64
64
  end
65
65
  end
66
66
  end
67
67
 
68
68
  def command(process)
69
- go = process['go']
69
+ go = process.go
70
70
  if go
71
- params = go['parameters'] || []
72
- tools = go['tools'] || []
71
+ params = go.parameters || []
72
+ tools = go.tools || []
73
73
 
74
- -> { Nonnative.go_executable(tools, go['output'], go['executable'], go['command'], *params) }
74
+ -> { Nonnative.go_executable(tools, go.output, go.executable, go.command, *params) }
75
75
  else
76
- -> { process['command'] }
76
+ -> { process.command }
77
77
  end
78
78
  end
79
79
 
80
- def add_servers(file)
81
- servers = file['servers'] || []
80
+ def add_servers(cfg)
81
+ servers = cfg.servers || []
82
82
  servers.each do |fd|
83
83
  server do |s|
84
- s.name = fd['name']
85
- s.klass = Object.const_get(fd['class'])
86
- s.timeout = fd['timeout']
87
- s.port = fd['port']
88
- s.log = fd['log']
84
+ s.name = fd.name
85
+ s.klass = Object.const_get(fd.class)
86
+ s.timeout = fd.timeout
87
+ s.port = fd.port
88
+ s.log = fd.log
89
89
 
90
- proxy s, fd['proxy']
90
+ proxy s, fd.proxy
91
91
  end
92
92
  end
93
93
  end
94
94
 
95
- def add_services(file)
96
- services = file['services'] || []
95
+ def add_services(cfg)
96
+ services = cfg.services || []
97
97
  services.each do |fd|
98
98
  service do |s|
99
- s.name = fd['name']
100
- s.host = fd['host'] if fd['host']
101
- s.port = fd['port']
99
+ s.name = fd.name
100
+ s.host = fd.host if fd.host
101
+ s.port = fd.port
102
102
 
103
- proxy s, fd['proxy']
103
+ proxy s, fd.proxy
104
104
  end
105
105
  end
106
106
  end
@@ -109,13 +109,13 @@ module Nonnative
109
109
  return unless proxy
110
110
 
111
111
  p = {
112
- kind: proxy['kind'],
113
- port: proxy['port'],
114
- log: proxy['log'],
115
- options: proxy['options']
112
+ kind: proxy.kind,
113
+ port: proxy.port,
114
+ log: proxy.log,
115
+ options: proxy.options
116
116
  }
117
117
 
118
- p[:host] = proxy['host'] if proxy['host']
118
+ p[:host] = proxy.host if proxy.host
119
119
 
120
120
  runner.proxy = p
121
121
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nonnative
4
+ class Header
5
+ class << self
6
+ def http_user_agent(user_agent)
7
+ { user_agent: }
8
+ end
9
+
10
+ def grpc_user_agent(user_agent)
11
+ { 'grpc.primary_user_agent' => user_agent }
12
+ end
13
+
14
+ def auth_basic(credentials)
15
+ { authorization: "Basic #{Base64.strict_encode64(credentials)}" }
16
+ end
17
+
18
+ def auth_bearer(token)
19
+ { authorization: "Bearer #{token}" }
20
+ end
21
+ end
22
+ end
23
+ end
@@ -3,20 +3,14 @@
3
3
  module Nonnative
4
4
  class Observability < Nonnative::HTTPClient
5
5
  def health(opts = {})
6
- opts[:headers] ||= { content_type: :json, accept: :json }
7
-
8
6
  get('healthz', opts)
9
7
  end
10
8
 
11
9
  def liveness(opts = {})
12
- opts[:headers] ||= { content_type: :json, accept: :json }
13
-
14
10
  get('livez', opts)
15
11
  end
16
12
 
17
13
  def readiness(opts = {})
18
- opts[:headers] ||= { content_type: :json, accept: :json }
19
-
20
14
  get('readyz', opts)
21
15
  end
22
16
 
@@ -52,7 +52,7 @@ module Nonnative
52
52
  end
53
53
 
54
54
  def process_spawn
55
- environment = service.environment || {}
55
+ environment = service.environment.to_h
56
56
  environment = environment.transform_keys(&:to_s).transform_values(&:to_s)
57
57
 
58
58
  environment.each_key do |k|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nonnative
4
- VERSION = '1.74.0'
4
+ VERSION = '1.75.0'
5
5
  end
data/lib/nonnative.rb CHANGED
@@ -12,6 +12,7 @@ require 'rest-client'
12
12
  require 'puma'
13
13
  require 'puma/server'
14
14
  require 'concurrent'
15
+ require 'config'
15
16
  require 'cucumber'
16
17
  require 'get_process_mem'
17
18
  require 'rspec-benchmark'
@@ -49,11 +50,16 @@ require 'nonnative/invalid_data_socket_pair'
49
50
  require 'nonnative/socket_pair_factory'
50
51
  require 'nonnative/go_command'
51
52
  require 'nonnative/cucumber'
53
+ require 'nonnative/header'
52
54
 
53
55
  module Nonnative
54
56
  class << self
55
57
  attr_reader :pool
56
58
 
59
+ def configurations(*files)
60
+ Config.load_files(files)
61
+ end
62
+
57
63
  def log_lines(path, predicate)
58
64
  File.readlines(path).select { |l| predicate.call(l) }
59
65
  end
data/nonnative.gemspec CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.metadata['rubygems_mfa_required'] = 'true'
26
26
 
27
27
  spec.add_dependency 'concurrent-ruby', '~> 1.0', '>= 1.0.5'
28
+ spec.add_dependency 'config', '~> 5.0'
28
29
  spec.add_dependency 'cucumber', '>= 7', '< 10'
29
30
  spec.add_dependency 'get_process_mem', '~> 0.2.1'
30
31
  spec.add_dependency 'grpc', ['>= 1', '< 2']
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.74.0
4
+ version: 1.75.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: 2023-11-16 00:00:00.000000000 Z
11
+ date: 2023-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -30,6 +30,20 @@ dependencies:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 1.0.5
33
+ - !ruby/object:Gem::Dependency
34
+ name: config
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '5.0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '5.0'
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: cucumber
35
49
  requirement: !ruby/object:Gem::Requirement
@@ -202,6 +216,7 @@ files:
202
216
  - lib/nonnative/fault_injection_proxy.rb
203
217
  - lib/nonnative/go_command.rb
204
218
  - lib/nonnative/grpc_server.rb
219
+ - lib/nonnative/header.rb
205
220
  - lib/nonnative/http_client.rb
206
221
  - lib/nonnative/http_server.rb
207
222
  - lib/nonnative/invalid_data_socket_pair.rb