修改配置编辑不了的问题
This commit is contained in:
1 parent
22b504e53e
commit
2a2f78c81e
42 files changed
+1082
-178
No files matched your search
@@ -2,6 +2,13 @@ import { readFile } from "node:fs/promises";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const fixtureUrl = new URL("../contracts/settings/runtime-v1.json", import.meta.url);
|
||||
const runtimeSettingsMigrationUrl = new URL(
|
||||
"../database/migrations/0003_platform_runtime_settings.sql",
|
||||
import.meta.url
|
||||
);
|
||||
const applicationUrl = new URL("../backend/internal/application/application.go", import.meta.url);
|
||||
const runtimeUrl = new URL("../backend/internal/application/runtime.go", import.meta.url);
|
||||
const settingsServiceUrl = new URL("../backend/internal/settings/service.go", import.meta.url);
|
||||
|
||||
describe("Go runtime settings compatibility fixture", () => {
|
||||
it("freezes the editable whitelist and secret projection rules", async () => {
|
||||
@@ -12,10 +19,42 @@ describe("Go runtime settings compatibility fixture", () => {
|
||||
emptySecretInput: "preserve",
|
||||
emptyNonSecretInput: "write-empty",
|
||||
publicSecretValue: "blank",
|
||||
runtimeApplication: "restart-required"
|
||||
runtimeApplication: "mixed",
|
||||
providerRuntimeApplication: "immediate",
|
||||
providerPersistence: "postgres-with-environment-fallback"
|
||||
});
|
||||
expect(fixture.allowedKeys).toContain("IMAGE_GENERATE_ENGINE");
|
||||
expect(fixture.secretKeys).toContain("ALI_OSS_ACCESS_KEY_SECRET");
|
||||
expect(fixture.allowedKeys).not.toContain("DATABASE_URL");
|
||||
expect(fixture.databaseBackedKeys).toEqual(expect.arrayContaining([
|
||||
"VOLCENGINE_ACCESS_KEY_ID",
|
||||
"EVOLINK_API_KEY",
|
||||
"SEEDANCE_API_KEY",
|
||||
"BAILIAN_API_KEY",
|
||||
"IMAGE_GENERATE_ENGINE",
|
||||
"VIDEO_GENERATE_ENGINE"
|
||||
]));
|
||||
});
|
||||
|
||||
it("requires a PostgreSQL table for mutable provider settings", async () => {
|
||||
const migration = await readFile(runtimeSettingsMigrationUrl, "utf8");
|
||||
expect(migration).toContain("create table if not exists platform_runtime_settings");
|
||||
expect(migration).toContain("setting_key text primary key");
|
||||
expect(migration).toContain("setting_value text not null");
|
||||
});
|
||||
|
||||
it("refreshes database settings at both job-build and provider-call seams", async () => {
|
||||
const [application, runtime, service] = await Promise.all([
|
||||
readFile(applicationUrl, "utf8"),
|
||||
readFile(runtimeUrl, "utf8"),
|
||||
readFile(settingsServiceUrl, "utf8")
|
||||
]);
|
||||
expect(application).toContain("databaseSettingsService(getenv, database.Store)");
|
||||
expect(application).toContain("newRuntimeProviderResolver(getenv, runtimeSettings)");
|
||||
expect(application).toContain("runtimeProviderJobBuilder{");
|
||||
expect(runtime).toContain("runtimeSettingsGetenv(ctx, builder.fallback, builder.settings)");
|
||||
expect(runtime).toContain("runtimeSettingsGetenv(ctx, resolver.fallback, resolver.settings)");
|
||||
expect(service).toContain("values override process/file values");
|
||||
expect(application).not.toContain("validateProductionProviderConfiguration");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user