Skip to content

test(oracle): add Oracle-side integration coverage for system_settings.origin precedence (#794) #804

Description

@ericfitz

Follow-up from #794. Raised by the oracle-db-admin review of that change (finding 6) and deferred deliberately so #794 could land.

The gap

#794 makes config-vs-database precedence depend on system_settings.origin ('seeded' / 'explicit' / NULL). Every test added for it runs on SQLite:

  • api/models/system_setting_test.go
  • api/settings_precedence_test.go
  • api/settings_service_test.go
  • cmd/dbtool/config_origin_test.go
  • cmd/server/startup_checks_test.go
  • internal/dbschema/ backfill tests

SQLite cannot reproduce the mechanisms the feature depends on. It does not collapse '' to NULL, does not uppercase identifiers, and does not exercise godror's VARCHAR2 scan path. The review confirmed by inspection that NullableDBVarchar.Value()/Scan() round-trip 'seeded'/'explicit' intact on Oracle and that no path turns a written origin into NULL — but that is a code reading, not a test.

This matters more than usual because the failure is silent and directional. If an origin value were ever lost on Oracle, the row would read as not-explicit, config would win, and nothing would error — it would just quietly resolve to a different value than the same code resolves to on PostgreSQL.

What to add

An _Integration test (the suffix is required for make test-integration-oci to pick it up) that, against a real ADB:

  1. Seeds a row with origin = 'seeded', reads it back through GetResolvedString with an explicit config value present, asserts the config value wins.
  2. Sets a row explicitly (through SettingsService.Set), asserts the database value wins over an explicit config value.
  3. Asserts a NULL-origin row reads as seeded, i.e. IsExplicit() is false — the fail-safe polarity.
  4. Round-trips 'seeded' and 'explicit' through write → read and asserts neither comes back NULL or empty.
  5. Exercises the BackfillSystemSettingOrigin migration and its CHECK constraint on Oracle, including running it twice for idempotency.

Note the ADB is Always Free and auto-stops when idle, so it needs to be started before the run (see scripts/oci-env.sh).

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions