feat: allow production provider bootstrap

This commit is contained in:
inman committed 2026-08-18 00:36:05 +08:00
1 parent 6480e503eb
commit 22fc7a56d8
21 files changed
+192 -18

No files matched your search

+17
View File
@@ -100,6 +100,23 @@ func TestServiceGetUsesInjectedEnvironmentWithoutMutatingProcess(t *testing.T) {
assertSecretProjection(t, value, "SEEDANCE_API_KEY", true)
}
func TestLoadEnvironmentAllowsBootstrapRuntimeFlagButIgnoresUnknownKeys(t *testing.T) {
path := filepath.Join(t.TempDir(), ".env.local")
if err := os.WriteFile(path, []byte("ZHINIAN_ALLOW_UNCONFIGURED_PROVIDERS=true\nUNKNOWN_RUNTIME_FLAG=true\n"), 0o600); err != nil {
t.Fatal(err)
}
values, err := LoadEnvironment(path, nil)
if err != nil {
t.Fatal(err)
}
if values["ZHINIAN_ALLOW_UNCONFIGURED_PROVIDERS"] != "true" {
t.Fatalf("bootstrap flag = %q", values["ZHINIAN_ALLOW_UNCONFIGURED_PROVIDERS"])
}
if _, exists := values["UNKNOWN_RUNTIME_FLAG"]; exists {
t.Fatal("unknown runtime flag was loaded")
}
}
func TestServiceSynchronizesBillingAccountWithoutRequiringRestart(t *testing.T) {
writer := &billingWriterStub{}
service := New(filepath.Join(t.TempDir(), ".env.local"), nil, nil).WithBillingAccountWriter(writer)