Dev credentials — jeden file dla każdego test
Wszystkie credentials test suites potrzebują żyją w single gitignored file:
secrets/dev-credentials.local.json. Copy committed template i fill w co ty
masz — każda wartość jest optional i testy że potrzebują brakującej wartości skip cleanly.
mkdir -p secrets
cp dev-credentials.example.json secrets/dev-credentials.local.json
# edit secrets/dev-credentials.local.json
Co każdy test tier czyta
| Tier | Potrzeby | Z |
|---|---|---|
Unit (tests/UnitTests) | nic | — deterministic, brak sekretów, brak network |
Integration (tests/IntegrationTests) | Postgres | Testcontainers (Docker) — auto |
Live copy (tests/IntegrationTests/CopyLive) | OpenAPI app + token cache | OpenApi.App, OpenApi.Tokens |
E2E onboarding (tests/E2ETests/CopyLive) | OpenAPI app + cID logins | OpenApi.App, OpenApi.Cids |
E2E real run/backtest (CBotRealRunBacktestTests) | cID login + demo account number | OpenApi.Cids[].{Username,Password,Accounts} |
| AI features | Anthropic key | Ai.ApiKey (unset ⇒ AI features zwracają disabled, app ciągle runs) |
Live economic-calendar sources (tests/IntegrationTests/Calendar/CalendarSourceLiveTests) | FRED / BLS API keys | Calendar.FredApiKey, Calendar.BlsApiKey (unset ⇒ that source's live test skips; the keyless central-bank schedule still works) |
Schema
Zobacz dev-credentials.example.json na repo root. Sekcje:
-
OpenApi.App—{ ClientId, ClientSecret }z cTrader Open API application. -
OpenApi.Cids— cTrader ID logins używane przez headless OAuth onboarding. Każdy entry także niesieAccountsarray — cTrader trading-account numbers (login/account number, np.3635817) pod tym cID że test infrastructure jest allowed do link do app i drive.CBotRealRunBacktestTestsczyta pierwszy entry że ma non-emptyAccountsarray, adds że cID + account do app, potem really runs i backtests cBot na to. Put tylko demo account numbers tutaj — nigdy live account; run/backtest testy place real orders na whatever account ty list. Empty/omittedAccounts⇒ real run/backtest test skips cleanly. -
OpenApi.Tokens— multi-cID token cache (jeden entry per authorized cID z jego refresh/access token + account list). Written automatycznie przez onboarding i przez token-refresh step; ty rarely edit to ręcznie. -
Owner— seed owner login dla app pod E2E. -
Database.ConnectionString— tylko gdy wskazując tests na external Postgres zamiast Testcontainers. -
Ai.ApiKey— Anthropic API key dla AI features. -
Calendar.FredApiKey— FRED (St. Louis Fed) API key. The primary economic-calendar value source (interest rates, inflation, employment). -
Calendar.BlsApiKey— BLS (US Bureau of Labor Statistics) v2 registration key (CPI, PPI, employment, JOLTS). Absent ⇒ the low-quota public tier.Both feed the exact
FredSource/BlsSourcethe ingestion worker uses. With a key present,CalendarSourceLiveTestshits the real provider and asserts observations come back; absent, that source's test skips cleanly. The app also reads these at runtime viaApp:Calendar:FredApiKey/App:Calendar:BlsApiKey(environment variables override — e.g.FRED_API_KEY,BLS_API_KEY).
Precedence
- Environment variables override wszystko (np.
App__OwnerPassword,App:Ai:ApiKey). secrets/dev-credentials.local.json— unified file (preferred).- Legacy split files —
openapi-test-app.local.json,openapi-cids.local.json,openapi-tokens.local.jsonsą ciągle czytane gdy unified file jest absent, więc existing machines keep working. Nowe setups powinny używać single file.
Safety
secrets/i*.local.jsonsą gitignored — nic tutaj nigdy nie jest committed.- Live copy tests refuse do run przeciwko non-demo accounts (
IsLiveaccounts są filtered out przezLiveCopyFixture). Keep tylko demo accounts w token cache. - In-cluster (Kubernetes) runs mount file jako read-only Secret; token refreshes są kept w memory i read-only write-back jest silent no-op.