feat: 支持 provider profile config.toml 管理
This commit is contained in:
@@ -92,6 +92,27 @@ process.exit(1);
|
||||
assert.equal(JSON.stringify(list).includes("auth.json"), true);
|
||||
assert.equal(JSON.stringify(list).includes("redacted-fixture"), false);
|
||||
|
||||
const config = await client.get("/api/v1/provider-profiles/deepseek/config") as JsonRecord;
|
||||
assert.equal(config.profile, "deepseek");
|
||||
assert.equal(config.configToml, "model = \"fixture\"\n");
|
||||
assert.equal(config.configTomlPrinted, true);
|
||||
assert.equal(JSON.stringify(config).includes("redacted-fixture"), false);
|
||||
|
||||
const updatedConfigToml = "model = \"fixture-updated\"\n";
|
||||
const updatedConfig = await client.put("/api/v1/provider-profiles/deepseek/config", {
|
||||
configToml: updatedConfigToml,
|
||||
delegatedBy: { system: "hwlab-v02", userId: "u1", username: "tester", requestId: "req-config-selftest" },
|
||||
reason: "self-test",
|
||||
}) as JsonRecord;
|
||||
assert.equal(updatedConfig.profile, "deepseek");
|
||||
assert.equal(updatedConfig.configTomlPrinted, false);
|
||||
assert.equal(JSON.stringify(updatedConfig).includes(updatedConfigToml), false);
|
||||
const configReplaceRecord = JSON.parse(await readFile(replacedSecretPath, "utf8")) as JsonRecord;
|
||||
const configSecretManifest = configReplaceRecord.manifest as JsonRecord;
|
||||
const configData = configSecretManifest.data as JsonRecord;
|
||||
assert.equal(Buffer.from(String(configData["auth.json"]), "base64").toString("utf8").includes("redacted-fixture"), true);
|
||||
assert.equal(Buffer.from(String(configData["config.toml"]), "base64").toString("utf8"), updatedConfigToml);
|
||||
|
||||
const updated = await client.put("/api/v1/provider-profiles/deepseek/credential", {
|
||||
apiKey: secretText,
|
||||
delegatedBy: { system: "hwlab-v02", userId: "u1", username: "tester", requestId: "req-selftest" },
|
||||
@@ -147,7 +168,7 @@ process.exit(1);
|
||||
assert.equal(finalValidation.status, "completed");
|
||||
assert.equal(JSON.stringify(finalValidation).includes(secretText), false);
|
||||
assertNoSecretLeak(finalValidation);
|
||||
return { name: "provider-profile-management", tests: ["provider-profiles-list-redacted", "provider-profile-set-key-redacted", "provider-profile-secret-replace-annotation-cleanup", "provider-profile-deepseek-moon-bridge", "provider-profile-manager-secret-rbac", "provider-profile-validation-runner-job"] };
|
||||
return { name: "provider-profile-management", tests: ["provider-profiles-list-redacted", "provider-profile-config", "provider-profile-set-key-redacted", "provider-profile-secret-replace-annotation-cleanup", "provider-profile-deepseek-moon-bridge", "provider-profile-manager-secret-rbac", "provider-profile-validation-runner-job"] };
|
||||
} finally {
|
||||
await new Promise<void>((resolve) => server.server.close(() => resolve()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user