nonnative 2.8.0 → 2.10.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7370ea5a582e82e738d71cbffc4a3ad847e8050165b02d33f1c18301212ace2
4
- data.tar.gz: d3c139dd5cb598c013196f8362b38929783910e38fd4c45227e0093e28626eb8
3
+ metadata.gz: 8220ca25997b624a13ebf5f3f6a046af6bf05ee7428b21b96454d7c23ad42bef
4
+ data.tar.gz: 5a1884b26d92f57b54631ef22a4c2d6b3f16690c81364353ecb3e2d941b39638
5
5
  SHA512:
6
- metadata.gz: 171e964df36ea5434a138fa0f01bfede21b7ad4b7708246b395e22eb3b373c9dda61299d72a663a759cd200572432d4ee7787f50de224808fd8a01c32315aa4e
7
- data.tar.gz: 780c202b553579a078bdbcc0370d3d8641ea2c7a6268c7ab53182db970f1a299b8853fa8cf5ed6fd59ccd15bb46d63826c2adc5ef69bb010b661e4aba10a6971
6
+ metadata.gz: d026441a2ed85facab82a48a8967e246d6c717c00c5c0039fb434feb585fe35fb23fbfa06732f85ec5491d0febcdda056d1cf4264a014efe432b87dfc705275f
7
+ data.tar.gz: 2cc84560c80a27144d3176b3e019a6ab9c86e32c2215e774d97d5a58927c34dda006a3da8f3b5b356b19bc7e2e96fb863b2bc168c9f4ac3e7a91f7181f08c57d
data/.circleci/config.yml CHANGED
@@ -25,7 +25,8 @@ jobs:
25
25
  - vendor
26
26
  - run: make lint
27
27
  - run: make sec
28
- - run: make features
28
+ - run: COVERAGE_NAME="Cucumber Features" make features
29
+ - run: COVERAGE_NAME="Cucumber Benchmarks" make benchmarks
29
30
  - store_test_results:
30
31
  path: test/reports
31
32
  - store_artifacts:
data/AGENTS.md CHANGED
@@ -59,6 +59,9 @@ Readiness and shutdown checks are TCP-only via `Nonnative::Port#open?` and `#clo
59
59
 
60
60
  Cucumber integration lives in `lib/nonnative/cucumber.rb`.
61
61
 
62
+ Treat `lib/nonnative/cucumber.rb` as a public compatibility surface for library consumers.
63
+ Existing hooks and step text should not be removed or renamed unless the user explicitly wants a breaking change.
64
+
62
65
  Supported tags:
63
66
 
64
67
  - `@startup`: start before scenario, stop after scenario
@@ -66,6 +69,18 @@ Supported tags:
66
69
  - `@clear`: call `Nonnative.clear` before scenario
67
70
  - `@reset`: reset proxies after scenario
68
71
 
72
+ Repo-owned feature files also use suite taxonomy tags:
73
+
74
+ - `@acceptance`: end-to-end runner and client flows
75
+ - `@contract`: lower-level lifecycle / command coverage
76
+ - `@proxy`: proxy-specific coverage
77
+ - `@config`: scenarios or example sets that load YAML/configuration
78
+ - `@service`: coverage centered on external services
79
+ - `@benchmark`: benchmark-only scenarios
80
+ - `@slow`: slower-running scenarios, currently benchmarks
81
+
82
+ `make features` excludes `@benchmark`; `make benchmarks` runs only `@benchmark`.
83
+
69
84
  `Nonnative.clear` now clears:
70
85
 
71
86
  - configuration
@@ -115,7 +130,7 @@ Fault injection states:
115
130
 
116
131
  ## Important limitations / gotchas
117
132
 
118
- - Ruby version is constrained by `nonnative.gemspec` to `>= 3.4.0` and `< 4.0.0`
133
+ - Ruby version is constrained by `nonnative.gemspec` to `>= 4.0.0` and `< 5.0.0`
119
134
  - The `grpc` Ruby library uses a global logger; per-server gRPC loggers are not really supported
120
135
  - `make` depends on the `bin/` submodule being present
121
136
  - Local Ruby/Bundler mismatches can break native extensions on macOS
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nonnative (2.8.0)
4
+ nonnative (2.10.0)
5
5
  concurrent-ruby (>= 1, < 2)
6
6
  config (>= 5, < 6)
7
7
  cucumber (>= 7, < 11)
data/README.md CHANGED
@@ -64,6 +64,17 @@ Nonnative ships Cucumber hooks (when loaded) that support these tags/strategies:
64
64
  - `@clear`: clears memoized configuration, logger, observability client, and pool before scenario
65
65
  - `@reset`: resets proxies after scenario
66
66
 
67
+ The repo’s own Cucumber suite also uses taxonomy tags to classify coverage:
68
+ - `@acceptance`: end-to-end behavior across configured runners and clients
69
+ - `@contract`: lower-level contract and lifecycle behavior
70
+ - `@proxy`: proxy-specific behavior and failure injection
71
+ - `@config`: coverage that exercises YAML/config loading
72
+ - `@service`: scenarios centered on externally managed dependencies
73
+ - `@benchmark`: benchmark-only scenarios run by `make benchmarks`
74
+ - `@slow`: slower scenarios, currently used by benchmark coverage
75
+
76
+ `make features` excludes `@benchmark`, while `make benchmarks` runs only `@benchmark`.
77
+
67
78
  Requiring `nonnative` is enough; the Cucumber hooks and step definitions are installed lazily once Cucumber’s Ruby DSL is ready.
68
79
 
69
80
  If you want “start once per test run”, require:
@@ -75,20 +75,40 @@ module Nonnative
75
75
  module LifecycleSteps
76
76
  def install_state_steps
77
77
  install_start_step
78
+ install_attempt_start_step
79
+ install_attempt_stop_step
78
80
  install_unhealthy_step
79
81
  install_healthy_step
80
82
  end
81
83
 
82
84
  def install_start_step
83
- Given('I start the system') do
85
+ When('I start the system') do
84
86
  Nonnative.start
85
87
  end
86
88
  end
87
89
 
90
+ def install_attempt_start_step
91
+ When('I attempt to start the system') do
92
+ @start_error = nil
93
+ Nonnative.start
94
+ rescue StandardError => e
95
+ @start_error = e
96
+ end
97
+ end
98
+
99
+ def install_attempt_stop_step
100
+ When('I attempt to stop the system') do
101
+ @stop_error = nil
102
+ Nonnative.stop
103
+ rescue StandardError => e
104
+ @stop_error = e
105
+ end
106
+ end
107
+
88
108
  def install_unhealthy_step
89
109
  opts = observability_options
90
110
 
91
- Given('I should see {string} as unhealthy') do |service|
111
+ Then('I should see {string} as unhealthy') do |service|
92
112
  wait_for { Nonnative.observability.health(opts).code }.to eq(503)
93
113
  wait_for { Nonnative.observability.health(opts).body }.to include(service)
94
114
  end
@@ -132,11 +152,11 @@ module Nonnative
132
152
 
133
153
  def install_error_assertion_steps
134
154
  Then('starting the system should raise an error') do
135
- expect { Nonnative.start }.to raise_error(Nonnative::StartError)
155
+ expect(@start_error).to be_a(Nonnative::StartError)
136
156
  end
137
157
 
138
158
  Then('stopping the system should raise an error') do
139
- expect { Nonnative.stop }.to raise_error(Nonnative::StopError)
159
+ expect(@stop_error).to be_a(Nonnative::StopError)
140
160
  end
141
161
  end
142
162
 
@@ -3,8 +3,8 @@
3
3
  module Nonnative
4
4
  # Socket-pair variant used by the fault-injection proxy to simulate corrupted/incoherent traffic.
5
5
  #
6
- # When active, data written to the upstream socket is corrupted by shuffling the characters in the
7
- # payload before forwarding.
6
+ # When active, data written to the upstream socket is corrupted by shuffling the payload bytes
7
+ # before forwarding.
8
8
  #
9
9
  # This behavior is enabled by calling {Nonnative::FaultInjectionProxy#invalid_data}.
10
10
  #
@@ -12,7 +12,10 @@ module Nonnative
12
12
  # @see Nonnative::SocketPairFactory
13
13
  # @see Nonnative::SocketPair
14
14
  class InvalidDataSocketPair < SocketPair
15
- # Writes corrupted data to the socket by shuffling characters.
15
+ # Writes corrupted data to the socket by shuffling bytes.
16
+ #
17
+ # The payload must always change, otherwise short or repetitive inputs such as "test" can
18
+ # occasionally pass through unchanged and make fault-injection scenarios flaky.
16
19
  #
17
20
  # @param socket [IO] the socket to write to
18
21
  # @param data [String] the original payload
@@ -20,9 +23,18 @@ module Nonnative
20
23
  def write(socket, data)
21
24
  Nonnative.logger.info "shuffling socket data '#{socket.inspect}' for 'invalid_data' pair"
22
25
 
23
- data = data.chars.shuffle.join
26
+ super(socket, corrupt(data))
27
+ end
28
+
29
+ private
30
+
31
+ def corrupt(data)
32
+ bytes = data.bytes
33
+ corrupted = bytes.shuffle
34
+ return corrupted.pack('C*') unless corrupted == bytes
24
35
 
25
- super
36
+ corrupted[0] = (corrupted[0] + 1) % 256
37
+ corrupted.pack('C*')
26
38
  end
27
39
  end
28
40
  end
@@ -4,5 +4,5 @@ module Nonnative
4
4
  # The current gem version.
5
5
  #
6
6
  # @return [String]
7
- VERSION = '2.8.0'
7
+ VERSION = '2.10.0'
8
8
  end
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.8.0
4
+ version: 2.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alejandro Falkowski