quonfig 0.0.2
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 +7 -0
- data/.claude/rules/constitution.md +81 -0
- data/.claude/rules/git-safety.md +11 -0
- data/.claude/rules/issue-tracking.md +13 -0
- data/.claude/rules/testing-workflow.md +28 -0
- data/.envrc.sample +3 -0
- data/.github/CODEOWNERS +2 -0
- data/.github/pull_request_template.md +8 -0
- data/.github/workflows/push_gem.yml +49 -0
- data/.github/workflows/ruby.yml +60 -0
- data/.github/workflows/test.yaml +40 -0
- data/.rubocop.yml +13 -0
- data/.tool-versions +1 -0
- data/CHANGELOG.md +301 -0
- data/CLAUDE.md +29 -0
- data/CODEOWNERS +1 -0
- data/Gemfile +26 -0
- data/Gemfile.lock +177 -0
- data/LICENSE.txt +20 -0
- data/README.md +213 -0
- data/Rakefile +64 -0
- data/VERSION +1 -0
- data/dev/allocation_stats +60 -0
- data/dev/benchmark +40 -0
- data/dev/console +12 -0
- data/dev/script_setup.rb +18 -0
- data/lib/quonfig/bound_client.rb +71 -0
- data/lib/quonfig/caching_http_connection.rb +95 -0
- data/lib/quonfig/client.rb +221 -0
- data/lib/quonfig/config_envelope.rb +5 -0
- data/lib/quonfig/config_loader.rb +103 -0
- data/lib/quonfig/config_store.rb +42 -0
- data/lib/quonfig/context.rb +101 -0
- data/lib/quonfig/datadir.rb +101 -0
- data/lib/quonfig/duration.rb +58 -0
- data/lib/quonfig/encryption.rb +74 -0
- data/lib/quonfig/error.rb +6 -0
- data/lib/quonfig/errors/env_var_parse_error.rb +11 -0
- data/lib/quonfig/errors/initialization_timeout_error.rb +12 -0
- data/lib/quonfig/errors/invalid_sdk_key_error.rb +19 -0
- data/lib/quonfig/errors/missing_default_error.rb +13 -0
- data/lib/quonfig/errors/missing_env_var_error.rb +11 -0
- data/lib/quonfig/errors/type_mismatch_error.rb +11 -0
- data/lib/quonfig/errors/uninitialized_error.rb +13 -0
- data/lib/quonfig/evaluation.rb +64 -0
- data/lib/quonfig/evaluator.rb +464 -0
- data/lib/quonfig/exponential_backoff.rb +21 -0
- data/lib/quonfig/fixed_size_hash.rb +14 -0
- data/lib/quonfig/http_connection.rb +46 -0
- data/lib/quonfig/internal_logger.rb +173 -0
- data/lib/quonfig/murmer3.rb +50 -0
- data/lib/quonfig/options.rb +194 -0
- data/lib/quonfig/periodic_sync.rb +74 -0
- data/lib/quonfig/quonfig.rb +58 -0
- data/lib/quonfig/rate_limit_cache.rb +41 -0
- data/lib/quonfig/reason.rb +39 -0
- data/lib/quonfig/resolver.rb +42 -0
- data/lib/quonfig/semantic_logger_filter.rb +90 -0
- data/lib/quonfig/semver.rb +132 -0
- data/lib/quonfig/sse_config_client.rb +135 -0
- data/lib/quonfig/time_helpers.rb +7 -0
- data/lib/quonfig/types.rb +56 -0
- data/lib/quonfig/weighted_value_resolver.rb +49 -0
- data/lib/quonfig.rb +57 -0
- data/quonfig.gemspec +149 -0
- data/scripts/generate_integration_tests.rb +362 -0
- data/test/fixtures/datafile.json +87 -0
- data/test/integration/test_context_precedence.rb +194 -0
- data/test/integration/test_datadir_environment.rb +76 -0
- data/test/integration/test_enabled.rb +784 -0
- data/test/integration/test_enabled_with_contexts.rb +94 -0
- data/test/integration/test_get.rb +224 -0
- data/test/integration/test_get_feature_flag.rb +34 -0
- data/test/integration/test_get_or_raise.rb +86 -0
- data/test/integration/test_get_weighted_values.rb +29 -0
- data/test/integration/test_helpers.rb +139 -0
- data/test/integration/test_helpers_test.rb +73 -0
- data/test/integration/test_post.rb +34 -0
- data/test/integration/test_telemetry.rb +114 -0
- data/test/support/common_helpers.rb +106 -0
- data/test/support/mock_base_client.rb +27 -0
- data/test/support/mock_config_loader.rb +1 -0
- data/test/test_bound_client.rb +109 -0
- data/test/test_caching_http_connection.rb +218 -0
- data/test/test_client.rb +255 -0
- data/test/test_config_loader.rb +70 -0
- data/test/test_context.rb +136 -0
- data/test/test_datadir.rb +199 -0
- data/test/test_duration.rb +37 -0
- data/test/test_encryption.rb +16 -0
- data/test/test_evaluator.rb +285 -0
- data/test/test_exponential_backoff.rb +44 -0
- data/test/test_fixed_size_hash.rb +119 -0
- data/test/test_helper.rb +17 -0
- data/test/test_http_connection.rb +79 -0
- data/test/test_internal_logger.rb +34 -0
- data/test/test_options.rb +167 -0
- data/test/test_rate_limit_cache.rb +44 -0
- data/test/test_reason.rb +79 -0
- data/test/test_rename.rb +65 -0
- data/test/test_resolver.rb +144 -0
- data/test/test_semantic_logger_filter.rb +123 -0
- data/test/test_semver.rb +108 -0
- data/test/test_sse_config_client.rb +297 -0
- data/test/test_typed_getters.rb +131 -0
- data/test/test_types.rb +141 -0
- data/test/test_weighted_value_resolver.rb +84 -0
- metadata +311 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
#
|
|
3
|
+
# AUTO-GENERATED from integration-test-data/tests/eval/datadir_environment.yaml.
|
|
4
|
+
# Regenerate with `bundle exec ruby scripts/generate_integration_tests.rb`.
|
|
5
|
+
# Do NOT edit by hand — changes will be overwritten.
|
|
6
|
+
|
|
7
|
+
require 'test_helper'
|
|
8
|
+
require 'integration/test_helpers'
|
|
9
|
+
|
|
10
|
+
class TestDatadirEnvironment < Minitest::Test
|
|
11
|
+
def setup
|
|
12
|
+
@store = IntegrationTestHelpers.build_store("datadir_environment")
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# datadir with environment option gets environment-specific value
|
|
16
|
+
def test_datadir_with_environment_option_gets_environment_specific_value
|
|
17
|
+
begin
|
|
18
|
+
client = Quonfig::Client.new(datadir: IntegrationTestHelpers.data_dir, environment: "Production")
|
|
19
|
+
assert_equal "test4", client.get("james.test.key")
|
|
20
|
+
rescue Exception => e
|
|
21
|
+
skip("datadir Client.new not yet wired: #{e.class}: #{e.message}")
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# datadir with QUONFIG_ENVIRONMENT env var gets environment-specific value
|
|
26
|
+
def test_datadir_with_quonfig_environment_env_var_gets_environment_specific_value
|
|
27
|
+
begin
|
|
28
|
+
IntegrationTestHelpers.with_env({"QUONFIG_ENVIRONMENT" => "Production"}) do
|
|
29
|
+
client = Quonfig::Client.new(datadir: IntegrationTestHelpers.data_dir)
|
|
30
|
+
assert_equal "test4", client.get("james.test.key")
|
|
31
|
+
end
|
|
32
|
+
rescue Exception => e
|
|
33
|
+
skip("datadir Client.new not yet wired: #{e.class}: #{e.message}")
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# environment option supersedes QUONFIG_ENVIRONMENT env var
|
|
38
|
+
def test_environment_option_supersedes_quonfig_environment_env_var
|
|
39
|
+
begin
|
|
40
|
+
IntegrationTestHelpers.with_env({"QUONFIG_ENVIRONMENT" => "nonexistent"}) do
|
|
41
|
+
client = Quonfig::Client.new(datadir: IntegrationTestHelpers.data_dir, environment: "Production")
|
|
42
|
+
assert_equal "test4", client.get("james.test.key")
|
|
43
|
+
end
|
|
44
|
+
rescue Exception => e
|
|
45
|
+
skip("datadir Client.new not yet wired: #{e.class}: #{e.message}")
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# config without environment override returns default value
|
|
50
|
+
def test_config_without_environment_override_returns_default_value
|
|
51
|
+
begin
|
|
52
|
+
client = Quonfig::Client.new(datadir: IntegrationTestHelpers.data_dir, environment: "Production")
|
|
53
|
+
assert_equal "hello from no env row", client.get("config.with.only.default.env.row")
|
|
54
|
+
rescue Exception => e
|
|
55
|
+
skip("datadir Client.new not yet wired: #{e.class}: #{e.message}")
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# datadir without environment fails to init
|
|
60
|
+
def test_datadir_without_environment_fails_to_init
|
|
61
|
+
begin
|
|
62
|
+
skip("init raise-case (missing_environment) — no Quonfig::Errors mapping yet")
|
|
63
|
+
rescue Exception => e
|
|
64
|
+
skip("datadir Client.new not yet wired: #{e.class}: #{e.message}")
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# datadir with invalid environment fails to init
|
|
69
|
+
def test_datadir_with_invalid_environment_fails_to_init
|
|
70
|
+
begin
|
|
71
|
+
skip("init raise-case (invalid_environment) — no Quonfig::Errors mapping yet")
|
|
72
|
+
rescue Exception => e
|
|
73
|
+
skip("datadir Client.new not yet wired: #{e.class}: #{e.message}")
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|