nonnative 2.13.1 → 2.15.1

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: 7f6e8c25babd4ee199097263400e00ebcc5617a82655d8943985f39abed58c86
4
- data.tar.gz: 8717d16d7759563f38255e0134292c8e16838cdde145db2623555b8551d84fee
3
+ metadata.gz: df0fc1bbc0cd9de5368098691bb6c4b812029d70a3d8df236b587874b96e9baf
4
+ data.tar.gz: 431042c13689b0dec97b2064c130a1b104a167fafecda20f6e90aff2e9c22190
5
5
  SHA512:
6
- metadata.gz: 50a983a80efad1e7a79ee2c00e6115d3d972da2301facacc8b77f982bc888c477d07920569eb486d51e424cb58e05c0939135ebd337728c00fa214a3c3d1d10e
7
- data.tar.gz: 1ad10d708a5fc5996e9e8597c936f3efcb0365316d75bb74de6585de82c56464d7d191a484440914968093bd6eb58564f2007469ff87443e79eb3a9dd496afca
6
+ metadata.gz: 5dd146af474ac19e1173b38701a75383dd5650e6a182b529c20d2290c44a037072025eee23cc0f6bd06326fc91690d6da83ff746be5cac443609703d5da59075
7
+ data.tar.gz: 7d7dcbebffa532f5dfe93b4c80ff563d4b0bd5c329a092fc69fcbe1930cd8dac1f191cc04a9ff2dd0de15447b3f446ea134bd9708993e20e7bac780c41122d99
data/.circleci/config.yml CHANGED
@@ -3,7 +3,7 @@ version: 2.1
3
3
  jobs:
4
4
  build:
5
5
  docker:
6
- - image: alexfalkowski/ruby:2.5
6
+ - image: alexfalkowski/ruby:2.15
7
7
  working_directory: ~/nonnative
8
8
  steps:
9
9
  - checkout:
@@ -35,7 +35,7 @@ jobs:
35
35
  resource_class: arm.large
36
36
  sync:
37
37
  docker:
38
- - image: alexfalkowski/release:7.7
38
+ - image: alexfalkowski/release:7.16
39
39
  working_directory: ~/nonnative
40
40
  steps:
41
41
  - checkout:
@@ -46,7 +46,7 @@ jobs:
46
46
  resource_class: arm.large
47
47
  version:
48
48
  docker:
49
- - image: alexfalkowski/release:7.7
49
+ - image: alexfalkowski/release:7.16
50
50
  working_directory: ~/nonnative
51
51
  steps:
52
52
  - checkout:
@@ -58,7 +58,7 @@ jobs:
58
58
  resource_class: arm.large
59
59
  wait-all:
60
60
  docker:
61
- - image: alexfalkowski/ruby:2.5
61
+ - image: alexfalkowski/ruby:2.15
62
62
  steps:
63
63
  - run: echo "all applicable jobs finished"
64
64
  resource_class: arm.large
data/AGENTS.md CHANGED
@@ -1,154 +1,107 @@
1
1
  # AGENTS.md
2
2
 
3
- This repo is the `nonnative` Ruby gem: a Ruby-first harness for end-to-end testing of systems implemented in other languages by starting processes/servers/services, waiting on TCP port readiness, and optionally putting fault-injection proxies in front of them.
3
+ `nonnative` is a Ruby gem for end-to-end testing systems implemented in other
4
+ languages. It starts processes, in-process servers, and proxy-only services,
5
+ waits on TCP readiness/shutdown, and can place fault-injection proxies in front
6
+ of dependencies.
4
7
 
5
- ## Shared skill
8
+ Use `./bin/skills/coding-standards` for shared coding, review, testing,
9
+ documentation, and PR conventions. This file only adds repo-specific context.
6
10
 
7
- Use the shared `coding-standards` skill from `./bin/skills/coding-standards`
8
- for cross-repository coding, review, testing, documentation, and PR
9
- conventions. Treat this `AGENTS.md` as the repo-specific companion to that
10
- skill.
11
+ ## Map And Commands
11
12
 
12
- ## Quick map
13
-
14
- - Library code: `lib/nonnative/**/*.rb`
15
- - Acceptance tests: `features/**/*.feature`, `features/support/**/*.rb`, `features/step_definitions/**/*.rb`
16
- - Generated gRPC Ruby stubs for tests: `test/grpc/**/*`
17
- - Test proto files: `test/nonnative/v1/*.proto`
13
+ - Library: `lib/nonnative/**/*.rb`
14
+ - Cucumber features/support: `features/**/*.feature`, `features/support/**/*.rb`, `features/step_definitions/**/*.rb`
15
+ - Generated gRPC test stubs: `test/grpc/**/*`
16
+ - Test protos: `test/nonnative/v1/*.proto`
18
17
  - Build wiring: root `Makefile` includes `bin/build/make/*.mak`
19
-
20
- ## Key repo dependency
21
-
22
- This repo depends on the `bin/` git submodule.
23
-
24
- - `.gitmodules` points to `git@github.com:alexfalkowski/bin.git`
25
- - CI runs `git submodule sync && git submodule update --init`
26
- - If `bin/` is missing or you do not have SSH access, `make` targets will fail
27
-
28
- ## Core commands
29
-
18
+ - Required submodule: `bin/` from `git@github.com:alexfalkowski/bin.git`; missing SSH/submodule setup breaks `make`
30
19
  - Install deps: `make dep`
31
20
  - Lint: `make lint`
32
- - Run features: `make features`
33
- - Run benchmarks only: `make benchmarks`
34
- - Clean deps: `make clean-dep`
35
- - Clean reports: `make clean-reports`
36
-
37
- ## Runtime model
38
-
39
- Public entry point is `lib/nonnative.rb`.
40
-
41
- Main module API:
42
-
43
- - `configure`
44
- - `start`
45
- - `stop`
46
- - `clear`
47
- - `reset`
48
- - `pool`
21
+ - Features: `make features`
22
+ - Benchmarks only: `make benchmarks`
23
+ - Cleanup: `make clean-dep`, `make clean-reports`
49
24
 
50
- Configuration lives in `Nonnative::Configuration` and is built either:
25
+ ## Runtime Model
51
26
 
52
- - programmatically with `config.process`, `config.server`, `config.service`
53
- - from YAML with `config.load_file(...)`
27
+ Public entry point: `lib/nonnative.rb`.
54
28
 
55
- Runtime runners:
29
+ Main API: `configure`, `start`, `stop`, `clear`, `reset`, `pool`.
56
30
 
57
- - `Nonnative::Process`: manages an OS process
58
- - `Nonnative::Server`: manages an in-process Ruby server thread
59
- - `Nonnative::Service`: manages only proxy lifecycle for an externally managed dependency
31
+ Configuration is `Nonnative::Configuration`, built with
32
+ `config.process`, `config.server`, `config.service`, or
33
+ `config.load_file(...)`.
60
34
 
61
- `Nonnative::Pool` starts services first, then servers/processes, and stops in the reverse direction.
35
+ Runners:
62
36
 
63
- Readiness and shutdown checks are TCP-only via `Nonnative::Port#open?` and `#closed?`.
37
+ - `Nonnative::Process`: OS process
38
+ - `Nonnative::Server`: in-process Ruby server thread
39
+ - `Nonnative::Service`: proxy lifecycle for an externally managed dependency
64
40
 
65
- ## Cucumber integration
41
+ `Nonnative::Pool` starts services first, then servers/processes, and stops in
42
+ reverse. Readiness and shutdown checks are TCP-only via
43
+ `Nonnative::Port#open?` and `#closed?`.
66
44
 
67
- Cucumber integration lives in `lib/nonnative/cucumber.rb`.
45
+ ## Cucumber Surface
68
46
 
69
- Treat `lib/nonnative/cucumber.rb` as a public compatibility surface for library consumers.
70
- Existing hooks and step text should not be removed or renamed unless the user explicitly wants a breaking change.
47
+ `lib/nonnative/cucumber.rb` is public compatibility surface. Do not remove or
48
+ rename hooks/step text unless the user explicitly requests a breaking change.
71
49
 
72
- Supported tags:
50
+ Lifecycle tags:
73
51
 
74
52
  - `@startup`: start before scenario, stop after scenario
75
53
  - `@manual`: scenario starts manually, stop after scenario
76
54
  - `@clear`: call `Nonnative.clear` before scenario
77
55
  - `@reset`: reset proxies after scenario
78
56
 
79
- Repo-owned feature files also use suite taxonomy tags:
57
+ Suite taxonomy tags: `@acceptance`, `@contract`, `@proxy`, `@config`,
58
+ `@service`, `@benchmark`, `@slow`. `make features` excludes `@benchmark`;
59
+ `make benchmarks` runs only `@benchmark`.
80
60
 
81
- - `@acceptance`: end-to-end runner and client flows
82
- - `@contract`: lower-level lifecycle / command coverage
83
- - `@proxy`: proxy-specific coverage
84
- - `@config`: scenarios or example sets that load YAML/configuration
85
- - `@service`: coverage centered on external services
86
- - `@benchmark`: benchmark-only scenarios
87
- - `@slow`: slower-running scenarios, currently benchmarks
61
+ `Nonnative.clear` clears configuration, logger, observability client, and pool.
62
+ `require 'nonnative'` loads Cucumber integration lazily and is safe outside a
63
+ booted Cucumber runtime. For start-once-per-test-run, use
64
+ `require 'nonnative/startup'`.
88
65
 
89
- `make features` excludes `@benchmark`; `make benchmarks` runs only `@benchmark`.
66
+ ## Proxy And Config Gotchas
90
67
 
91
- `Nonnative.clear` now clears:
68
+ Proxy wiring is the easiest mistake:
92
69
 
93
- - configuration
94
- - logger
95
- - observability client
96
- - pool
70
+ - Runner `host` / `port` are client-facing and used for readiness/shutdown
71
+ - For `fault_injection`, nested `proxy.host` / `proxy.port` are the upstream target
72
+ - Clients connect to runner `host` / `port` when a proxy is enabled
97
73
 
98
- `require 'nonnative'` still loads the Cucumber integration, but hook/step registration is lazy, so plain `require 'nonnative'` is safe outside a booted Cucumber runtime.
74
+ Proxy kinds: `none`, `fault_injection`.
75
+ Fault-injection states: `none`, `close_all`, `delay`, `invalid_data`.
99
76
 
100
- For “start once per test run”, use `require 'nonnative/startup'`.
77
+ Config rules:
101
78
 
102
- ## Proxy wiring
103
-
104
- This is the easiest thing to get wrong.
105
-
106
- - Runner `host` / `port` are the client-facing endpoint and the values used by readiness/shutdown checks
107
- - For `fault_injection`, nested `proxy.host` / `proxy.port` are the upstream target behind the proxy
108
- - Clients should connect to the runner `host` / `port` when a proxy is enabled
109
-
110
- Available proxy kinds:
111
-
112
- - `none`
113
- - `fault_injection`
114
-
115
- Fault injection states:
116
-
117
- - `none`
118
- - `close_all`
119
- - `delay`
120
- - `invalid_data`
121
-
122
- ## Config gotchas
123
-
124
- - Services must be declared under `services:` in YAML, not `processes:`
79
+ - YAML services belong under `services:`, not `processes:`
125
80
  - There is no top-level `config.wait`; `wait` is per runner
126
- - Service configs use `config.service do |s| ... end`, so use `s.host` / `s.port`
127
- - Proxy examples need both sides of the split:
128
- - runner `host` / `port` = proxy endpoint
129
- - nested `proxy.host` / `proxy.port` = upstream target
81
+ - Programmatic service config uses `config.service do |s| ... end`, so use `s.host` / `s.port`
82
+ - Proxy examples need both endpoint sides: runner `host` / `port` for the proxy, nested `proxy.host` / `proxy.port` for upstream
83
+
84
+ ## Fixtures And Limitations
130
85
 
131
- ## Test fixtures worth knowing
86
+ Useful fixtures:
132
87
 
133
- - Local process fixture: `features/support/bin/start`
134
- - HTTP fixtures: `features/support/http_server.rb`, `features/support/http_proxy_server.rb`
135
- - TCP fixture: `features/support/tcp_server.rb`
136
- - gRPC fixtures: `features/support/grpc_server.rb`, plus generated stubs under `test/grpc/`
88
+ - Process: `features/support/bin/start`
89
+ - HTTP: `features/support/http_server.rb`, `features/support/http_proxy_server.rb`
90
+ - TCP: `features/support/tcp_server.rb`
91
+ - gRPC: `features/support/grpc_server.rb`, generated stubs in `test/grpc/`
137
92
 
138
- ## Important limitations / gotchas
93
+ Limitations:
139
94
 
140
- - Ruby version is constrained by `nonnative.gemspec` to `>= 4.0.0` and `< 5.0.0`
141
95
  - The `grpc` Ruby library uses a global logger; per-server gRPC loggers are not really supported
142
- - `make` depends on the `bin/` submodule being present
143
96
  - Local Ruby/Bundler mismatches can break native extensions on macOS
144
- - Coverage output and Cucumber reports are written under `test/reports`
97
+ - Coverage and Cucumber reports go under `test/reports`
145
98
  - Port checks can be flaky if tests reuse ports unexpectedly
146
99
 
147
- ## Where to look first
100
+ ## Look First
148
101
 
149
- - Lifecycle orchestration: `lib/nonnative.rb`, `lib/nonnative/pool.rb`
150
- - Readiness / timeouts: `lib/nonnative/port.rb`, `lib/nonnative/timeout.rb`
102
+ - Lifecycle: `lib/nonnative.rb`, `lib/nonnative/pool.rb`
103
+ - Readiness/timeouts: `lib/nonnative/port.rb`, `lib/nonnative/timeout.rb`
151
104
  - Process lifecycle: `lib/nonnative/process.rb`
152
- - Proxies / fault injection: `lib/nonnative/fault_injection_proxy.rb`, `lib/nonnative/socket_pair_factory.rb`
153
- - Cucumber integration: `lib/nonnative/cucumber.rb`, `lib/nonnative/startup.rb`, `features/support/env.rb`
105
+ - Proxies: `lib/nonnative/fault_injection_proxy.rb`, `lib/nonnative/socket_pair_factory.rb`
106
+ - Cucumber: `lib/nonnative/cucumber.rb`, `lib/nonnative/startup.rb`, `features/support/env.rb`
154
107
  - Config loading: `lib/nonnative/configuration.rb`, `lib/nonnative/configuration_runner.rb`, `lib/nonnative/configuration_proxy.rb`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nonnative (2.13.1)
4
+ nonnative (2.15.1)
5
5
  concurrent-ruby (>= 1, < 2)
6
6
  config (>= 5, < 6)
7
7
  cucumber (>= 7, < 12)
@@ -206,4 +206,4 @@ DEPENDENCIES
206
206
  simplecov-cobertura
207
207
 
208
208
  BUNDLED WITH
209
- 4.0.8
209
+ 4.0.10
data/README.md CHANGED
@@ -547,9 +547,13 @@ Nonnative.configure do |config|
547
547
  config.log = 'nonnative.log'
548
548
 
549
549
  config.process do |p|
550
+ p.host = '127.0.0.1'
551
+ p.port = 20_000
552
+
550
553
  p.proxy = {
551
554
  kind: 'fault_injection',
552
- port: 20_000,
555
+ host: '127.0.0.1',
556
+ port: 12_321,
553
557
  log: 'proxy_server.log',
554
558
  wait: 1,
555
559
  options: {
@@ -569,9 +573,12 @@ url: http://localhost:4567
569
573
  log: nonnative.log
570
574
  processes:
571
575
  -
576
+ host: 127.0.0.1
577
+ port: 20000
572
578
  proxy:
573
579
  kind: fault_injection
574
- port: 20000
580
+ host: 127.0.0.1
581
+ port: 12321
575
582
  log: proxy_server.log
576
583
  wait: 1
577
584
  options:
@@ -592,9 +599,13 @@ Nonnative.configure do |config|
592
599
  config.log = 'nonnative.log'
593
600
 
594
601
  config.server do |s|
602
+ s.host = '127.0.0.1'
603
+ s.port = 20_000
604
+
595
605
  s.proxy = {
596
606
  kind: 'fault_injection',
597
- port: 20_000,
607
+ host: '127.0.0.1',
608
+ port: 12_321,
598
609
  log: 'proxy_server.log',
599
610
  wait: 1,
600
611
  options: {
@@ -614,9 +625,12 @@ url: http://localhost:4567
614
625
  log: nonnative.log
615
626
  servers:
616
627
  -
628
+ host: 127.0.0.1
629
+ port: 20000
617
630
  proxy:
618
631
  kind: fault_injection
619
- port: 20000
632
+ host: 127.0.0.1
633
+ port: 12321
620
634
  log: proxy_server.log
621
635
  wait: 1
622
636
  options:
@@ -15,8 +15,8 @@ module Nonnative
15
15
  # @see Nonnative.proxies
16
16
  class ConfigurationProxy
17
17
  # @return [String] proxy kind name (for example `"none"` or `"fault_injection"`)
18
- # @return [String] proxy bind host (defaults to `"0.0.0.0"`)
19
- # @return [Integer] proxy bind port (defaults to `0`)
18
+ # @return [String] upstream host used by proxy implementations (defaults to `"0.0.0.0"`)
19
+ # @return [Integer] upstream port used by proxy implementations (defaults to `0`)
20
20
  # @return [String, nil] path to proxy log file (implementation-dependent)
21
21
  # @return [Numeric] wait interval (seconds) after proxy state changes (defaults to `0.1`)
22
22
  # @return [Hash] proxy implementation options (implementation-dependent)
@@ -51,8 +51,8 @@ module Nonnative
51
51
  #
52
52
  # @param value [Hash] proxy attributes
53
53
  # @option value [String] :kind proxy kind name (for example `"fault_injection"`)
54
- # @option value [String] :host proxy bind host (optional)
55
- # @option value [Integer] :port proxy bind port
54
+ # @option value [String] :host upstream host behind the proxy (optional)
55
+ # @option value [Integer] :port upstream port behind the proxy
56
56
  # @option value [String] :log proxy log file path
57
57
  # @option value [Numeric] :wait wait interval (seconds) after state changes (optional)
58
58
  # @option value [Hash] :options proxy implementation specific options
@@ -32,6 +32,13 @@ module Nonnative
32
32
  end
33
33
 
34
34
  module ProxySteps
35
+ PROXY_OPERATIONS = {
36
+ 'close_all' => :close_all,
37
+ 'delay' => :delay,
38
+ 'invalid_data' => :invalid_data,
39
+ 'reset' => :reset
40
+ }.freeze
41
+
35
42
  def install_proxy_steps
36
43
  install_proxy_mutation_steps
37
44
  install_proxy_reset_steps
@@ -40,17 +47,17 @@ module Nonnative
40
47
  def install_proxy_mutation_steps
41
48
  Given('I set the proxy for process {string} to {string}') do |name, operation|
42
49
  process = Nonnative.pool.process_by_name(name)
43
- process.proxy.send(operation)
50
+ Nonnative::Cucumber::Registration.apply_proxy_operation(process.proxy, operation)
44
51
  end
45
52
 
46
53
  Given('I set the proxy for server {string} to {string}') do |name, operation|
47
54
  server = Nonnative.pool.server_by_name(name)
48
- server.proxy.send(operation)
55
+ Nonnative::Cucumber::Registration.apply_proxy_operation(server.proxy, operation)
49
56
  end
50
57
 
51
58
  Given('I set the proxy for service {string} to {string}') do |name, operation|
52
59
  service = Nonnative.pool.service_by_name(name)
53
- service.proxy.send(operation)
60
+ Nonnative::Cucumber::Registration.apply_proxy_operation(service.proxy, operation)
54
61
  end
55
62
  end
56
63
 
@@ -70,6 +77,14 @@ module Nonnative
70
77
  service.proxy.reset
71
78
  end
72
79
  end
80
+
81
+ def apply_proxy_operation(proxy, operation)
82
+ method = PROXY_OPERATIONS.fetch(operation) do
83
+ raise ArgumentError, "Unsupported proxy operation '#{operation}'"
84
+ end
85
+
86
+ proxy.public_send(method)
87
+ end
73
88
  end
74
89
 
75
90
  module LifecycleSteps
@@ -4,5 +4,5 @@ module Nonnative
4
4
  # The current gem version.
5
5
  #
6
6
  # @return [String]
7
- VERSION = '2.13.1'
7
+ VERSION = '2.15.1'
8
8
  end
data/lib/nonnative.rb CHANGED
@@ -189,7 +189,7 @@ module Nonnative
189
189
  #
190
190
  # @return [Hash{String=>Class}]
191
191
  def proxies
192
- @proxies ||= { 'fault_injection' => Nonnative::FaultInjectionProxy }.freeze
192
+ @proxies ||= { 'fault_injection' => Nonnative::FaultInjectionProxy }
193
193
  end
194
194
 
195
195
  # Resolves a proxy implementation for a configured kind.
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: 2.13.1
4
+ version: 2.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alejandro Falkowski
@@ -345,7 +345,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
345
345
  - !ruby/object:Gem::Version
346
346
  version: '0'
347
347
  requirements: []
348
- rubygems_version: 4.0.8
348
+ rubygems_version: 4.0.10
349
349
  specification_version: 4
350
350
  summary: Allows you to keep using the power of ruby to test other systems
351
351
  test_files: []