quonfig 0.0.8 → 0.0.10
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/CHANGELOG.md +17 -0
- data/CLAUDE.md +1 -1
- data/README.md +4 -4
- data/VERSION +1 -1
- data/lib/quonfig/bound_client.rb +26 -0
- data/lib/quonfig/client.rb +104 -2
- data/lib/quonfig/dev_context.rb +41 -0
- data/lib/quonfig/evaluation_details.rb +60 -0
- data/lib/quonfig/evaluator.rb +21 -2
- data/lib/quonfig/options.rb +41 -17
- data/lib/quonfig/resolver.rb +30 -2
- data/lib/quonfig/telemetry/telemetry_reporter.rb +13 -1
- data/lib/quonfig.rb +2 -0
- data/quonfig.gemspec +8 -3
- data/test/integration/test_dev_overrides.rb +40 -0
- data/test/integration/test_helpers.rb +34 -1
- data/test/integration/test_telemetry.rb +14 -0
- data/test/test_client_telemetry.rb +43 -0
- data/test/test_details_getters.rb +242 -0
- data/test/test_dev_context.rb +163 -0
- data/test/test_http_connection.rb +6 -4
- data/test/test_options.rb +53 -22
- metadata +7 -2
data/test/test_options.rb
CHANGED
|
@@ -5,23 +5,13 @@ require 'test_helper'
|
|
|
5
5
|
class TestOptions < Minitest::Test
|
|
6
6
|
API_KEY = 'abcdefg'
|
|
7
7
|
|
|
8
|
-
def test_api_urls_override_env_var
|
|
9
|
-
assert_equal Quonfig::Options::DEFAULT_API_URLS, Quonfig::Options.new.api_urls
|
|
10
|
-
|
|
11
|
-
# blank doesn't take effect
|
|
12
|
-
with_env('QUONFIG_API_URLS', '') do
|
|
13
|
-
assert_equal Quonfig::Options::DEFAULT_API_URLS, Quonfig::Options.new.api_urls
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# non-blank does take effect
|
|
17
|
-
with_env('QUONFIG_API_URLS', 'https://override.example.com') do
|
|
18
|
-
assert_equal ["https://override.example.com"], Quonfig::Options.new.api_urls
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
8
|
def test_default_api_urls_point_to_quonfig
|
|
9
|
+
# DEFAULT_API_URLS is the hardcoded fallback when neither QUONFIG_DOMAIN
|
|
10
|
+
# nor an explicit api_urls: kwarg is set. Domain-derivation happens at
|
|
11
|
+
# construction time, not at constant load time — see derive_api_urls.
|
|
23
12
|
assert_equal [
|
|
24
13
|
'https://primary.quonfig.com',
|
|
14
|
+
'https://secondary.quonfig.com',
|
|
25
15
|
], Quonfig::Options::DEFAULT_API_URLS
|
|
26
16
|
end
|
|
27
17
|
|
|
@@ -150,18 +140,59 @@ class TestOptions < Minitest::Test
|
|
|
150
140
|
assert_equal 0, options.collect_max_shapes
|
|
151
141
|
end
|
|
152
142
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
143
|
+
# ---- QUONFIG_DOMAIN tests (qfg-w6gg) ----
|
|
144
|
+
# A single env var `QUONFIG_DOMAIN` governs api, sse, and telemetry URL
|
|
145
|
+
# derivation. Resolution order (highest wins): explicit kwargs >
|
|
146
|
+
# QUONFIG_DOMAIN > hardcoded default 'quonfig.com'.
|
|
147
|
+
|
|
148
|
+
def test_default_domain_is_quonfig_com
|
|
149
|
+
with_env('QUONFIG_DOMAIN', nil) do
|
|
150
|
+
options = Quonfig::Options.new
|
|
151
|
+
assert_equal [
|
|
152
|
+
'https://primary.quonfig.com',
|
|
153
|
+
'https://secondary.quonfig.com',
|
|
154
|
+
], options.api_urls
|
|
155
|
+
assert_equal 'https://telemetry.quonfig.com', options.telemetry_destination
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def test_quonfig_domain_env_var_derives_all_urls
|
|
160
|
+
with_env('QUONFIG_DOMAIN', 'quonfig-staging.com') do
|
|
161
|
+
options = Quonfig::Options.new
|
|
162
|
+
assert_equal [
|
|
163
|
+
'https://primary.quonfig-staging.com',
|
|
164
|
+
'https://secondary.quonfig-staging.com',
|
|
165
|
+
], options.api_urls
|
|
166
|
+
assert_equal [
|
|
167
|
+
'https://stream.primary.quonfig-staging.com',
|
|
168
|
+
'https://stream.secondary.quonfig-staging.com',
|
|
169
|
+
], options.sse_api_urls
|
|
170
|
+
assert_equal 'https://telemetry.quonfig-staging.com', options.telemetry_destination
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
def test_explicit_api_urls_override_quonfig_domain
|
|
175
|
+
with_env('QUONFIG_DOMAIN', 'quonfig-staging.com') do
|
|
176
|
+
options = Quonfig::Options.new(api_urls: ['http://localhost:8080'])
|
|
177
|
+
assert_equal ['http://localhost:8080'], options.api_urls
|
|
156
178
|
end
|
|
157
179
|
end
|
|
158
180
|
|
|
159
|
-
def
|
|
160
|
-
|
|
181
|
+
def test_explicit_telemetry_url_overrides_quonfig_domain
|
|
182
|
+
with_env('QUONFIG_DOMAIN', 'quonfig-staging.com') do
|
|
183
|
+
options = Quonfig::Options.new(telemetry_url: 'http://localhost:6555')
|
|
184
|
+
assert_equal 'http://localhost:6555', options.telemetry_destination
|
|
185
|
+
end
|
|
161
186
|
end
|
|
162
187
|
|
|
163
|
-
def
|
|
164
|
-
|
|
165
|
-
|
|
188
|
+
def test_quonfig_telemetry_url_env_var_no_longer_read
|
|
189
|
+
# QUONFIG_TELEMETRY_URL has been removed. Setting it must not affect
|
|
190
|
+
# anything; the default (quonfig.com) wins.
|
|
191
|
+
with_env('QUONFIG_DOMAIN', nil) do
|
|
192
|
+
with_env('QUONFIG_TELEMETRY_URL', 'https://should-be-ignored.example.com') do
|
|
193
|
+
assert_equal 'https://telemetry.quonfig.com',
|
|
194
|
+
Quonfig::Options.new.telemetry_destination
|
|
195
|
+
end
|
|
196
|
+
end
|
|
166
197
|
end
|
|
167
198
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: quonfig
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeff Dwyer
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-05-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: concurrent-ruby
|
|
@@ -213,6 +213,7 @@ files:
|
|
|
213
213
|
- lib/quonfig/config_store.rb
|
|
214
214
|
- lib/quonfig/context.rb
|
|
215
215
|
- lib/quonfig/datadir.rb
|
|
216
|
+
- lib/quonfig/dev_context.rb
|
|
216
217
|
- lib/quonfig/duration.rb
|
|
217
218
|
- lib/quonfig/encryption.rb
|
|
218
219
|
- lib/quonfig/error.rb
|
|
@@ -227,6 +228,7 @@ files:
|
|
|
227
228
|
- lib/quonfig/errors/type_mismatch_error.rb
|
|
228
229
|
- lib/quonfig/errors/uninitialized_error.rb
|
|
229
230
|
- lib/quonfig/evaluation.rb
|
|
231
|
+
- lib/quonfig/evaluation_details.rb
|
|
230
232
|
- lib/quonfig/evaluator.rb
|
|
231
233
|
- lib/quonfig/exponential_backoff.rb
|
|
232
234
|
- lib/quonfig/fixed_size_hash.rb
|
|
@@ -255,6 +257,7 @@ files:
|
|
|
255
257
|
- test/fixtures/datafile.json
|
|
256
258
|
- test/integration/test_context_precedence.rb
|
|
257
259
|
- test/integration/test_datadir_environment.rb
|
|
260
|
+
- test/integration/test_dev_overrides.rb
|
|
258
261
|
- test/integration/test_enabled.rb
|
|
259
262
|
- test/integration/test_enabled_with_contexts.rb
|
|
260
263
|
- test/integration/test_get.rb
|
|
@@ -278,6 +281,8 @@ files:
|
|
|
278
281
|
- test/test_context_shape.rb
|
|
279
282
|
- test/test_context_shape_aggregator.rb
|
|
280
283
|
- test/test_datadir.rb
|
|
284
|
+
- test/test_details_getters.rb
|
|
285
|
+
- test/test_dev_context.rb
|
|
281
286
|
- test/test_duration.rb
|
|
282
287
|
- test/test_encryption.rb
|
|
283
288
|
- test/test_evaluation_summaries_aggregator.rb
|